Skip to main content

Crate eventcore_types

Crate eventcore_types 

Source
Expand description

Shared vocabulary types and traits for the EventCore event sourcing library.

This crate provides the foundational types that are shared between the main eventcore crate and adapter implementations like eventcore-postgres. By extracting these types into a separate crate, we enable feature flag-based adapter re-exports without circular dependencies.

§Overview

This crate contains:

  • Command traits: CommandLogic, CommandStreams, StreamResolver, Event, NewEvents
  • Command types: StreamDeclarations, StreamDeclarationsError
  • Store trait: EventStore, with EventStoreError and Operation
  • Command-state snapshots: CommandStateSnapshotId, CommandStateSnapshot, and CommandStateReplayCheckpoint
  • Stream types: StreamId, StreamVersion, StreamWrites, StreamWriteEntry, StreamPattern, StreamPrefix
  • Event streaming: EventStream, EventStreamSlice, collect_events
  • Projection traits: Projector, EventReader, CheckpointStore, ProjectorCoordinator
  • Projection types: EventFilter, EventPage, StreamPosition, FailureContext, FailureStrategy, MaxRetries, BatchSize, DelayMilliseconds, BackoffMultiplier
  • Errors: CommandError, BusinessRuleMessage

Structs§

AttemptNumber
Attempt number for retry operations (1-based).
BackoffMultiplier
Backoff multiplier for exponential retry delays.
BatchSize
Batch size domain type for limiting query results.
BusinessRuleMessage
String-based error for business rule violations created from string messages.
CommandStateReplayCheckpoint
A command-state projection checkpoint after one stream was fully replayed.
CommandStateSnapshot
A durable command-state read-model projection.
CommandStateSnapshotId
Stable identifier for a command-state projection.
DelayMilliseconds
Delay in milliseconds for retry or backoff operations.
DeliveryIdentityError
Error returned when a delivery identity contains no non-whitespace text.
DeliveryPosition
A positive, source-scoped position in the global delivery sequence.
DeliverySourceId
Stable identity for the event source that owns a delivery sequence.
EventFilter
Filter criteria for selecting which events to read from the event store.
EventPage
Pagination parameters for reading events.
EventStream
An async stream of events read from a single stream, generic over the consumer’s event payload type.
EventStreamSlice
Marker type returned by a successful EventStore::append_events() call.
EventTypeName
Persisted discriminator for an event type selected for projection.
FailureContext
Context provided to error handler when event processing fails.
MaxConsecutiveFailures
Maximum number of consecutive poll failures before stopping.
MaxRetries
Maximum number of retry attempts.
MaxRetryAttempts
Maximum number of retry attempts for event processing.
NewEvents
Collection of new events produced by a command.
PersistedEventEnvelope
Opaque persisted event data delivered by a ProjectionSource.
PersistedEventId
Stable persisted event identity, distinct from the delivery position.
ProjectionSelection
Stable selection contract used to read persisted events for a projection.
ProjectionSelectionId
Stable application-supplied identity for a projection selection contract.
ProjectorName
Stable application-supplied identity for a transactional projector.
RetryCount
Count of retry attempts that have been made (0-based).
StreamDeclarations
StreamId
Stream identifier domain type.
StreamPattern
Stream pattern domain type for filtering events by POSIX glob pattern.
StreamPosition
Opaque cursor representing a location in an EventReader delivery sequence.
StreamPrefix
Stream prefix domain type for filtering events by stream ID prefix.
StreamVersion
Stream version domain type.
StreamWriteEntry
StreamWrites
Collection of events to write, organized by stream.

Enums§

CommandError
Error type for command execution failures.
DeliveryUpperBound
Optional inclusive upper bound for a delivery page.
EventStoreError
Error type returned by event store operations.
FailureStrategy
Strategy for handling event processing failures.
Operation
Identifies the event store operation that failed.
ProjectionSelectionError
Error returned when a projection selection is structurally invalid.
ProjectionStreamFilter
Stream selector applied to a projection source read.
StreamDeclarationsError

Traits§

CheckpointStore
Trait for persisting and retrieving projection checkpoints.
CommandLogic
Trait defining the business logic of a command.
CommandStreams
Infrastructure trait describing the streams required to execute a command.
Event
Event trait for domain-first event sourcing.
EventReader
Trait for reading events across streams for projections.
EventStore
Trait defining the contract for event store implementations.
ProjectionSource
Backend-independent source of lossless, globally ordered persisted events.
Projector
Trait for transforming events into read model updates.
ProjectorCoordinator
Trait for coordinating projector leadership across multiple instances.
StreamResolver
Trait for runtime stream discovery when static declarations are insufficient.

Functions§

collect_events
Collect every event from a stream into a Vec, in stream-version order.