Skip to main content

MemoryBackend

Trait MemoryBackend 

Source
pub trait MemoryBackend: Send + Sync {
Show 17 methods // Required methods fn namespace(&self) -> String; fn scope_tags(&self) -> Map<String, Value>; fn recall(&self, request: &Value, signal: &Signal) -> Result<Value, String>; fn retain(&self, request: &Value, signal: &Signal) -> Result<Value, String>; fn get(&self, document_id: &str, signal: &Signal) -> Result<Value, String>; fn delete( &self, document_id: &str, signal: &Signal, ) -> Result<Value, String>; fn operation( &self, operation_id: &str, signal: &Signal, ) -> Result<Value, String>; // Provided methods fn supports(&self, call: &str) -> bool { ... } fn unit(&self, _unit_id: &str, _signal: &Signal) -> Result<Value, String> { ... } fn curate( &self, _unit_id: &str, _request: &Value, _signal: &Signal, ) -> Result<Value, String> { ... } fn reflect( &self, _request: &Value, _signal: &Signal, ) -> Result<Value, String> { ... } fn mental_model(&self, _id: &str, _signal: &Signal) -> Result<Value, String> { ... } fn create_mental_model( &self, _request: &Value, _signal: &Signal, ) -> Result<Value, String> { ... } fn list(&self, _request: &Value, _signal: &Signal) -> Result<Value, String> { ... } fn confirm( &self, _id: &str, _request: &Value, _signal: &Signal, ) -> Result<Value, String> { ... } fn supersede( &self, _id: &str, _request: &Value, _signal: &Signal, ) -> Result<Value, String> { ... } fn conflict( &self, _request: &Value, _signal: &Signal, ) -> Result<Value, String> { ... }
}
Expand description

A Hindsight-shaped document backend. An Err whose text is a memory error code (for example “HTTP_ERROR”) reports that code; any other text is an OPERATION_ERROR.

Required Methods§

Source

fn namespace(&self) -> String

Source

fn scope_tags(&self) -> Map<String, Value>

Scope → identity tags, such as {"session": ["ultron:session:<id>"]}.

Source

fn recall(&self, request: &Value, signal: &Signal) -> Result<Value, String>

Source

fn retain(&self, request: &Value, signal: &Signal) -> Result<Value, String>

Source

fn get(&self, document_id: &str, signal: &Signal) -> Result<Value, String>

Source

fn delete(&self, document_id: &str, signal: &Signal) -> Result<Value, String>

Source

fn operation( &self, operation_id: &str, signal: &Signal, ) -> Result<Value, String>

Provided Methods§

Source

fn supports(&self, call: &str) -> bool

Whether the backend has call: the document calls (“recall”, “retain”, “get”, “delete”, “operation”) by default; “fileEvidence” (a retain item’s evidence: file snapshots it cites) and “claims” (the curation calls below) only where a backend says so.

Source

fn unit(&self, _unit_id: &str, _signal: &Signal) -> Result<Value, String>

One memory unit (a fact or an observation) by id.

Source

fn curate( &self, _unit_id: &str, _request: &Value, _signal: &Signal, ) -> Result<Value, String>

Curates a memory unit ({"state": "invalidated", "reason"?} retires it).

Source

fn reflect(&self, _request: &Value, _signal: &Signal) -> Result<Value, String>

An answer reasoned over the bank’s memories.

Source

fn mental_model(&self, _id: &str, _signal: &Signal) -> Result<Value, String>

A mental model by id, or Value::Null when the bank has none.

Source

fn create_mental_model( &self, _request: &Value, _signal: &Signal, ) -> Result<Value, String>

Source

fn list(&self, _request: &Value, _signal: &Signal) -> Result<Value, String>

The claims of exactly tags ({tags, status?, confirmedBefore?, sort?: "confirmed", limit?}): {claims: [claim]}, least recently confirmed first with sort: "confirmed".

Source

fn confirm( &self, _id: &str, _request: &Value, _signal: &Signal, ) -> Result<Value, String>

Marks claim id re-verified now, with optional file evidence ({evidence?: {source, content, quote}}).

Source

fn supersede( &self, _id: &str, _request: &Value, _signal: &Signal, ) -> Result<Value, String>

Replaces claim id with {text, metadata, evidence?} (tags and key carried over): the new claim.

Source

fn conflict(&self, _request: &Value, _signal: &Signal) -> Result<Value, String>

Flags two claims as conflicting ({id, conflictingId, reason}), for a person or a later dream to settle.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§