pub trait MemoryStore:
Clone
+ Send
+ Sync
+ 'static {
// Required methods
fn scan(
&self,
query: &str,
limit: usize,
) -> impl Future<Output = Result<MemoryScan, MemoryError>> + Send;
fn read(
&self,
ids: &[i64],
keys: &[MemoryKey],
) -> impl Future<Output = Result<Vec<MemoryRecord>, MemoryError>> + Send;
fn list(
&self,
) -> impl Future<Output = Result<Vec<MemoryRecord>, MemoryError>> + Send;
fn put(
&self,
content: &str,
replacement: Option<MemoryKey>,
) -> impl Future<Output = Result<MemoryRecord, MemoryError>> + Send;
fn delete(
&self,
key: MemoryKey,
) -> impl Future<Output = Result<(), MemoryError>> + Send;
fn sync(
&self,
memories: &[MemoryRecord],
) -> impl Future<Output = Result<SyncReport, MemoryError>> + Send;
fn export_page(
&self,
namespaces: Option<&[String]>,
cursor: Option<&ExportCursor>,
limit: usize,
) -> impl Future<Output = Result<(Vec<MemoryRecord>, Option<ExportCursor>), MemoryError>> + Send;
// Provided method
fn export_all(
&self,
namespaces: Option<&[String]>,
) -> impl Future<Output = Result<Vec<MemoryRecord>, MemoryError>> + Send { ... }
}Expand description
Ordinary operations shared by local and authenticated remote memory backends.
Implementations own their namespace and storage boundary. Returned records are ordered deterministically by the implementation, direct mutations use key versions as compare-and-swap preconditions, and each implementation captures its authoritative operation time internally. Dropping a returned future requests cancellation. Implementations may finish an already-started atomic storage transaction after cancellation.
Required Methods§
Sourcefn scan(
&self,
query: &str,
limit: usize,
) -> impl Future<Output = Result<MemoryScan, MemoryError>> + Send
fn scan( &self, query: &str, limit: usize, ) -> impl Future<Output = Result<MemoryScan, MemoryError>> + Send
Searches visible records and records scan telemetry.
Sourcefn read(
&self,
ids: &[i64],
keys: &[MemoryKey],
) -> impl Future<Output = Result<Vec<MemoryRecord>, MemoryError>> + Send
fn read( &self, ids: &[i64], keys: &[MemoryKey], ) -> impl Future<Output = Result<Vec<MemoryRecord>, MemoryError>> + Send
Reads unversioned IDs and versioned keys, recording use telemetry.
Sourcefn list(
&self,
) -> impl Future<Output = Result<Vec<MemoryRecord>, MemoryError>> + Send
fn list( &self, ) -> impl Future<Output = Result<Vec<MemoryRecord>, MemoryError>> + Send
Lists a deterministic window that excludes expired probationary records.
Implementations return at most MemoryLimits::records records so interactive inspection
does not grow with the complete shared corpus. Full transfer uses paginated export instead.
Sourcefn put(
&self,
content: &str,
replacement: Option<MemoryKey>,
) -> impl Future<Output = Result<MemoryRecord, MemoryError>> + Send
fn put( &self, content: &str, replacement: Option<MemoryKey>, ) -> impl Future<Output = Result<MemoryRecord, MemoryError>> + Send
Inserts content or compare-and-swap replaces replacement.
Sourcefn delete(
&self,
key: MemoryKey,
) -> impl Future<Output = Result<(), MemoryError>> + Send
fn delete( &self, key: MemoryKey, ) -> impl Future<Output = Result<(), MemoryError>> + Send
Compare-and-swap deletes key.
Deleting an already-absent key succeeds, making safe request replay idempotent. An existing
record with a different version returns MemoryError::Conflict.
Sourcefn sync(
&self,
memories: &[MemoryRecord],
) -> impl Future<Output = Result<SyncReport, MemoryError>> + Send
fn sync( &self, memories: &[MemoryRecord], ) -> impl Future<Output = Result<SyncReport, MemoryError>> + Send
Atomically applies an authoritative full snapshot to the owned namespace.
Records absent from memories are deleted. Input is validated before commit, IDs remain
stable, and future insertions must not reuse IDs observed in the snapshot.
Sourcefn export_page(
&self,
namespaces: Option<&[String]>,
cursor: Option<&ExportCursor>,
limit: usize,
) -> impl Future<Output = Result<(Vec<MemoryRecord>, Option<ExportCursor>), MemoryError>> + Send
fn export_page( &self, namespaces: Option<&[String]>, cursor: Option<&ExportCursor>, limit: usize, ) -> impl Future<Output = Result<(Vec<MemoryRecord>, Option<ExportCursor>), MemoryError>> + Send
Exports one page in stable (namespace, id) order after cursor.
The page is a point-in-time transaction snapshot. limit is clamped to the protocol bound;
callers continue only with the exact returned cursor. Cancellation before storage work starts
prevents the operation; an already-started transaction may finish.
Provided Methods§
Sourcefn export_all(
&self,
namespaces: Option<&[String]>,
) -> impl Future<Output = Result<Vec<MemoryRecord>, MemoryError>> + Send
fn export_all( &self, namespaces: Option<&[String]>, ) -> impl Future<Output = Result<Vec<MemoryRecord>, MemoryError>> + Send
Collects a complete bounded export through the paginated storage contract.
The collector rejects non-progressing cursors and stops before retaining more records or content than a local store can import.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl MemoryStore for LocalMemoryStore
impl MemoryStore for RemoteMemoryClient
impl MemoryStore for SelectedMemoryStore
client and local only.