factos/factos_sqlight/simulate

SQLite-backed execution of application subscriptions during simulation.

Accepted simulated event batches run strong subscriptions in a BEGIN IMMEDIATE transaction. The event history remains in memory; only application-owned projection writes are committed to SQLite.

Values

pub fn new(
  model: factos.Model(command, state, event, domain_error),
  with events: List(event),
  connection connection: sqlight.Connection,
  subscriptions subscriptions: List(
    factos.Subscription(
      sqlight.Connection,
      factos.Recorded(event),
      subscription_error,
    ),
  ),
) -> simulate.Simulation(
  event,
  command,
  state,
  domain_error,
  subscription_error,
  sqlight.Error,
)

Create a simulation with initial events and SQLite subscriptions.

The initial event batch and every successful simulate.dispatch batch run in their own transaction. Subscription or transaction failure leaves the batch out of simulated history and is returned by simulate.errors.

Search Document