Package

oriana

Permalink

package oriana

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. oriana
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class ConfiguredRetrySchedule extends FixedRetrySchedule

    Permalink

    A configured schedule derives its delays from the config key "retry_db_delay_millis", where it expects to find a number list.

    A configured schedule derives its delays from the config key "retry_db_delay_millis", where it expects to find a number list. The numbers are interpreted as millisecond delays.

  2. class DBExecution[DBContext <: ExecutableDatabaseContext, T] extends Actor

    Permalink

    Internal implementation actor for a single database interaction.

    Internal implementation actor for a single database interaction. This actor handles the actual invocation of an operation, including failure / retry logic.

    DBContext

    context type

    T

    result type

  3. trait DBInitializer[-InitCtx <: ExecutableDatabaseContext] extends DBOperation[InitCtx, InitComplete.type]

    Permalink

    Initializers prepare the Database on startup, ensuring it is in a usable state once application traffic reaches it.

    Initializers prepare the Database on startup, ensuring it is in a usable state once application traffic reaches it. They may be simple (as in, create tables if absent) or elaborate. The init process needs to be complete before the first "user" operation can be attempted.

  4. type DBOperation[-Context <: ExecutableDatabaseContext, +Result] = (Context) ⇒ Future[Result]

    Permalink

    Type for operations - simple DB interactions that are not part of a transaction.

    Type for operations - simple DB interactions that are not part of a transaction. Since they may have multiple, disjoined stages, they can not be retried and can have partial results (depending on which parts of them were executed).

  5. case class DBSinkSettings(cancelOnError: (Throwable) ⇒ Boolean = _ => true, parallelism: Int = 1) extends Product with Serializable

    Permalink

    Options modifying the behaviour of a database sink

    Options modifying the behaviour of a database sink

    cancelOnError

    should the sink cancel the stream on an error? The default will always cancel

    parallelism

    limit of parallel items to process. Default is single-transaction

  6. type DBStreamOperation[-Context <: DatabaseContext, +Result, -E <: Effect] = (Context) ⇒ DBIOAction[_, Streaming[Result], E]

    Permalink

    Models a streamable DB operation.

    Models a streamable DB operation. These operations should not modify state. Note the missing [DatabaseCommandExecution] type to prevent direct execution

  7. trait DBTransaction[Context <: DatabaseContext, +R] extends AnyRef

    Permalink

    Transactions are all-or-nothing sets of operations on the database.

    Transactions are all-or-nothing sets of operations on the database. They can either succeed (which applies all modifications that may have arisen simultaneously), or fail. If they fail, the oriana actors will attempt the transaction again until its retry allowance is exhausted.

    Note the absence of the DatabaseCommandExecution trait in the Context, which prevents direct access to the database - and thus allows making the transaction retryable

    Context

    context subclass required by this transaction

    R

    result type

  8. class DatabaseActor extends Actor

    Permalink

    The central point of oriana, an actor that enables an init lifecycle for a database, and a parent to individual operation actors.

    The central point of oriana, an actor that enables an init lifecycle for a database, and a parent to individual operation actors.

    This actor goes through 3 lifecvcle stages. Uninitialized, where it accepts simple operations and transactions (operations for short), changes to its retry configuration and changes to the initializer. It will queue, but not execute any operations it receives. These queued operations will use the retry configuration that was active when they were first received. Once it received the [DatabaseActor.Init] message, it will evolve to the initializing state.

    While the actor is initializing, it executes the configured initializer. It will accept operations and keep them queued, and accept changes to the retry configuration. If initialization succeeds, it will enter the ready state. If initialization fails, the failure will trigger an exception on this actor, which will (in turn) lead to the actors supervisor deciding the further fate of the database access. Upon entering the ready state, all previously queued operations are fired

    In the ready state, the actor accepts retry policy changes and operations, which start executing immediately

  9. trait DatabaseCommandExecution extends AnyRef

    Permalink

    Marks a context as supporting direct execution.

    Marks a context as supporting direct execution. Contexts with direct execution can be used for "simple" DBOperations, but because transactionality cannot be guaranteed, will not be subject to retries.

  10. trait DatabaseContext extends AnyRef

    Permalink

    Database context encapsulate a driver, its api and a list of all tables.

    Database context encapsulate a driver, its api and a list of all tables. You are encouraged to add members for your tables when you implement your class. For example:

    class MyContext extends DatabaseContext {
      val driver = MySQLDriver
      val api = driver.api
    
      val ponies: TableAccess[Pony] = new PonyTableAccess(driver)
      val riders: TableAccess[Rider] = new RiderTableAccess(driver)
      val ponyReviews: TableAccess[PonyReview] = new PonyReviewTableAccess(driver)
    
      val allTables = List(ponies, riders, ponyReviews)
    }
  11. final case class DatabaseName(name: String) extends AnyVal with Product with Serializable

    Permalink

    Wrapper type representing a database name.

    Wrapper type representing a database name. The name is supposed to be the actor name of the database actor.

    name

    name of the actor

  12. type ExecutableDatabaseContext = DatabaseContext with DatabaseCommandExecution

    Permalink

    Context type for operations - mixes in the DatabaseCommandExecution trait in to grant access to the database object of the context

  13. class FixedRetrySchedule extends RetrySchedule

    Permalink

    Attempts a fixed number of retries, with constant time delays

  14. trait NoRetry extends AnyRef

    Permalink

    Mix in this trait to an exception to make the exception "fatal", and prevent the normal transaction handling from retrying on this failure.

    Mix in this trait to an exception to make the exception "fatal", and prevent the normal transaction handling from retrying on this failure. This feature is useful to distinguish "business domain" errors which will never go away from technical glitches and transient conditions (such as a lost DB connection), which a wait-and-retry can eventually defeat.

  15. trait RetrySchedule extends AnyRef

    Permalink

    Defines a retry schedule for failures of an DBTransaction.

  16. abstract class SimpleDatabaseContext extends DatabaseContext

    Permalink

    A base class for Contexts that derive their database connection from a typesafe configuration.

    A base class for Contexts that derive their database connection from a typesafe configuration. The driver object still needs to be determined "by hand", or by calling the alternate constructor, which offers a way to determine it by configuration

  17. trait TableAccess[TableMappingType <: AbstractTable[_]] extends AnyRef

    Permalink

    Defines access to a slick table.

    Defines access to a slick table. This includes a query object (for CRUD operations) and a schema create action.

    TableMappingType

    type of slick FRM table class

  18. class TransactionSubscriber[Context <: DatabaseContext, T] extends Subscriber[T]

    Permalink

    Subscriber implementing the sink semantics.

    Subscriber implementing the sink semantics. Do not use manually, instead use executeAsSink()

    Context

    context type

    T

    input type

