pub trait ExperienceStore: Send + Sync {
// Required methods
fn append_event(
&self,
event: ExperienceEventEnvelope,
) -> Result<(), ExperienceStoreError>;
fn query_events(
&self,
query: &EventQuery,
) -> Result<Vec<ExperienceEventEnvelope>, ExperienceStoreError>;
fn write_artifact_state_transition(
&self,
artifact_id: &ArtifactId,
artifact_kind: ArtifactKind,
event: LifecycleEvent,
) -> Result<(), ExperienceStoreError>;
fn get_trace_link(
&self,
trace_link_id: &TraceLinkId,
) -> Result<Option<ReplayTrace>, ExperienceStoreError>;
// Provided method
fn append_events(
&self,
events: &[ExperienceEventEnvelope],
) -> Result<(), ExperienceStoreError> { ... }
}Expand description
Experience store trait (append-only ledger boundary).
This is the canonical audit trail interface. Implementations provide append-only event storage and query access for governance, debugging, and downstream analytics.
See [converge_experience] for concrete implementations:
InMemoryExperienceStore, SurrealDbExperienceStore, LanceDbExperienceStore.
Required Methods§
Sourcefn append_event(
&self,
event: ExperienceEventEnvelope,
) -> Result<(), ExperienceStoreError>
fn append_event( &self, event: ExperienceEventEnvelope, ) -> Result<(), ExperienceStoreError>
Append a single event.
Sourcefn query_events(
&self,
query: &EventQuery,
) -> Result<Vec<ExperienceEventEnvelope>, ExperienceStoreError>
fn query_events( &self, query: &EventQuery, ) -> Result<Vec<ExperienceEventEnvelope>, ExperienceStoreError>
Query events by tenant/time/kind/etc.
Sourcefn write_artifact_state_transition(
&self,
artifact_id: &ArtifactId,
artifact_kind: ArtifactKind,
event: LifecycleEvent,
) -> Result<(), ExperienceStoreError>
fn write_artifact_state_transition( &self, artifact_id: &ArtifactId, artifact_kind: ArtifactKind, event: LifecycleEvent, ) -> Result<(), ExperienceStoreError>
Write an artifact lifecycle transition event.
Sourcefn get_trace_link(
&self,
trace_link_id: &TraceLinkId,
) -> Result<Option<ReplayTrace>, ExperienceStoreError>
fn get_trace_link( &self, trace_link_id: &TraceLinkId, ) -> Result<Option<ReplayTrace>, ExperienceStoreError>
Fetch a trace link by id.
Provided Methods§
Sourcefn append_events(
&self,
events: &[ExperienceEventEnvelope],
) -> Result<(), ExperienceStoreError>
fn append_events( &self, events: &[ExperienceEventEnvelope], ) -> Result<(), ExperienceStoreError>
Append multiple events (best-effort atomicity per implementation).