pub struct PointerReplication { /* private fields */ }Expand description
Pointer replication for one node. See the module documentation.
Implementations§
Source§impl PointerReplication
impl PointerReplication
Sourcepub fn is_capable(&self, peer: &PeerId) -> bool
pub fn is_capable(&self, peer: &PeerId) -> bool
Whether peer has sent a pointer message, and may therefore be asked.
Sourcepub async fn push_hints(&self, peers: &[PeerId])
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.
Sourcepub async fn verify_due(&self)
pub async fn verify_due(&self)
Verify and fetch whatever is due now. Also the tests’ way to drive it.
Sourcepub async fn replicate_fresh(self: &Arc<Self>, write: PointerFreshWrite)
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.
Sourcepub async fn check_final(&self, state: &PointerState) -> FinalityCheck
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.
Sourcepub async fn check_possession(&self, fresh: PointerState, peers: &[PeerId])
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.
Sourcepub async fn prune_pass(
&self,
allow_remote: bool,
disk_pressure: &DiskPressure,
commitment_state: Option<&ResponderCommitmentState>,
)
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
impl FinalStateWitness for PointerReplication
Source§fn check_final<'a>(
&'a self,
state: &'a PointerState,
) -> BoxFuture<'a, FinalityCheck>
fn check_final<'a>( &'a self, state: &'a PointerState, ) -> BoxFuture<'a, FinalityCheck>
state is
already held at state.address.Source§fn proven_conflict(&self, state: &PointerState) -> Option<PointerState>
fn proven_conflict(&self, state: &PointerState) -> Option<PointerState>
state.address, other than state, that an earlier
check already proved, without asking anyone. Read moreSource§fn forget_clear(&self, state: &PointerState)
fn forget_clear(&self, state: &PointerState)
state clear: the write it cleared did not
land, so a retry must look again rather than reuse the answer.Auto Trait Implementations§
impl !Freeze for PointerReplication
impl !RefUnwindSafe for PointerReplication
impl !UnwindSafe for PointerReplication
impl Send for PointerReplication
impl Sync for PointerReplication
impl Unpin for PointerReplication
impl UnsafeUnpin for PointerReplication
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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