Skip to main content

Module persistence

Module persistence 

Source
Expand description

Persistence Layer - Storage Abstractions

This module defines the core storage traits for the Enact execution engine. The kernel interacts only with these traits; concrete implementations live in the enact-persistence crate.

§Store Roles

StoreRoleMutable?Authoritative?
EventStoreSource of truthAppend-onlyYes
StateStoreCache/snapshotYesNo
VectorStoreSemantic recallYesNo

§Key Invariants

  1. Kernel NEVER imports concrete implementations
  2. All stores implement StorageBackend for mode validation
  3. EventStore is append-only and authoritative
  4. StateStore/VectorStore are non-authoritative caches

@see docs/TECHNICAL/14-PERSISTENCE-LAYER.md

Modules§

guarantees
Store guarantees - documented contracts for each store type

Structs§

CollectionInfo
Information about a collection
CostInfo
Cost information for billing
ExecutionSnapshot
Execution state snapshot
ExecutionStats
Execution statistics for a message
InMemoryMessageStore
In-memory implementation of MessageStore
Message
A message in a thread (AI SDK compatible)
MessageMetadata
Message metadata (AI SDK compatible)
StoredEvent
A stored event with metadata
Thread
A conversation thread containing messages
TokenUsage
Token usage for billing and analytics
VectorDocument
A document with embedding for vector storage
VectorFilter
Filter for vector search
VectorSearchResult
Search result with similarity score

Enums§

DistanceMetric
Distance metric for similarity calculation
ExecutionEventData
Event data that can be stored
FinishReason
Why the response finished
MessagePart
Message part for rich content (AI SDK compatible)
MessageRole
Message role (AI SDK compatible)

Traits§

EventStore
EventStore trait - append-only event log
MessageStore
MessageStore trait - thread/message persistence
StateStore
StateStore trait - mutable snapshot cache
StateStoreJsonExt
Extension trait for JSON operations on StateStore
StorageBackend
Base trait for all storage backends
VectorStore
VectorStore trait - semantic memory