pub enum StateItem {
PendingVerification {
channel_id: ChannelId,
request: VerifyShareRequestMessage,
},
PendingRecovery {
version: u32,
shares: Vec<GetShareResponseMessage>,
},
PendingUnpair {
channel_id: ChannelId,
started_at: u64,
},
SharingRound {
version: u32,
pending: HashSet<ChannelId>,
confirmed: HashSet<ChannelId>,
failed: HashSet<ChannelId>,
started_at: u64,
},
}Expand description
The payload of one row in the crate::protocol::DeRecStateStore.
§Write pattern
The library treats crate::protocol::DeRecStateStore::save as
full-replacement upsert — there is no per-item merge or append
semantic at the store level. Accumulator-style state
(StateItem::PendingRecovery and StateItem::SharingRound) grows
via load-modify-save cycles from the library. Backends do not need to
implement any append primitive; a naive replace-on-save is correct.
Variants§
PendingVerification
The full outstanding derec_proto::VerifyShareRequestMessage the
orchestrator sent for this channel. Retained so the corresponding
inbound derec_proto::VerifyShareResponseMessage can be validated
against the exact (nonce, secret_id, version) triple that was
minted at request time.
Overwritten in place by a subsequent save for the same
(secret_id, channel_id); the most recent challenge wins.
PendingRecovery
Accumulator for one in-progress recovery target.
The library writes this variant one share at a time as each inbound
derec_proto::GetShareResponseMessage arrives. The write sequence
under a single (secret_id, version) is:
- First response arrives. Library calls
savewith asharesvector containing exactly one element. - Second response arrives. Library
loads the accumulator, appends the new share to the returned Vec, andsaves the grown Vec back. - …repeat until threshold. On threshold met, library
removes the accumulator.
Implementations MUST accept shares vectors of any length,
including one. Every save replaces the stored value in place
with the caller-supplied Vec; no append primitive is required.
§Concurrency
See crate::protocol::DeRecStateStore for the multi-instance
concurrency contract. Concurrent inbound shares racing on the same
accumulator will clobber each other via a naive load-modify-save;
the application layer is responsible for serializing concurrent
process() calls that touch the same (secret_id, version) if
this matters.
PendingUnpair
Outstanding unpair acknowledgement window. started_at is the
unix-seconds timestamp stamped when the request was sent; the
orchestrator sweeps expired entries via
crate::protocol::DeRecStateStore::load_all.
SharingRound
Active sharing round for secret_id. Created by
start(ProtectSecret) and cleared by the orchestrator once every
targeted helper has responded (confirmed, rejected, or timed
out). At most one entry exists per secret_id; a fresh
start(ProtectSecret) overwrites any prior in-flight round.
pending / confirmed / failed partition the round’s target
channels; the union is invariant across the round’s lifetime.
started_at is the unix-seconds timestamp used to time out
unresponsive helpers.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StateItem
impl RefUnwindSafe for StateItem
impl Send for StateItem
impl Sync for StateItem
impl Unpin for StateItem
impl UnsafeUnpin for StateItem
impl UnwindSafe for StateItem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more