Checkpoints
Remembers how far each view model has read.
A checkpoint has to live as long as the view model it tracks: pair an in-memory view model with layerMemory so it rebuilds from the event store on restart, and a durable one with a durable checkpoint store.
Classes
Section titled “Classes”Checkpoints
Section titled “Checkpoints”Defined in: src/Checkpoints.ts:13
Extends
Section titled “Extends”Shape<"effect-cqrs/Checkpoints", {advance?: (viewModel,from,to) =>Effect<boolean,EventStoreError>;get(viewModel):Effect<number,EventStoreError>;set(viewModel,position):Effect<void,EventStoreError>; },this>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Checkpoints(
_):Checkpoints
Defined in: node_modules/.pnpm/effect@4.0.6/node_modules/effect/dist/Context.d.ts:121
Parameters
Section titled “Parameters”never
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Context.Service<Checkpoints, { /** The last processed position, `0` when the view model never ran. */ get(viewModel: string): Effect.Effect<number, EventStoreError> set(viewModel: string, position: number): Effect.Effect<void, EventStoreError> /** * Moves a checkpoint to `to` only if it is still at `from`, and returns whether it * moved. View models use it to notice that another process moved their checkpoint, * which can happen for a moment while a lease changes hands: in a `transaction` * the batch then rolls back instead of being committed twice. Stores without it * fall back to `set`, which can’t notice. */ readonly advance?: | ((viewModel: string, from: number, to: number) => Effect.Effect<boolean, EventStoreError>) | undefined }>()(“effect-cqrs/Checkpoints”).constructor
Variables
Section titled “Variables”layerMemory
Section titled “layerMemory”
constlayerMemory:Layer.Layer<Checkpoints>
Defined in: src/Checkpoints.ts:29