pub struct AnchoringController { /* private fields */ }Expand description
Policy-gated wrapper around a ChainAnchor backend.
Implementations§
Source§impl AnchoringController
impl AnchoringController
Sourcepub fn new(backend: Arc<dyn ChainAnchor>, policy: AnchorFrequencyPolicy) -> Self
pub fn new(backend: Arc<dyn ChainAnchor>, policy: AnchorFrequencyPolicy) -> Self
Wrap an existing backend with a frequency policy.
Sourcepub fn from_config(
cfg: &ChainExternalAnchorConfig,
) -> Result<Option<Self>, String>
pub fn from_config( cfg: &ChainExternalAnchorConfig, ) -> Result<Option<Self>, String>
Build from kernel config. Returns None when backend is None.
Sourcepub fn backend_name(&self) -> &str
pub fn backend_name(&self) -> &str
Backend name for logging/display.
Sourcepub fn policy(&self) -> AnchorFrequencyPolicy
pub fn policy(&self) -> AnchorFrequencyPolicy
Frequency policy in force.
Sourcepub fn backend(&self) -> &dyn ChainAnchor
pub fn backend(&self) -> &dyn ChainAnchor
Underlying backend (for direct verify / tests).
Sourcepub fn try_anchor(
&self,
hash: &[u8; 32],
chain_seq: u64,
) -> Result<Option<AnchorReceipt>, String>
pub fn try_anchor( &self, hash: &[u8; 32], chain_seq: u64, ) -> Result<Option<AnchorReceipt>, String>
Anchor only when the frequency policy allows it.
Returns Ok(None) when the policy suppresses the call (not an error).
Sourcepub fn force_anchor(
&self,
hash: &[u8; 32],
chain_seq: u64,
) -> Result<AnchorReceipt, String>
pub fn force_anchor( &self, hash: &[u8; 32], chain_seq: u64, ) -> Result<AnchorReceipt, String>
Force an anchor, bypassing the frequency policy (still updates state).
Sourcepub fn try_anchor_chain_head(
&self,
chain: &ChainManager,
) -> Result<Option<AnchorReceipt>, String>
pub fn try_anchor_chain_head( &self, chain: &ChainManager, ) -> Result<Option<AnchorReceipt>, String>
Anchor the current ExoChain head when policy allows.
On success, also appends a chain.external_anchor audit event to
the local chain so operators can see the receipt on the ExoChain.
Auto Trait Implementations§
impl !Freeze for AnchoringController
impl !RefUnwindSafe for AnchoringController
impl !UnwindSafe for AnchoringController
impl Send for AnchoringController
impl Sync for AnchoringController
impl Unpin for AnchoringController
impl UnsafeUnpin for AnchoringController
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
Mutably borrows from an owned value. Read more
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> ⓘ
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