pub struct CheckoutGrantStore { /* private fields */ }Expand description
Persisted binding and grant state of one node.
Implementations§
Source§impl CheckoutGrantStore
impl CheckoutGrantStore
Sourcepub fn floor_preview(&self) -> Result<FloorPreview, LicenceError>
pub fn floor_preview(&self) -> Result<FloorPreview, LicenceError>
Preview Self::reset_floor without changing anything. Needs a
binding in effect, like the reset.
Sourcepub fn reset_floor_checked(
&self,
expected_floor: Option<u64>,
) -> Result<FloorPreview, LicenceError>
pub fn reset_floor_checked( &self, expected_floor: Option<u64>, ) -> Result<FloorPreview, LicenceError>
Reset the floor and return the preview it was applied on, in one
critical section. With expected_floor, refuses (floor_changed)
when the floor is no longer the value the operator was shown.
Source§impl CheckoutGrantStore
impl CheckoutGrantStore
Sourcepub fn open(
dir: &Path,
anchors: Arc<TrustAnchors>,
local: LocalMeshId,
clock: Clock,
) -> Result<Self, LicenceError>
pub fn open( dir: &Path, anchors: Arc<TrustAnchors>, local: LocalMeshId, clock: Clock, ) -> Result<Self, LicenceError>
Open the store in dir. A missing file is an empty store; a file that
cannot be read, parsed or re-verified is an error (nothing is written).
Sourcepub fn open_or_poisoned(
dir: &Path,
anchors: Arc<TrustAnchors>,
local: LocalMeshId,
clock: Clock,
) -> Self
pub fn open_or_poisoned( dir: &Path, anchors: Arc<TrustAnchors>, local: LocalMeshId, clock: Clock, ) -> Self
Self::open, but a bad file gives a poisoned store (it serves
nothing, refuses writes and leaves the file alone) so the daemon can
still install its policy, which then behaves like ManifestPolicy.
Sourcepub fn set_sink(&self, sink: Arc<dyn LicenceEventSink>)
pub fn set_sink(&self, sink: Arc<dyn LicenceEventSink>)
Report LicenceEvents to sink.
Sourcepub fn attach_revocations(&self, list: Arc<RevocationList>)
pub fn attach_revocations(&self, list: Arc<RevocationList>)
Use list for SignerKey and ArtifactHash revocations.
Sourcepub fn local_mesh_id(&self) -> &LocalMeshId
pub fn local_mesh_id(&self) -> &LocalMeshId
The live local mesh id handle.
Sourcepub fn is_hash_revoked(&self, blake3_hex: &str) -> bool
pub fn is_hash_revoked(&self, blake3_hex: &str) -> bool
True when blake3_hex is revoked as an ArtifactHash.
Sourcepub fn active_binding(&self) -> Option<BindingRecord>
pub fn active_binding(&self) -> Option<BindingRecord>
The binding in effect, if any.
Sourcepub fn binding_status(&self) -> Result<BindingRecord, LicenceError>
pub fn binding_status(&self) -> Result<BindingRecord, LicenceError>
The binding in effect, or the reason there is none.
Sourcepub fn held_binding(&self) -> Option<BindingRecord>
pub fn held_binding(&self) -> Option<BindingRecord>
The stored binding whatever its state (bound, unbound or orphaned), for
the steward’s seq rule and for status. Not for gating anything.
Sourcepub fn verify_member(
&self,
signed: &SignedBinding,
) -> Result<BindingRecord, LicenceError>
pub fn verify_member( &self, signed: &SignedBinding, ) -> Result<BindingRecord, LicenceError>
The MEMBER profile against this store’s anchors and local mesh id, without storing anything (the steward verifies before it spends any replay state).
Sourcepub fn valid_grant_covering(
&self,
blake3_hex: &str,
cog_id: &str,
version: &str,
) -> Option<CheckoutGrant>
pub fn valid_grant_covering( &self, blake3_hex: &str, cog_id: &str, version: &str, ) -> Option<CheckoutGrant>
A valid grant that lists BLAKE3 blake3_hex for cog_id version.
Sourcepub fn valid_grant_for_artifact(
&self,
cog_id: &str,
version: &str,
sha256: &str,
blake3: &str,
) -> Option<(CheckoutGrant, GrantArtifact)>
pub fn valid_grant_for_artifact( &self, cog_id: &str, version: &str, sha256: &str, blake3: &str, ) -> Option<(CheckoutGrant, GrantArtifact)>
A valid grant for cog_id version that lists a binary whose
(sha256, blake3) pair is exactly sha256 and blake3.
Sourcepub fn verified_grants(&self) -> Vec<VerifiedCheckoutGrant>
pub fn verified_grants(&self) -> Vec<VerifiedCheckoutGrant>
Every currently valid grant, ready for grant_checkout.
Sourcepub fn reset_floor(&self) -> Result<(), LicenceError>
pub fn reset_floor(&self) -> Result<(), LicenceError>
Admin hook (weaver cog checkout reset-floor): forget the clock
high-water mark and restart it from the current clock. This is the
only way to undo a forward clock jump. The caller gates it (Admin).
Source§impl CheckoutGrantStore
impl CheckoutGrantStore
Sourcepub fn accept_binding(
&self,
signed: &SignedBinding,
posture: AdmissionPosture,
extra: &dyn BindingExtraCheck,
) -> Result<Outcome, LicenceError>
pub fn accept_binding( &self, signed: &SignedBinding, posture: AdmissionPosture, extra: &dyn BindingExtraCheck, ) -> Result<Outcome, LicenceError>
Accept a binding. posture is the node’s admission state; extra is
the steward profile hook (use super::NoExtraChecks for members).
Sourcepub fn accept_grant(
&self,
signed: &SignedGrant,
) -> Result<Outcome, LicenceError>
pub fn accept_grant( &self, signed: &SignedGrant, ) -> Result<Outcome, LicenceError>
Accept a grant under the bound key (see ADR-106 section 4).
Source§impl CheckoutGrantStore
impl CheckoutGrantStore
Sourcepub fn grant_rows(&self) -> Vec<GrantRow>
pub fn grant_rows(&self) -> Vec<GrantRow>
Every held grant, valid or not, by (cog, version). Validity is judged as the policy judges it; without a binding in effect none is valid.
Sourcepub fn effective_now(&self) -> Option<u64>
pub fn effective_now(&self) -> Option<u64>
max(now, floor) for the bound key, the time grants are judged by.
Source§impl CheckoutGrantStore
impl CheckoutGrantStore
Sourcepub fn was_ever_bound(&self) -> bool
pub fn was_ever_bound(&self) -> bool
True once this node has accepted a binding (the marker exists, or a binding is held now, which also writes the marker).
Sourcepub fn claims_artifact(&self, sha256: &str, blake3: &str) -> bool
pub fn claims_artifact(&self, sha256: &str, blake3: &str) -> bool
True when a held grant (current or previous) lists a binary with this sha256 or this BLAKE3: the bytes are a checked-out Cognitum cog, whatever package they arrive in.
Source§impl CheckoutGrantStore
impl CheckoutGrantStore
Sourcepub fn held_signed_binding(&self) -> Option<(u64, SignedBinding)>
pub fn held_signed_binding(&self) -> Option<(u64, SignedBinding)>
The stored binding for the local mesh, whatever its state, with its
seq. An unbound record is still returned: its seq is what stops an
older bind from being replayed.
Sourcepub fn bound_grant_key(&self) -> Option<String>
pub fn bound_grant_key(&self) -> Option<String>
The grant key of the binding in effect, lower-case hex.
Sourcepub fn held_grant(
&self,
cog_id: &str,
version: &str,
) -> Option<(u64, SignedGrant)>
pub fn held_grant( &self, cog_id: &str, version: &str, ) -> Option<(u64, SignedGrant)>
The current grant held for cog_id version, with its seq.
Sourcepub fn sync_grants_page(
&self,
after: Option<(u64, &str, &str)>,
max_entries: usize,
max_bytes: usize,
) -> (Vec<(u64, String, String, SignedGrant)>, bool)
pub fn sync_grants_page( &self, after: Option<(u64, &str, &str)>, max_entries: usize, max_bytes: usize, ) -> (Vec<(u64, String, String, SignedGrant)>, bool)
A page of the highest-seq grant per (cog, version), as (seq, cog, version, grant) ordered by that tuple and strictly after after,
within max_entries and max_bytes; and whether more follow. Empty
unless a binding is in effect. Expired and withdrawn grants are
included: they are seq tombstones. Only the keys of the whole set
are sorted; only the page’s envelopes are cloned.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CheckoutGrantStore
impl !RefUnwindSafe for CheckoutGrantStore
impl !UnwindSafe for CheckoutGrantStore
impl Send for CheckoutGrantStore
impl Sync for CheckoutGrantStore
impl Unpin for CheckoutGrantStore
impl UnsafeUnpin for CheckoutGrantStore
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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