site

inline fun <M, T> site(history: MutableHistory<M>, strategy: SyncStrategy = SyncStrategy.Continuous): Site<M>

Creates a new Site with a backing history.

Parameters

history

the MutableHistory backing the site.

strategy

the SyncStrategy that's applied. Defaults to SyncStrategy.Continuous.

M

the type of the model for this Site.

T

the type of the events managed by this Site.


inline fun <T> site(vararg events: Pair<EventIdentifier, T>, strategy: SyncStrategy = SyncStrategy.Continuous): Site<Unit>

Creates a new Site with a backing history.

Parameters

events

some initial events to populate the history.

strategy

the SyncStrategy that's applied. Defaults to SyncStrategy.Continuous.

T

the type of the events managed by this Site.


inline fun <M, T> site(    initial: M,     projection: OneWayProjection<M, T>,     vararg events: Pair<EventIdentifier, T>,     strategy: SyncStrategy = SyncStrategy.Continuous): Site<M>

Creates a new Site for the provided SiteIdentifier, with a backing log. Additionally, this overload takes a OneWayProjection and lets you specify a projection to apply to the data.

Parameters

initial

the initial value for the projection aggregate.

projection

the OneWayProjection for this Site.

events

some initial events to populate the history.

strategy

the SyncStrategy that's applied. Defaults to SyncStrategy.Continuous.

M

the type of the model for this Site.

T

the type of the events managed by this Site.


inline fun <M, T, C> site(    initial: M,     projection: TwoWayProjection<M, T, C>,     vararg events: Pair<EventIdentifier, T>,     strategy: SyncStrategy = SyncStrategy.Continuous): Site<M>

Creates a new Site for the provided SiteIdentifier, with a backing log. Additionally, this overload takes a TwoWayProjection and lets you specify a projection to apply to the data.

Parameters

initial

the initial value for the projection aggregate.

projection

the TwoWayProjection for this Site.

events

some initial events to populate the history.

strategy

the SyncStrategy that's applied. Defaults to SyncStrategy.Continuous.

M

the type of the model for this Site.

T

the type of the events managed by this Site.

C

the type of the changes generated by this Site.


fun <M, R> site(    history: MutableHistory<R>,     strategy: SyncStrategy = SyncStrategy.Continuous,     transform: (R) -> M): Site<M>

Creates a new Site for the provided SiteIdentifier, with a backing log.

Parameters

history

the MutableHistory for this Site.

strategy

the SyncStrategy that's applied. Defaults to SyncStrategy.Continuous.

transform

a function mapping the backing model from type R to type M.

M

the type of the model for this Site.

R

the type of the backing model for this Site.