pub struct SeedBinder { /* private fields */ }Expand description
Verifies and remembers bindings.
Implementations§
Source§impl SeedBinder
impl SeedBinder
Sourcepub async fn bind_v2(
&self,
b: &StewardBind<'_>,
) -> Result<BindingRecord, BindError>
pub async fn bind_v2( &self, b: &StewardBind<'_>, ) -> Result<BindingRecord, BindError>
Steward-profile bind of a v2 record. See the module docs.
Sourcepub fn unbind_v2(
&self,
signed: &SignedBinding,
store: &CheckoutGrantStore,
) -> Result<UnbindOutcome, BindError>
pub fn unbind_v2( &self, signed: &SignedBinding, store: &CheckoutGrantStore, ) -> Result<UnbindOutcome, BindError>
Withdraw the binding with an operator-signed unbound record. Needs
no Seed (it may be gone). Any operator-Admin node may do it. If the
store could not save it, the unbind is still applied in memory (it only
restricts), the event is chained, and the outcome says the save is
pending (the store’s tick retries it).
Source§impl SeedBinder
impl SeedBinder
Sourcepub fn new(operators: Vec<[u8; 32]>, chain: Arc<ChainManager>) -> Self
pub fn new(operators: Vec<[u8; 32]>, chain: Arc<ChainManager>) -> Self
A binder trusting operators (pinned operator public keys).
Sourcepub fn with_state_file(
self,
path: impl Into<PathBuf>,
) -> Result<Self, BindError>
pub fn with_state_file( self, path: impl Into<PathBuf>, ) -> Result<Self, BindError>
Persist each device’s latest bound_at to path (mode 0600,
atomic) and restore it now, so a replayed or older record is still
refused after a restart. A missing file starts empty; a malformed,
oversized or non-regular one is refused (nothing is overwritten).
Sourcepub fn with_max_age_secs(self, secs: u64) -> Self
pub fn with_max_age_secs(self, secs: u64) -> Self
Accept records for at most secs after bound_at.
Sourcepub fn device_of(&self, node_id: &str) -> Option<String>
pub fn device_of(&self, node_id: &str) -> Option<String>
The device id bound to node_id, if any.
Sourcepub async fn bind(
&self,
signed: &SignedBind,
rt: &SeedApiRuntime,
now: u64,
) -> Result<Binding, BindError>
pub async fn bind( &self, signed: &SignedBind, rt: &SeedApiRuntime, now: u64, ) -> Result<Binding, BindError>
Verify signed for rt at now (unix seconds) and chain the
outcome (workload.node.bind, or workload.refuse on any failure).
Auto Trait Implementations§
impl !Freeze for SeedBinder
impl RefUnwindSafe for SeedBinder
impl Send for SeedBinder
impl Sync for SeedBinder
impl Unpin for SeedBinder
impl UnsafeUnpin for SeedBinder
impl UnwindSafe for SeedBinder
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