pub trait WatermarkStore: Send + Sync {
// Required methods
fn get(&self, subject_cid512: &str) -> Result<Option<AcceptedAt9pState>>;
fn conditional_advance(
&self,
expected: Option<Watermark>,
state: &AcceptedAt9pState,
) -> Result<ConditionalAdvance>;
}Expand description
Persistence seam for the complete accepted state and its per-DID duplicity watermark (#886/#1004).
Keyed by subject_cid512 (the genesis cid that names the identity). The
in-memory InMemoryWatermarkStore is provided for tests; the daemon/PDS
supplies the durable atomic implementation.
Implementations must be safe for concurrent use (Send + Sync) and MUST
serialize conditional_advance
across every guard sharing the store. A guard-local lock is only an
optimization: the durable store is the authority and the conditional write
is the security boundary.
Required Methods§
Sourcefn get(&self, subject_cid512: &str) -> Result<Option<AcceptedAt9pState>>
fn get(&self, subject_cid512: &str) -> Result<Option<AcceptedAt9pState>>
Load the complete accepted state. Implementations must re-verify that the retained head bytes derive the returned watermark fields.
Sourcefn conditional_advance(
&self,
expected: Option<Watermark>,
state: &AcceptedAt9pState,
) -> Result<ConditionalAdvance>
fn conditional_advance( &self, expected: Option<Watermark>, state: &AcceptedAt9pState, ) -> Result<ConditionalAdvance>
Advance from exactly expected to state as one atomic durable commit.
None means the identity must still be unseeded. There is deliberately
no unconditional public write API.