Skip to main content

PointerReplication

Struct PointerReplication 

Source
pub struct PointerReplication { /* private fields */ }
Expand description

Pointer replication for one node. See the module documentation.

Implementations§

Source§

impl PointerReplication

Source

pub fn is_capable(&self, peer: &PeerId) -> bool

Whether peer has sent a pointer message, and may therefore be asked.

Source

pub async fn push_hints(&self, peers: &[PeerId])

Push hints to peers and wait until they are sent. This is what each neighbour-sync round runs in the background; tests call it to drive a round.

Source

pub async fn verify_due(&self)

Verify and fetch whatever is due now. Also the tests’ way to drive it.

Source

pub async fn replicate_fresh(self: &Arc<Self>, write: PointerFreshWrite)

Offer a freshly paid state to the rest of its close group, and schedule the check that they took it.

Source

pub async fn check_final(&self, state: &PointerState) -> FinalityCheck

Ask the close group whether a final state at state.address, other than state, is already held, and have a peer that says so prove it by serving the signed record.

Asked before this node takes a final state it does not hold. A final state is replaced by nothing, so a node that took a second one would hold it for good; asking first is what keeps a former owner from finalizing an address again on a node that had not yet heard it was final, such as one that joined the group since.

A peer’s word is not enough to refuse: a state summary is a claim anyone can make, and one dishonest peer could otherwise block every handover. A signed record is not a claim. Only the owner can sign a final state, so one that verifies is the owner’s own proof that it finalized the pointer before.

A proof is remembered, beside any other for the address, so the same loser is refused again without a question; a clear look is reused for the same state for FINAL_STATE_CLEAR_REUSE. Checks for one address wait their turn, so a burst of replays queued behind a look costs that one round, and at most FINAL_STATE_CHECK_STRIPES run at once; one that cannot start within FINAL_STATE_CHECK_WAIT answers Busy. Once started it is bounded by FINAL_STATE_CHECK_BUDGET, and only peers that have sent a pointer message are asked. A group that cannot be asked in time finds nothing, and the write goes ahead on the merge rule alone: a race is a fork the client detects, not one this can prevent.

Source

pub async fn check_possession(&self, fresh: PointerState, peers: &[PeerId])

Ask each peer for the record, and penalise any still responsible for it that cannot produce fresh or a state that replaces it.

Source

pub async fn prune_pass( &self, allow_remote: bool, disk_pressure: &DiskPressure, commitment_state: Option<&ResponderCommitmentState>, )

Delete records this node has been out of range of for the hysteresis period, where that is safe. Run when a neighbour-sync cycle completes.

allow_remote is false while bootstrapping: candidacy is still tracked, but nothing that needs other peers’ proof is decided.

Being out of range makes a record eligible, never due (ADR-0028): while disk_pressure reports room on the disk, every candidate is kept and no group is asked. Under pressure, candidates are tried farthest from this node first, those whose group failed to prove them in this spell last.

A record a retained storage commitment still commits to is never deleted, exactly as for a chunk: an auditor pinning that commitment may still open it, and a node that deleted it would fail that audit.

Trait Implementations§

Source§

impl FinalStateWitness for PointerReplication

Source§

fn check_final<'a>( &'a self, state: &'a PointerState, ) -> BoxFuture<'a, FinalityCheck>

Ask the close group whether a final state other than state is already held at state.address.
Source§

fn proven_conflict(&self, state: &PointerState) -> Option<PointerState>

A final state at state.address, other than state, that an earlier check already proved, without asking anyone. Read more
Source§

fn forget_clear(&self, state: &PointerState)

Forget that a look found state clear: the write it cleared did not land, so a retry must look again rather than reuse the answer.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more