Value Members

  1. object DBExecution

    Permalink
  2. object DBTransaction

    Permalink

    Companion for the DBTransaction class

  3. object DatabaseActor

    Permalink
  4. object DatabaseName extends Serializable

    Permalink
  5. object DefaultSchedule extends FixedRetrySchedule

    Permalink

    The default schedule retries five times, with escalating delays.

    The default schedule retries five times, with escalating delays. The retries occur at 100, 200, 300, 400 and 500 ms intervals. This schedule is primarily beneficial to testing and demo environments, and should generally be replaced by a more considered schedule in applications.

  6. object NoRetrySchedule extends RetrySchedule

    Permalink

    Simple schedule that never attempts a retry

  7. object SchemaCreateInitializer extends DBInitializer[ExecutableDatabaseContext]

    Permalink

    Simple initializer that executes create DDL for any missing tables.

    Simple initializer that executes create DDL for any missing tables. Does not care or have capability to provide an initial data load.

  8. object TableAccess

    Permalink
  9. def executeAsFlow[Context <: DatabaseContext, In, Out](op: (In) ⇒ DBStreamOperation[Context, Out, _])(implicit arg0: Manifest[Out], actorRefFactory: ActorRefFactory, timeout: Timeout, ec: ExecutionContext, actorName: DatabaseName): Flow[In, Out, NotUsed]

    Permalink

    Performs a database-using operation as a flow element.

    Performs a database-using operation as a flow element.

    Context

    Context type (useful for table access)

    In

    input type

    Out

    output type

    op

    operation to execute

    actorRefFactory

    factory for accessing the lower-level ([executeDBOperation] operation.

    timeout

    ask timeout for each execution

    ec

    context to use

    actorName

    database actor name

    returns

    flow modelling the specified transformation

  10. def executeAsSink[Context <: DatabaseContext, T](op: (T) ⇒ DBTransaction[Context, _], settings: DBSinkSettings = DBSinkSettings())(implicit actorRefFactory: ActorRefFactory, timeout: Timeout, ec: ExecutionContext, actorName: DatabaseName): Sink[T, Future[Int]]

    Permalink

    Creates a sink that executes the specified database transaction for every element published to the stream.

    Creates a sink that executes the specified database transaction for every element published to the stream. The sink has some options that can be set to modify its operation. The operation materializes a future that returns the number of successfully-processed transactions.

    Context

    Context type (useful for table access)

    T

    input type

    op

    operation to perform

    settings

    settings for the sink

    actorRefFactory

    factory for accessing the lower-level ([executeDBOperation] operation.

    timeout

    ask timeout for each execution

    ec

    context to use

    actorName

    database actor name

    returns

    sink instantiated to execute the specified transaction per-element.

  11. def executeAsSource[Context <: DatabaseContext, T](op: DBStreamOperation[Context, T, _])(implicit arg0: Manifest[T], actorRefFactory: ActorRefFactory, timeout: Timeout, ec: ExecutionContext, actorName: DatabaseName): Source[T, NotUsed]

    Permalink

    Creates a source from a streamable database operation

    Creates a source from a streamable database operation

    Context

    context type (useful for table access)

    T

    emitted type

    op

    operation

    actorRefFactory

    actor factory for communication to the database actor

    timeout

    ask timeout for the initial creation of the sink, not for each operation

    ec

    context to use

    actorName

    database actor name

    returns

    source backed by the passed DB operation

  12. def executeDBOperation[T](op: DBOperation[_ <: ExecutableDatabaseContext, T])(implicit arg0: Manifest[T], actorRefFactory: ActorRefFactory, timeout: Timeout, ec: ExecutionContext, actorName: DatabaseName): Future[T]

    Permalink

    Syntactic sugar for access to the database.

    Syntactic sugar for access to the database. The block argument is scheduled as a [DBOperation] to the implicit database.

    executeDBOperation { ctx: MyContext with DatabaseCommandExecution =>
      // ... generate actions, and execute them with ctx.database.run
      ctx.database.run(DBIO.successful(42))
    }
    T

    operation return type

    op

    operation to perform

    actorRefFactory

    most likely an actor system

    timeout

    timeout for ask operation(s) used under the hood to implement the Future

    ec

    execution context for ask operation(s) used under the hood to implement the Future

    actorName

    name for the database actor

    returns

    future with operation result

  13. def executeDBTransaction[Context <: DatabaseContext, T](op: DBTransaction[Context, T])(implicit arg0: Manifest[T], actorRefFactory: ActorRefFactory, timeout: Timeout, ec: ExecutionContext, actorName: DatabaseName): Future[T]

    Permalink

    Syntactic sugar for access to the database.

    Syntactic sugar for access to the database. The block argument is scheduled as a [DBTransaction] to the implicit database. Transactions may be attempted multiple times in case of failures, making them good candidates for idiom such as optimistic locking.

    executeDBTransaction { ctx: MyContext =>
      // ... generate actions, which will be wrapped with transactionally and executed
      DBIO.successful(42)
    }
    Context

    context type to pass to the transaction

    T

    result type of the transaction

    op

    transaction to attempt

    actorRefFactory

    most likely an actor system

    timeout

    timeout for ask operation(s) used under the hood to implement the Future

    ec

    execution context for ask operation(s) used under the hood to implement the Future

    actorName

    name for the database actor

    returns

    future with transaction result

Inherited from AnyRef

Inherited from Any

Ungrouped