pub trait MemoryWriterPort: Send + Sync {
// Required methods
fn remember<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 MemoryScope,
write: MemoryWrite,
idempotency_key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<MemoryWriteOutcome, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn capabilities(&self) -> MemoryCapabilities;
}Expand description
Writing what a working session decided into memory that outlives it.
The engine already keeps an audit journal, and this is not that. A journal proves what happened in one session; memory is what a later session can navigate. One is evidence, the other is experience.
A write carries entries and the reasons between them, because the reasons are not decoration on the entries — they are the part a later session follows. What was decided can be listed; how one thing led to another can only be walked.
Required Methods§
Sourcefn remember<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 MemoryScope,
write: MemoryWrite,
idempotency_key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<MemoryWriteOutcome, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remember<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 MemoryScope,
write: MemoryWrite,
idempotency_key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<MemoryWriteOutcome, DomainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Record a write about scope.
idempotency_key names the write, not the moment: the same key
twice is the same write twice, whatever the clock says.
A backend that does not keep reasons still accepts a write that carries them, and keeps what it can. Refusing would make a caller choose between explaining itself and being stored, and the honest place to learn what survives is the capabilities.
Sourcefn capabilities(&self) -> MemoryCapabilities
fn capabilities(&self) -> MemoryCapabilities
What this backend can do. A caller may ask before it acts, and the conformance suite checks the answer against behaviour: a backend that claims to remember and then does not is worse than one that claims nothing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".