Skip to main content

InMemoryStore

Struct InMemoryStore 

Source
pub struct InMemoryStore { /* private fields */ }
Expand description

Minimal in-memory backend. Not durable; intended for tests and prototyping. Concurrency-safe (a single Mutex over the table).

Implementations§

Source§

impl InMemoryStore

Source

pub fn new() -> Self

Construct an empty store.

Trait Implementations§

Source§

impl Default for InMemoryStore

Source§

fn default() -> InMemoryStore

Returns the “default value” for a type. Read more
Source§

impl RegistryStore for InMemoryStore

Source§

fn put(&self, body: Body) -> Result<(), AcdpError>

Persist a freshly-assigned context. body.ctx_id and body.lineage_id are already populated by the server.
Source§

fn get(&self, ctx_id: &CtxId) -> Result<Option<FullContext>, AcdpError>

Retrieve a stored context by ctx_id.
Source§

fn lineage(&self, lineage_id: &LineageId) -> Result<Vec<FullContext>, AcdpError>

All contexts in a lineage, oldest first.
Source§

fn current( &self, lineage_id: &LineageId, ) -> Result<Option<FullContext>, AcdpError>

Returns the newest non-Status::Superseded version of a lineage — either Status::Active or Status::Expired (an expired-but-unreplaced body is still the latest version, and callers need to see it to know it has lapsed). Read more
Source§

fn mark_superseded(&self, ctx_id: &CtxId) -> Result<(), AcdpError>

Mark ctx_id’s registry state as superseded. Idempotent.
Source§

fn first_version_ctx_id( &self, lineage_id: &LineageId, ) -> Result<Option<CtxId>, AcdpError>

First-version ctx_id for a lineage, used to derive the lineage_id of a supersession publish per RFC-ACDP-0001 §5.6. Read more
Source§

fn idempotency_lookup( &self, agent_id: &AgentDid, key: &str, ) -> Result<Option<IdempotencyRecord>, AcdpError>

Look up a prior publish record for (agent_id, key). Read more
Source§

fn idempotency_record( &self, agent_id: &AgentDid, key: &str, hash: &ContentHash, response: &PublishResponse, expires_at: DateTime<Utc>, ) -> Result<(), AcdpError>

Record a successful publish under (agent_id, key) with TTL expires_at. Calling on a store that does not support idempotency is a no-op.
Source§

fn idempotency_evict_expired(&self, now: DateTime<Utc>) -> Result<(), AcdpError>

Evict records whose expires_at is past now. Implementations may call this on a janitor schedule or lazily at lookup time.
Source§

fn commit_publish( &self, commit: PublishCommit<'_>, ) -> Result<PublishCommitOutcome, AcdpError>

Atomically commit a publish: idempotency lookup, supersession validation, body insertion, predecessor supersession marking, and idempotency record write — all under a single critical section so two concurrent publishes targeting the same supersedes (or sharing an idempotency_key) cannot both succeed. Read more
Source§

fn search( &self, params: &SearchParams, requester: Option<&AgentDid>, anonymous_public_reads: bool, ) -> Result<SearchResponse, AcdpError>

Keyword/filter search. Implementations MUST apply the RFC-ACDP-0008 §4.5 search-disclosure rules using requester: Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.