pub struct OriginLedger { /* private fields */ }Expand description
The origin’s record of every asset it handed off: pinned until its own custody check passes, re-queued on a deadline or a revocation.
Serializable whole, so a client persists it beside its own state and reloads it.
Implementations§
Source§impl OriginLedger
impl OriginLedger
Sourcepub fn delegations(&self) -> impl Iterator<Item = &Delegation>
pub fn delegations(&self) -> impl Iterator<Item = &Delegation>
Every recorded delegation, by asset.
Sourcepub fn get(&self, asset_id: &Uuid) -> Option<&Delegation>
pub fn get(&self, asset_id: &Uuid) -> Option<&Delegation>
The delegation recorded for asset_id.
Sourcepub fn hand_off(
&mut self,
sealed: &SealedHandOff,
clock_epoch: &str,
now_ms: u64,
deadline_ms: u64,
)
pub fn hand_off( &mut self, sealed: &SealedHandOff, clock_epoch: &str, now_ms: u64, deadline_ms: u64, )
Record sealed as handed over now: pinned, with a deadline deadline_ms from now_ms
on the monotonic clock clock_epoch names.
Recording an asset that already has an open delegation replaces it: the origin delegated again, and only the newest hand-off is waited on (the older one, if its delegate still uploads it, is resolved by deduplication).
Sourcepub fn acknowledge(&mut self, ack: &HandOffAck) -> Result<(), DelegationError>
pub fn acknowledge(&mut self, ack: &HandOffAck) -> Result<(), DelegationError>
Take the delegate’s acknowledgement. It must name the recorded hand-off and delegate. Changes nothing about custody.
§Errors
DelegationError::UnknownDelegation or DelegationError::AckMismatch.
Sourcepub fn due(
&mut self,
trust: &PinnedTrust,
clock_epoch: &str,
now_ms: u64,
) -> Vec<(Uuid, RequeueReason)>
pub fn due( &mut self, trust: &PinnedTrust, clock_epoch: &str, now_ms: u64, ) -> Vec<(Uuid, RequeueReason)>
Re-queue every open delegation whose deadline passed on clock_epoch at now_ms, whose
deadline was set on another clock, or whose delegate trust no longer admits. Returns
the assets re-queued, for the caller to upload itself or delegate again.
Sourcepub fn release<V: StorageVerifier + ?Sized>(
&mut self,
asset_id: Uuid,
verifier: &V,
verify_asset_accepted: bool,
read_back: bool,
) -> Result<ReleaseOutcome, DelegationError>
pub fn release<V: StorageVerifier + ?Sized>( &mut self, asset_id: Uuid, verifier: &V, verify_asset_accepted: bool, read_back: bool, ) -> Result<ReleaseOutcome, DelegationError>
Release asset_id’s original only through the verify-before-destroy gate: verifier
answers for the origin’s own hashes and must be backed by facts the origin fetched
with its own session (ReleaseCoordinator::resolve_custody), never anything the
delegate relayed. verify_asset_accepted is the origin’s own verify_asset of the asset,
and read_back whether the origin’s copy still hashes to the signed original.
A released asset hands back its held deletes. Either upload’s custody releases it — the gate names content hashes, not who uploaded them — so a re-queued asset the origin uploaded itself releases through here too.
§Errors
Sourcepub fn hold_delete(
&mut self,
asset_id: Uuid,
delete: Vec<u8>,
) -> DeleteDisposition
pub fn hold_delete( &mut self, asset_id: Uuid, delete: Vec<u8>, ) -> DeleteDisposition
A signed delete of asset_id: held while its create has no confirmed custody (an open
or re-queued delegation), so the server never sees a delete for an asset it has not
indexed; otherwise returned to send now.
Sourcepub fn forget(&mut self, asset_id: &Uuid) -> Option<Delegation>
pub fn forget(&mut self, asset_id: &Uuid) -> Option<Delegation>
Forget a released or re-queued delegation the caller has finished with.
Trait Implementations§
Source§impl Clone for OriginLedger
impl Clone for OriginLedger
Source§fn clone(&self) -> OriginLedger
fn clone(&self) -> OriginLedger
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OriginLedger
impl Debug for OriginLedger
Source§impl Default for OriginLedger
impl Default for OriginLedger
Source§fn default() -> OriginLedger
fn default() -> OriginLedger
Source§impl<'de> Deserialize<'de> for OriginLedger
impl<'de> Deserialize<'de> for OriginLedger
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for OriginLedger
Source§impl PartialEq for OriginLedger
impl PartialEq for OriginLedger
Source§fn eq(&self, other: &OriginLedger) -> bool
fn eq(&self, other: &OriginLedger) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for OriginLedger
impl Serialize for OriginLedger
impl StructuralPartialEq for OriginLedger
Auto Trait Implementations§
impl Freeze for OriginLedger
impl RefUnwindSafe for OriginLedger
impl Send for OriginLedger
impl Sync for OriginLedger
impl Unpin for OriginLedger
impl UnsafeUnpin for OriginLedger
impl UnwindSafe for OriginLedger
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,
§impl<T> CompatExt for T
impl<T> CompatExt for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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