Packages

trait Entity[F[_], S, E] extends StateReader[F, S] with StateReaderHelpers[F, S] with EventWriter[F, E]

Entity[F, S, E] is the ability to read an event-sourced entity state of type S and append events of type E affecting this state.

These dual reader/writer abilities are what is needed to describe command handler behavior. When interpreting code involving Entity, the final resulting value in the monadic chain is typically understood as the reply, and all appended events are persisted to the journal atomically by the runtime. Read always provides the up-to-date state however, thanks to event folding happening within the interpreter, ensuring consistency throughout the chain.

F

context

S

state

E

event

See also

DurableEntity for the equivalent without event-sourcing

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

Abstract Value Members

  1. implicit abstract def monad: Monad[F]
    Definition Classes
    StateReaderHelpers
  2. 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
  3. abstract def write(event: E, other: E*): F[Unit]

    Append events to the event log in context F

    Append events to the event log in context F

    event

    event

    other

    more events

    Definition Classes
    EventWriter

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 EventWriter[F, E]

Inherited from StateReaderHelpers[F, S]

Inherited from StateReader[F, S]

Inherited from AnyRef

Inherited from Any

Ungrouped