Package

pt.tecnico.dsi

akkastrator

Permalink

package akkastrator

Content Hierarchy
Visibility
  1. Public
  2. All

Type Members

  1. sealed abstract class AbstractOrchestrator[R] extends PersistentActor with AtLeastOnceDelivery with ActorLogging with IdImplicits

    Permalink

    An Orchestrator executes a set of, possibly dependent, Tasks.

    An Orchestrator executes a set of, possibly dependent, Tasks. A task corresponds to sending a message to an actor, handling its response and possibly mutate the internal state of the Orchestrator.

    The Orchestrator together with the Task is able to:

    • Delivering messages with at-least-once delivery guarantee. The DistinctIdsOrchestrator ensures each destination will see an independent strictly monotonically increasing sequence number without gaps.
    • Handling Status messages, that is, if some actor is interested in querying the Orchestrator for its current status, the Orchestrator will respond with the status of each task.
    • When all the dependencies of a task finish that task will be started and the Orchestrator will be prepared to handle the messages that the task destination sends.
    • If the Orchestrator crashes, the state of each task will be correctly restored.

    NOTE: the responses that are received must be Serializable.

    In order for the Orchestrator and the Tasks to be able to achieve all of this they have to access and modify each others state directly. This means they are very tightly coupled with each other. To make this relation more obvious and to enforce it, you will only be able to create tasks if you have a reference to an orchestrator (which is passed implicitly to a task).

    If you have the need to refactor the creation of tasks so that you can use them in multiple orchestrators you can leverage self type annotations.

    R

    the type of result this orchestrator returns when it finishes.

  2. case class AtLeast(n: Int) extends MinimumVotes with Product with Serializable

    Permalink

    A MinimumVotes function where at least n votes are needed to achieve a quorum.

  3. class Bundle[R] extends Orchestrator[Seq[R]]

    Permalink
  4. final class CorrelationId extends AnyVal with Ordered[CorrelationId] with Id

    Permalink
  5. final class DeliveryId extends AnyVal with Id

    Permalink
  6. abstract class DistinctIdsOrchestrator[R] extends AbstractOrchestrator[R]

    Permalink

    In a DistinctIdsOrchestrator an independent sequence is used for each destination of the orchestrator.

    In a DistinctIdsOrchestrator an independent sequence is used for each destination of the orchestrator. In this orchestrator the delivery id is not sufficient to disambiguate which task should handle the message, so the ID = CorrelationId and the matchId also needs to check the sender. There is also the added necessity of being able to compute the correlation id for a given (sender, deliveryId) as well as translating a correlation id back to a delivery id.

  7. abstract class FullTask[R, DL <: HList] extends AnyRef

    Permalink

    A full task represents a task plus its dependencies.

    A full task represents a task plus its dependencies. It ensures a Task is only created when all of its dependencies have finished.

    R

    the result type of this task.

    DL

    the type of the dependencies HList.

  8. sealed trait Id extends Typed[Long]

    Permalink
  9. trait IdImplicits extends AnyRef

    Permalink
  10. trait MinimumVotes extends (Int) ⇒ Int

    Permalink

    A function that calculates how many votes are needed to achieve a quorum, given the number of destinations.

  11. abstract class Orchestrator[R] extends AbstractOrchestrator[R]

    Permalink

    In a simple orchestrator the same sequence number (of akka-persistence) is used for all the destinations of the orchestrator.

    In a simple orchestrator the same sequence number (of akka-persistence) is used for all the destinations of the orchestrator. Because of this, ID = DeliveryId, and matchId only checks the deliveryId as that will be enough information to disambiguate which task should handle the response.

  12. class Quorum[R] extends Orchestrator[R]

    Permalink
  13. case class Report[R](index: Int, description: String, dependencies: Seq[Int], state: State, destination: Option[ActorPath], result: Option[R]) extends Product with Serializable

    Permalink

    An immutable representation (a report) of a Task in a given moment of time.

    An immutable representation (a report) of a Task in a given moment of time.

    R

    the type of the result.

    index

    the task index this report pertains to.

    description

    a text that describes the task in a human readable way. Or a message key to be used in internationalization.

    dependencies

    the indexes of the tasks that must have finished in order for the task to be able to start.

    state

    the current state of the task.

    destination

    the destination of the task. If the task hasn't started this will be a None.

    result

    the result of the task. If the task hasn't finished this will be a None.

  14. final case class Settings(useTaskColors: Boolean = true, taskColors: Seq[String] = ...) extends Product with Serializable

    Permalink

    This class holds all the settings that parameterize akkastrator.

    This class holds all the settings that parameterize akkastrator.

    If you would like to create an instance of settings from a typesafe config invoke Settings.fromConfig.

  15. case class SpawnAndStart(props: Props, startId: Long) extends Product with Serializable

    Permalink
  16. class Spawner extends Actor with ActorLogging

    Permalink
  17. abstract class Task[R] extends AnyRef

    Permalink

    A task corresponds to sending a message to an actor, handling its response and possibly mutate the internal state of its Orchestrator.

    A task corresponds to sending a message to an actor, handling its response and possibly mutate the internal state of its Orchestrator.

    The answer(s) to the sent message must be handled in behavior. behavior must invoke finish when no further processing is necessary. Or abort if the received message will prevent subsequent tasks from executing properly.

    The pattern matching inside behavior must invoke matchId to ensure the received message is in fact the one that this task its waiting to receive.

    The internal state of the orchestrator might be mutated inside behavior.

    This class is very tightly coupled with Orchestrator and the reverse is also true. See AbstractOrchestrator for more details on why that is the case.

    R

    the return type of this Task.

  18. class TaskBundle[R] extends TaskSpawnOrchestrator[Seq[R], Bundle[R]]

    Permalink

    A task that creates a variable number of tasks and succeeds when all the created tasks finish successfully.

    A task that creates a variable number of tasks and succeeds when all the created tasks finish successfully. The return type of the tasks must be the same. Their messages and destinations are unrestrained.

    This task is specially useful to create n tasks where n is computed from the result of another task.

    R

    the return type of the tasks created using tasksCreator.

  19. class TaskQuorum[R] extends TaskSpawnOrchestrator[R, Quorum[R]]

    Permalink

    A task that creates a variable number of tasks and succeeds when n tasks finish producing the same result.

    A task that creates a variable number of tasks and succeeds when n tasks finish producing the same result. n is calculated with the minimumVotes function. The return type and the message of the tasks must be the same. And their destinations must be different.

    The last two restrictions are validated in runtime when the quorum is created. If they fail the task will abort. To validate the messages are the same, each task message is compared via != against the other tasks messages.

  20. class TaskSpawnOrchestrator[R, O <: AbstractOrchestrator[R]] extends Task[R]

    Permalink

    In order for this task to work correctly either: · The created orchestrator must send to its parent a Orchestrator.Success when it finishes and a Orchestrator.Failure when it aborts.

    In order for this task to work correctly either: · The created orchestrator must send to its parent a Orchestrator.Success when it finishes and a Orchestrator.Failure when it aborts. And terminate afterwords of sending the messages. · Or the method behavior must be overridden to handle the messages the inner orchestrator sends when it terminates or aborts.

    R

    the return type of this Task. Also the return type of the spawned orchestrator.

    O

    the type of AbstractOrchestrator the Props must create.

Value Members

  1. object All extends MinimumVotes

    Permalink

    A MinimumVotes function where all the votes are needed to achieve a quorum.

  2. object DSL

    Permalink
  3. object Event

    Permalink
  4. object HListConstraints

    Permalink
  5. object IdImplicits extends IdImplicits

    Permalink
  6. object Majority extends MinimumVotes

    Permalink

    A MinimumVotes function where a majority of votes are needed to achieve a quorum.

  7. object Orchestrator

    Permalink
  8. object QuorumAlreadyAchieved extends Exception with Product with Serializable

    Permalink

    Exception used to abort waiting tasks when the quorum was already achieved.

  9. object QuorumImpossibleToAchieve extends Exception with Product with Serializable

    Permalink

    Signals that the quorum is impossible to achieve since enough tasks have aborted that prevent the orchestrator from achieving enough votes to satisfy the minimumVotes function.

  10. object QuorumNotAchieved extends Exception with Product with Serializable

    Permalink

    Signals that every task in the Quorum has finished but a quorum has not achieved.

  11. object Settings extends Serializable

    Permalink
  12. object Task

    Permalink

Ungrouped