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
impl InMemoryStore
Trait Implementations§
Source§impl Default for InMemoryStore
impl Default for InMemoryStore
Source§fn default() -> InMemoryStore
fn default() -> InMemoryStore
Returns the “default value” for a type. Read more
Source§impl RegistryStore for InMemoryStore
impl RegistryStore for InMemoryStore
Source§fn put(&self, body: Body) -> Result<(), AcdpError>
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>
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>
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>
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 moreSource§fn mark_superseded(&self, ctx_id: &CtxId) -> Result<(), AcdpError>
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>
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 moreSource§fn idempotency_lookup(
&self,
agent_id: &AgentDid,
key: &str,
) -> Result<Option<IdempotencyRecord>, AcdpError>
fn idempotency_lookup( &self, agent_id: &AgentDid, key: &str, ) -> Result<Option<IdempotencyRecord>, AcdpError>
Look up a prior publish record for
(agent_id, key). Read moreSource§fn idempotency_record(
&self,
agent_id: &AgentDid,
key: &str,
hash: &ContentHash,
response: &PublishResponse,
expires_at: DateTime<Utc>,
) -> Result<(), AcdpError>
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>
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>
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 moreAuto Trait Implementations§
impl !Freeze for InMemoryStore
impl RefUnwindSafe for InMemoryStore
impl Send for InMemoryStore
impl Sync for InMemoryStore
impl Unpin for InMemoryStore
impl UnsafeUnpin for InMemoryStore
impl UnwindSafe for InMemoryStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more