pub struct LocalHeadLease<'a> { /* private fields */ }Expand description
Holds an exclusive advisory lock. Root protection and lock-file identity must be enforced by the host for the entire lifetime of the lease.
Implementations§
Source§impl<'a> LocalHeadLease<'a>
impl<'a> LocalHeadLease<'a>
Sourcepub fn matches_scope(&self, root: &Path, chain: &[u8; 32]) -> bool
pub fn matches_scope(&self, root: &Path, chain: &[u8; 32]) -> bool
Exact lexical scope of this lease; the host protects root identity for the whole lease and must not assume this checks filesystem aliases.
Sourcepub fn acquire(
root: &Path,
chain: [u8; 32],
signer: &'a SigningKey,
byte_budget: usize,
policy: &mut impl LocalHeadPolicy,
) -> Result<Self, LocalHeadError>
pub fn acquire( root: &Path, chain: [u8; 32], signer: &'a SigningKey, byte_budget: usize, policy: &mut impl LocalHeadPolicy, ) -> Result<Self, LocalHeadError>
byte_budget bounds the single temporary head record, not aggregate
directory usage or runtime/OS allocation. No implicit directories are
created; the caller supplies an already protected root.
pub fn current( &self, policy: &mut impl LocalHeadPolicy, ) -> Result<ChainHead, LocalHeadError>
Sourcepub fn compare_and_commit(
&mut self,
expected: ChainHead,
receipt: &SidecarReceipt,
sidecar: &[u8; 768],
payload: &[u8],
payload_budget: usize,
policy: &mut impl LocalHeadPolicy,
) -> Result<HeadCommit, LocalHeadError>
pub fn compare_and_commit( &mut self, expected: ChainHead, receipt: &SidecarReceipt, sidecar: &[u8; 768], payload: &[u8], payload_budget: usize, policy: &mut impl LocalHeadPolicy, ) -> Result<HeadCommit, LocalHeadError>
Compare, sign and atomically replace a local head while holding the
lease. A post-replacement failure yields Indeterminate, never success.
The caller must have published the corresponding bundle and must use
external rollback/freshness checks during recovery.
Auto Trait Implementations§
impl<'a> Freeze for LocalHeadLease<'a>
impl<'a> RefUnwindSafe for LocalHeadLease<'a>
impl<'a> Send for LocalHeadLease<'a>
impl<'a> Sync for LocalHeadLease<'a>
impl<'a> Unpin for LocalHeadLease<'a>
impl<'a> UnsafeUnpin for LocalHeadLease<'a>
impl<'a> UnwindSafe for LocalHeadLease<'a>
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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