trait AsyncAction[A, P <: AsyncAction[A, P]] extends Action

Base trait for asynchronous actions. Provides support for handling of multi-state actions. Implementation classes must implement result, next and state functions. If you are using Pot, consider using PotAction instead.

Example:

case class MyAction(
  state: PotState = PotState.PotEmpty,
  result: Try[String] = Failure(new AsyncAction.PendingException)) extends AsyncAction[Int, MyAction] {
  def next(newState: PotState, newValue: Try[String]) = MyAction(newState, newValue)
}
A

Type of action result

P

Type of the actual action class

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

Abstract Value Members

  1. abstract def next(newState: PotState, newValue: Try[A]): P

    Moves the action to the next state.

    Moves the action to the next state.

    newState

    New state for the action

    newValue

    New value for the action

    returns

    A new instance of this action with updated state and value

  2. abstract def result: Try[A]
  3. abstract def state: PotState

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. def effect[B](f: ⇒ Future[B])(success: (B) ⇒ A, failure: (Throwable) ⇒ Throwable = identity)(implicit ec: ExecutionContext): EffectSingle[P]

    Wraps a by-name future result into an effect using success and failure transformations.

    Wraps a by-name future result into an effect using success and failure transformations.

    f

    Future to wrap, passes using by-name (lazy evaluation)

    success

    Transformation function for success case

    failure

    Transformation function for failure case

    returns

    An Effect for running the provided Future

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def failed(ex: Throwable): P

    Moves this action to a failed state with the provided exception.

    Moves this action to a failed state with the provided exception.

    ex

    Reason for the failure.

  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def handle[M](pf: PartialFunction[PotState, ActionResult[M]]): ActionResult[M]

    Handles the action using the supplied partial function matching current state.

  13. def handleWith[M, T](handler: ActionHandler[M, T], effect: Effect)(f: (AsyncAction.this.type, ActionHandler[M, T], Effect) ⇒ ActionResult[M]): ActionResult[M]

    Handles the action using an external handler function.

    Handles the action using an external handler function. The function is provided with instance of this AsyncAction, the ActionHandler this action currently resides in and the provided update Effect.

    handler

    The current action handler instance.

    effect

    Effect that performs the requested async operation.

    f

    External handler function

    returns

    An action result

  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. def pending: P

    Moves this action to pending state.

  20. def ready(a: A): P

    Moves this action to ready state with a result value.

    Moves this action to ready state with a result value.

    a

    Result for the action.

  21. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  26. implicit object PActionType extends ActionType[P]

Inherited from Action

Inherited from AnyRef

Inherited from Any

Ungrouped