Packages

t

endless.core.entity

DurableEntity

trait DurableEntity[F[_], S] extends StateReader[F, S] with StateReaderHelpers[F, S] with StateWriter[F, S]

DurableEntity[F, S] is the ability to read and write an entity state of type S together with the ability to compose such dependent effectful functions.

These dual reader/writer abilities are what is needed to describe command handler behavior. This model enables a stateful entity to store the full state after processing each command instead of using event sourcing. When interpreting code involving DurableEntity, the final resulting value in the monadic chain is typically understood as the reply, and any written state is persisted behind the scenes by the runtime. Read always provides the state as it was last written.

F

context

S

state

See also

Entity for the event-sourcing equivalent

Linear Supertypes
StateWriter[F, S], StateReaderHelpers[F, S], StateReader[F, S], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DurableEntity
  2. StateWriter
  3. StateReaderHelpers
  4. StateReader
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def modify(f: (S) => S): F[Unit]

    Modify the entity state with the given function

    Modify the entity state with the given function

    f

    state modifier

    returns

    unit in F context

    Definition Classes
    StateWriter
  2. abstract def modifyF(f: (S) => F[S]): F[Unit]

    Modify the entity state with the given function expressed in F context

    Modify the entity state with the given function expressed in F context

    f

    state modifier in F context

    returns

    unit in F context

    Definition Classes
    StateWriter
  3. implicit abstract def monad: Monad[F]
    Definition Classes
    StateReaderHelpers
  4. abstract def read: F[Option[S]]

    Read the entity state, returns None if the entity doesn't yet exist

    Read the entity state, returns None if the entity doesn't yet exist

    returns

    optional state in F context

    Definition Classes
    StateReader
  5. abstract def write(s: S): F[Unit]

    Write the entity state

    Write the entity state

    s

    entity state

    returns

    unit in F context

    Definition Classes
    StateWriter

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(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  10. def ifKnown[Error, A](fa: (S) => A)(ifUnknown: => Error): F[\/[Error, A]]

    Convenience function which applies fa on the state if entity exists and wraps this in a Right, otherwise returns a Left with the provided error value.

    Convenience function which applies fa on the state if entity exists and wraps this in a Right, otherwise returns a Left with the provided error value.

    fa

    function to apply on state

    ifUnknown

    left value in case of missing entity

    Definition Classes
    StateReaderHelpers
  11. def ifKnownElse[A](fa: (S) => F[A])(ifUnknownF: => F[A]): F[A]

    Convenience function which applies fa on the state if entity exists, otherwise returns a default value

    Convenience function which applies fa on the state if entity exists, otherwise returns a default value

    fa

    function to apply on state

    ifUnknownF

    value in case of missing entity in F context

    Definition Classes
    StateReaderHelpers
  12. def ifKnownF[Error, A](fa: (S) => F[A])(ifUnknown: => Error): F[\/[Error, A]]

    Convenience function which applies fa on the state if entity exists and wraps this in a Right, otherwise returns a Left with the provided error value.

    Convenience function which applies fa on the state if entity exists and wraps this in a Right, otherwise returns a Left with the provided error value.

    fa

    function to apply on state

    ifUnknown

    left value in case of missing entity

    Definition Classes
    StateReaderHelpers
  13. def ifKnownFE[Error, A](fa: (S) => F[\/[Error, A]])(ifUnknown: => Error): F[\/[Error, A]]

    Convenience function which applies fa on the state if entity exists, otherwise returns a Left with the provided error value.

    Convenience function which applies fa on the state if entity exists, otherwise returns a Left with the provided error value.

    fa

    function to apply on state

    ifUnknown

    left value in case of missing entity

    Definition Classes
    StateReaderHelpers
  14. def ifKnownT[Error, A](fa: (S) => EitherT[F, Error, A])(ifUnknown: => Error): F[\/[Error, A]]

    Convenience function which applies fa on the state if entity exists and unwraps EitherT value, otherwise returns a Left with the provided error value.

    Convenience function which applies fa on the state if entity exists and unwraps EitherT value, otherwise returns a Left with the provided error value.

    fa

    function to apply on state

    ifUnknown

    left value in case of missing entity

    Definition Classes
    StateReaderHelpers
  15. def ifUnknown[Error, A](a: => A)(ifKnown: (S) => Error): F[\/[Error, A]]

    Convenience function which returns a in a Right if entity doesn't yet exist, otherwise calls ifKnown with the state and wraps this in a Left.

    Convenience function which returns a in a Right if entity doesn't yet exist, otherwise calls ifKnown with the state and wraps this in a Left.

    ifKnown

    function to compute left value in case of existing entity

    Definition Classes
    StateReaderHelpers
  16. def ifUnknownElse[A](fa: => F[A])(ifKnown: (S) => F[A]): F[A]

    Convenience function which returns a value fa in F context, otherwise calls ifKnown with the state

    Convenience function which returns a value fa in F context, otherwise calls ifKnown with the state

    fa

    value in case of missing entity in F context

    ifKnown

    function to apply on state

    Definition Classes
    StateReaderHelpers
  17. def ifUnknownF[Error, A](fa: => F[A])(ifKnown: (S) => Error): F[\/[Error, A]]

    Convenience function which invokes fa if entity doesn't yet exist and wraps this in a Right, otherwise calls ifKnown with the state and wraps this in a Left.

    Convenience function which invokes fa if entity doesn't yet exist and wraps this in a Right, otherwise calls ifKnown with the state and wraps this in a Left.

    fa

    success value when entity doesn't exist yet

    ifKnown

    function to compute left value in case of existing entity

    Definition Classes
    StateReaderHelpers
  18. def ifUnknownFE[Error, A](fa: => F[\/[Error, A]])(ifKnown: (S) => Error): F[\/[Error, A]]

    Convenience function which invokes fa if entity doesn't yet exist and wraps this in a Right, otherwise calls ifKnown with the state and wraps this in a Left.

    Convenience function which invokes fa if entity doesn't yet exist and wraps this in a Right, otherwise calls ifKnown with the state and wraps this in a Left.

    fa

    success value when entity doesn't exist yet

    ifKnown

    function to compute left value in case of existing entity

    Definition Classes
    StateReaderHelpers
  19. def ifUnknownT[Error, A](fa: => EitherT[F, Error, A])(ifKnown: (S) => Error): F[\/[Error, A]]

    Convenience function which invokes fa if entity doesn't yet exist, otherwise calls , ifKnown with the the state and wraps this in a Left.

    Convenience function which invokes fa if entity doesn't yet exist, otherwise calls , ifKnown with the the state and wraps this in a Left.

    fa

    value wrapped in EitherT when entity doesn't exist yet

    ifKnown

    function to compute left value in case of existing entity

    Definition Classes
    StateReaderHelpers
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from StateWriter[F, S]

Inherited from StateReaderHelpers[F, S]

Inherited from StateReader[F, S]

Inherited from AnyRef

Inherited from Any

Ungrouped