pub struct RevocationExchange { /* private fields */ }Expand description
Receives, applies and forwards revocation notices for one node.
Implementations§
Source§impl RevocationExchange
impl RevocationExchange
Sourcepub fn with_log_file(&self, path: impl Into<PathBuf>) -> usize
pub fn with_log_file(&self, path: impl Into<PathBuf>) -> usize
Keep the replay log in path (loaded now, saved after every notice).
Entries that no longer verify (a key since unpinned or revoked) are
dropped, so a replay never carries a notice peers would refuse.
Returns how many were restored. A missing file starts empty; a
malformed or oversized one is ignored (and overwritten on the next
notice).
Sourcepub fn forget_subject(&self, kind: RevocationKind, id: &str) -> usize
pub fn forget_subject(&self, kind: RevocationKind, id: &str) -> usize
Drop the logged notices for one subject (call when it is lifted) and save. Returns how many were dropped.
Sourcepub fn logged(&self) -> Vec<SignedRevocation>
pub fn logged(&self) -> Vec<SignedRevocation>
The notices kept for replay, oldest first. Those no longer in force here (lifted, or signer revoked) are dropped first, and the log saved without them.
Sourcepub fn replays_started(&self) -> u64
pub fn replays_started(&self) -> u64
Replays started so far (for tests and diagnostics).
Sourcepub async fn replay_to(&self, peer: &str) -> usize
pub async fn replay_to(&self, peer: &str) -> usize
Send every logged notice to peer, oldest first. The first
NOTICE_BURST go at once; the rest are paced at the rate the
receiver accepts so a long log is not rate-limited away. Returns how
many were sent.
Source§impl RevocationExchange
impl RevocationExchange
Sourcepub fn start(
ex: Arc<ArtifactExchange>,
list: Arc<RevocationList>,
anchors: TrustAnchors,
runtime: Arc<MeshRuntime>,
) -> Arc<Self> ⓘ
pub fn start( ex: Arc<ArtifactExchange>, list: Arc<RevocationList>, anchors: TrustAnchors, runtime: Arc<MeshRuntime>, ) -> Arc<Self> ⓘ
Exchange applying notices to ex, recording them in list and
trusting anchors. Installs itself on runtime and gives ex the
list.
Sourcepub fn set_on_applied(&self, hook: AppliedHook) -> bool
pub fn set_on_applied(&self, hook: AppliedHook) -> bool
Run hook after every notice that was new here is applied (first
call wins; returns whether this one did). Covers a notice from a peer
and the operator’s own Self::issue.
Sourcepub fn accept(&self, signed: &SignedRevocation) -> Result<bool, NoticeError>
pub fn accept(&self, signed: &SignedRevocation) -> Result<bool, NoticeError>
Record and apply a notice from a caller with no connection (budget 0). Returns whether it was new here; a notice already applied is not swept again.
Sourcepub async fn issue(&self, signed: SignedRevocation) -> Result<bool, NoticeError>
pub async fn issue(&self, signed: SignedRevocation) -> Result<bool, NoticeError>
Revoke here (the operator’s own node) and send the notice to every
peer. signed must verify against this node’s anchors. Not rate
limited: peers’ traffic cannot starve the operator.
Trait Implementations§
Source§impl PeerControlSink for RevocationExchange
impl PeerControlSink for RevocationExchange
Auto Trait Implementations§
impl !Freeze for RevocationExchange
impl !RefUnwindSafe for RevocationExchange
impl !UnwindSafe for RevocationExchange
impl Send for RevocationExchange
impl Sync for RevocationExchange
impl Unpin for RevocationExchange
impl UnsafeUnpin for RevocationExchange
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