pub trait Executor:
Send
+ Sync
+ 'static {
// Required methods
fn write<'life0, 'async_trait>(
&'life0 self,
events: Vec<Event>,
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_subscriber_cursor<'life0, 'async_trait>(
&'life0 self,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_subscriber_running<'life0, 'async_trait>(
&'life0 self,
key: String,
worker_id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn upsert_subscriber<'life0, 'async_trait>(
&'life0 self,
key: String,
worker_id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn acknowledge<'life0, 'async_trait>(
&'life0 self,
key: String,
cursor: Value,
lag: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read<'life0, 'async_trait>(
&'life0 self,
aggregators: Option<Vec<EventFilter>>,
routing_key: Option<RoutingKey>,
args: Args,
) -> Pin<Box<dyn Future<Output = Result<ReadResult<Event>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn latest_timestamp<'life0, 'async_trait>(
&'life0 self,
aggregators: Option<Vec<EventFilter>>,
routing_key: Option<RoutingKey>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_snapshot<'life0, 'async_trait>(
&'life0 self,
aggregate_type: String,
aggregate_revision: String,
id: String,
) -> Pin<Box<dyn Future<Output = Result<Option<(Vec<u8>, Value)>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn save_snapshot<'life0, 'async_trait>(
&'life0 self,
aggregate_type: String,
aggregate_revision: String,
id: String,
data: Vec<u8>,
cursor: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_snapshot<'life0, 'async_trait>(
&'life0 self,
aggregate_type: String,
id: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn default_routing_key(&self) -> Option<&str> { ... }
}Expand description
Core trait for event storage backends.
Implementations handle persisting events, querying, and managing subscriptions.
The main implementation is evento_sql::Sql.
§Methods
write- Persist events atomicallyread- Query events with filtering and paginationlatest_timestamp- Get the timestamp of the most recent matching eventget_subscriber_cursor- Get subscription positionis_subscriber_running- Check if subscription is activeupsert_subscriber- Create/update subscriptionacknowledge- Update subscription cursor
Required Methods§
Sourcefn write<'life0, 'async_trait>(
&'life0 self,
events: Vec<Event>,
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write<'life0, 'async_trait>(
&'life0 self,
events: Vec<Event>,
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Persists events atomically.
Returns WriteError::InvalidOriginalVersion if version conflicts occur.
Sourcefn get_subscriber_cursor<'life0, 'async_trait>(
&'life0 self,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_subscriber_cursor<'life0, 'async_trait>(
&'life0 self,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets the current cursor position for a subscription.
Sourcefn is_subscriber_running<'life0, 'async_trait>(
&'life0 self,
key: String,
worker_id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_subscriber_running<'life0, 'async_trait>(
&'life0 self,
key: String,
worker_id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Checks if a subscription is running with the given worker ID.
Sourcefn upsert_subscriber<'life0, 'async_trait>(
&'life0 self,
key: String,
worker_id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn upsert_subscriber<'life0, 'async_trait>(
&'life0 self,
key: String,
worker_id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates or updates a subscription record.
Sourcefn acknowledge<'life0, 'async_trait>(
&'life0 self,
key: String,
cursor: Value,
lag: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn acknowledge<'life0, 'async_trait>(
&'life0 self,
key: String,
cursor: Value,
lag: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Updates subscription cursor after processing events.
Sourcefn read<'life0, 'async_trait>(
&'life0 self,
aggregators: Option<Vec<EventFilter>>,
routing_key: Option<RoutingKey>,
args: Args,
) -> Pin<Box<dyn Future<Output = Result<ReadResult<Event>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read<'life0, 'async_trait>(
&'life0 self,
aggregators: Option<Vec<EventFilter>>,
routing_key: Option<RoutingKey>,
args: Args,
) -> Pin<Box<dyn Future<Output = Result<ReadResult<Event>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Queries events with filtering and pagination.
Sourcefn latest_timestamp<'life0, 'async_trait>(
&'life0 self,
aggregators: Option<Vec<EventFilter>>,
routing_key: Option<RoutingKey>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn latest_timestamp<'life0, 'async_trait>(
&'life0 self,
aggregators: Option<Vec<EventFilter>>,
routing_key: Option<RoutingKey>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the timestamp of the most recent event matching the filter.
Returns 0 when no matching event exists. Used by the subscription loop to compute lag without fetching the full event row (data/metadata blobs).
Sourcefn get_snapshot<'life0, 'async_trait>(
&'life0 self,
aggregate_type: String,
aggregate_revision: String,
id: String,
) -> Pin<Box<dyn Future<Output = Result<Option<(Vec<u8>, Value)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_snapshot<'life0, 'async_trait>(
&'life0 self,
aggregate_type: String,
aggregate_revision: String,
id: String,
) -> Pin<Box<dyn Future<Output = Result<Option<(Vec<u8>, Value)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves a stored snapshot for an aggregate.
Returns the serialized snapshot data and cursor position, or None
if no snapshot exists for the given aggregate.
Sourcefn save_snapshot<'life0, 'async_trait>(
&'life0 self,
aggregate_type: String,
aggregate_revision: String,
id: String,
data: Vec<u8>,
cursor: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save_snapshot<'life0, 'async_trait>(
&'life0 self,
aggregate_type: String,
aggregate_revision: String,
id: String,
data: Vec<u8>,
cursor: Value,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stores a snapshot for an aggregate.
Snapshots cache aggregate state to avoid replaying all events.
The cursor indicates the event position up to which the snapshot is valid.
Sourcefn delete_snapshot<'life0, 'async_trait>(
&'life0 self,
aggregate_type: String,
id: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_snapshot<'life0, 'async_trait>(
&'life0 self,
aggregate_type: String,
id: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deletes a stored snapshot for an aggregate.
Idempotent: deleting a snapshot that does not exist is not an error.
Revision is intentionally omitted — save_snapshot upserts on
(type, id) so there is only ever one row per aggregate.
Provided Methods§
Sourcefn default_routing_key(&self) -> Option<&str>
fn default_routing_key(&self) -> Option<&str>
Default routing key applied to writes and inherited by subscriptions.
Most backends return None; Evento overrides this to expose its
configured default. Used by Evento::write to fill in missing routing
keys, and by SubscriptionBuilder::start /
ProjectionSubscription::start to inherit a default when the user
has not called .routing_key() or .all().
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".