pub struct MigrationContext {
pub p2p: Option<Arc<P2PNode>>,
pub self_id: Option<PeerId>,
pub self_xor: Option<XorName>,
pub commitment: Option<Arc<ResponderCommitmentState>>,
pub replication: Option<Arc<ReplicationConfig>>,
pub sync_state: Option<Arc<RwLock<NeighborSyncState>>>,
pub audit_challenge_coordinator: Option<Arc<AuditChallengeCoordinator>>,
pub peer_commitments: Option<Arc<RwLock<HashMap<PeerId, PeerCommitmentRecord>>>>,
pub close_group_size: usize,
}Expand description
The network facts the driver needs, kept behind one type so the store itself stays free of any knowledge of routing or commitments.
Fields§
§p2p: Option<Arc<P2PNode>>Routing, for close-group rank and possession checks. None in devnet and tests.
self_id: Option<PeerId>This node’s peer ID.
self_xor: Option<XorName>This node’s address in the key space, for ordering the copy closest-first.
commitment: Option<Arc<ResponderCommitmentState>>The responder commitment state, which owns the retention contract.
replication: Option<Arc<ReplicationConfig>>Replication settings, for the possession round that gates shedding.
sync_state: Option<Arc<RwLock<NeighborSyncState>>>Neighbour-sync state, which the possession challenge needs.
audit_challenge_coordinator: Option<Arc<AuditChallengeCoordinator>>Coordinator for the possession challenges.
peer_commitments: Option<Arc<RwLock<HashMap<PeerId, PeerCommitmentRecord>>>>What this node last heard each peer commit to.
Used to require that a peer trusted to hold a chunk is currently publishing a claim, rather than sitting between a retired commitment and its next rotation, which is precisely the state a node in the middle of its own migration is in.
close_group_size: usizeClose-group width.
Implementations§
Source§impl MigrationContext
impl MigrationContext
Sourcepub fn commitment_recipients_needed(&self) -> usize
pub fn commitment_recipients_needed(&self) -> usize
How many peers of the close group must have seen the reduced commitment.
The same tolerance the pruner applies to possession proofs: all of them for a group of one or two, one short of the group otherwise, so a single unreachable peer cannot veto the migration forever without accepting an uninformed close group.
Sourcepub async fn neighbours_know_the_commitment(&self) -> bool
pub async fn neighbours_know_the_commitment(&self) -> bool
Have enough of this node’s close group actually received its reduced commitment?
A rotation is not the same as neighbours knowing. Until they have seen the smaller key set they keep auditing against the one this node used to hold, so giving a chunk up before then turns a legitimate migration into a wave of audit failures.
Sourcepub fn still_answerable(&self, key: &XorName) -> bool
pub fn still_answerable(&self, key: &XorName) -> bool
Is this key still answerable under a retained commitment slot?
This is the pruner’s existing veto, reused verbatim: a key the node could still be challenged on must not lose its last local copy.
Sourcepub fn shed_width(&self) -> usize
pub fn shed_width(&self) -> usize
The width this node measures ranks against: the admission group, not the close group.
Sourcepub async fn close_group_rank(&self, key: &XorName) -> GroupRank
pub async fn close_group_rank(&self, key: &XorName) -> GroupRank
This node’s position in key’s admission group.
Sourcepub async fn may_shed(&self, key: &XorName) -> bool
pub async fn may_shed(&self, key: &XorName) -> bool
May this node give up key without risking its last replica?
Only if it is outside the admission group entirely, or sits in that group’s last
SHEDDABLE_TAIL_RANKS positions. Never when the answer is unknown.
Auto Trait Implementations§
impl !RefUnwindSafe for MigrationContext
impl !UnwindSafe for MigrationContext
impl Freeze for MigrationContext
impl Send for MigrationContext
impl Sync for MigrationContext
impl Unpin for MigrationContext
impl UnsafeUnpin for MigrationContext
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