Trait/Object

diode.data

AsyncAction

Related Docs: object AsyncAction | package data

Permalink

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
Known Subclasses
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

    Permalink

    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]

    Permalink
  3. abstract def state: PotState

    Permalink

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. implicit object PActionType extends ActionType[P]

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def effect[B](f: ⇒ Future[B])(success: (B) ⇒ A, failure: (Throwable) ⇒ Throwable = identity)(implicit ec: ExecutionContext): EffectSingle[P]

    Permalink

    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

  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def failed(ex: Throwable): P

    Permalink

    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.

  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def handle[M](pf: PartialFunction[PotState, ActionResult[M]]): ActionResult[M]

    Permalink

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

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

    Permalink

    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

  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. def pending: P

    Permalink

    Moves this action to pending state.

  21. def ready(a: A): P

    Permalink

    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.

  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  24. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Action

Inherited from AnyRef

Inherited from Any

Ungrouped