o

riff.monix

EventSource

object EventSource

Contains a function for applying a log type A to a state S, and persisting that state.

For example, the log entries may be Strings and the State 'S' could be Set[String]. Or perhaps the log entries are a sealed trait of CRUD operations, and the State is the database.

If the State itself is too big to fit in memory, then it could just be a cache over top a persistent storage.

If you don't want to persist the state and just e.g. event source from the beginning of the log, then this all becomes a lot easier (just a one-liner, folding A over the state S).

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EventSource
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class FileDao[S] extends StateDao[S]

    A file-based StateDao implementation which writes a '.latestSnapshotIndex' file under the given directory to track what the last snapshot taken was

    A file-based StateDao implementation which writes a '.latestSnapshotIndex' file under the given directory to track what the last snapshot taken was

    It then writes down snapshot-X files to contain the persisted snapshots

    S

    the snapshot type

  2. trait StateDao[S] extends AnyRef

    Represents the IO needed to persist and retrieve a snapshot

    Represents the IO needed to persist and retrieve a snapshot

    S

    the snapshot type

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. def apply[S, A](dao: StateDao[S], log: CommittedOps[A], snapEvery: Int, bufferSize: Int = 1000)(combine: (S, A) ⇒ S): Try[Observable[S]]

    S

    the state type

    A

    the log entry type

    dao

    the access object for obtaining the snaphot

    log

    a means of obtaining the 'committedEntriesFrom'

    snapEvery

    the frequency of how often we should write down the snapshots

    combine

    a function to combine the log entries of type 'A' w/ the state

    returns

    an observable of the updated state

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  7. def dao[S, A](dataDir: Path, initial: ⇒ S, numberToKeep: Option[Int] = None)(implicit arg0: FromBytes[S], arg1: ToBytes[S]): FileDao[S]
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def inDir[S, A](dataDir: Path, initial: ⇒ S, log: CommittedOps[A], snapEvery: Int, numberToKeep: Option[Int] = None)(combine: (S, A) ⇒ S)(implicit arg0: FromBytes[S], arg1: ToBytes[S]): Try[Observable[S]]

    Provides a means to track snapshots for the log.

    Provides a means to track snapshots for the log. Instead of observing the log directly, the EventSource observes the log and ever N updates produces a snapshot.

    This is typically more useful than observing the logs directly, as it provides a way to represent your application's state machine (of type 'S') by applying single log entries to it (of type 'A').

    Observers of the snapshot will get the latest snapshot version and the raw log entries ;-)

    This is an alternative to log compaction.

    S

    the snapshot type

    A

    the log entry type

    dataDir

    the directory under which snapshots should be written

    initial

    the initial state should none be available

    log

    a means of obtaining the 'committedEntriesFrom'

    snapEvery

    the frequency of how often we should write down the snapshots

    combine

    a function to combine the log entries of type 'A' w/ the state

  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped