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§
fn namespace(&self) -> String
Scope → identity tags, such as {"session": ["ultron:session:<id>"]}.
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§
Sourcefn supports(&self, call: &str) -> bool
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.
Sourcefn unit(&self, _unit_id: &str, _signal: &Signal) -> Result<Value, String>
fn unit(&self, _unit_id: &str, _signal: &Signal) -> Result<Value, String>
One memory unit (a fact or an observation) by id.
Sourcefn curate(
&self,
_unit_id: &str,
_request: &Value,
_signal: &Signal,
) -> Result<Value, String>
fn curate( &self, _unit_id: &str, _request: &Value, _signal: &Signal, ) -> Result<Value, String>
Curates a memory unit ({"state": "invalidated", "reason"?} retires it).
Sourcefn reflect(&self, _request: &Value, _signal: &Signal) -> Result<Value, String>
fn reflect(&self, _request: &Value, _signal: &Signal) -> Result<Value, String>
An answer reasoned over the bank’s memories.
Sourcefn mental_model(&self, _id: &str, _signal: &Signal) -> Result<Value, String>
fn mental_model(&self, _id: &str, _signal: &Signal) -> Result<Value, String>
A mental model by id, or Value::Null when the bank has none.
fn create_mental_model( &self, _request: &Value, _signal: &Signal, ) -> Result<Value, String>
Sourcefn list(&self, _request: &Value, _signal: &Signal) -> Result<Value, String>
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".
Sourcefn confirm(
&self,
_id: &str,
_request: &Value,
_signal: &Signal,
) -> Result<Value, String>
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}}).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".