pub struct ReplicationConfig {Show 19 fields
pub close_group_size: usize,
pub quorum_threshold: usize,
pub paid_list_close_group_size: usize,
pub neighbor_sync_scope: usize,
pub neighbor_sync_peer_count: usize,
pub neighbor_sync_interval_min: Duration,
pub neighbor_sync_interval_max: Duration,
pub neighbor_sync_cooldown: Duration,
pub self_lookup_interval_min: Duration,
pub self_lookup_interval_max: Duration,
pub audit_tick_interval_min: Duration,
pub audit_tick_interval_max: Duration,
pub audit_response_base: Duration,
pub audit_response_per_chunk: Duration,
pub bootstrap_claim_grace_period: Duration,
pub prune_hysteresis_duration: Duration,
pub verification_request_timeout: Duration,
pub fetch_request_timeout: Duration,
pub bootstrap_complete_timeout_secs: u64,
}Expand description
Runtime-configurable replication parameters.
Validated on construction — node rejects invalid configs.
Fields§
§close_group_size: usizeClose-group width and target holder count per key.
quorum_threshold: usizeRequired positive presence votes for quorum.
paid_list_close_group_size: usizeMaximum closest nodes tracking paid status for a key.
neighbor_sync_scope: usizeNumber of closest peers to self eligible for neighbor sync.
neighbor_sync_peer_count: usizePeers synced concurrently per round-robin repair round.
neighbor_sync_interval_min: DurationNeighbor sync cadence range (min).
neighbor_sync_interval_max: DurationNeighbor sync cadence range (max).
neighbor_sync_cooldown: DurationMinimum spacing between successive syncs with the same peer.
self_lookup_interval_min: DurationSelf-lookup cadence range (min).
self_lookup_interval_max: DurationSelf-lookup cadence range (max).
audit_tick_interval_min: DurationAudit scheduler cadence range (min).
audit_tick_interval_max: DurationAudit scheduler cadence range (max).
audit_response_base: DurationBase audit response deadline (chunk-independent component).
audit_response_per_chunk: DurationPer-chunk allowance added to the base audit response deadline.
bootstrap_claim_grace_period: DurationMaximum duration a peer may claim bootstrap status.
prune_hysteresis_duration: DurationMinimum continuous out-of-range duration before pruning a key.
verification_request_timeout: DurationVerification request timeout (per-batch).
fetch_request_timeout: DurationFetch request timeout.
bootstrap_complete_timeout_secs: u64Seconds to wait for DhtNetworkEvent::BootstrapComplete before
proceeding with bootstrap sync (covers bootstrap nodes with no peers).
Implementations§
Source§impl ReplicationConfig
impl ReplicationConfig
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate safety constraints. Returns Err with a description if any
constraint is violated.
§Errors
Returns a human-readable message describing the first violated constraint.
Sourcepub fn quorum_needed(&self, quorum_targets_count: usize) -> usize
pub fn quorum_needed(&self, quorum_targets_count: usize) -> usize
Effective quorum votes required for a key given the number of reachable quorum targets.
min(self.quorum_threshold, floor(quorum_targets_count / 2) + 1)
Sourcepub fn confirm_needed(paid_group_size: usize) -> usize
pub fn confirm_needed(paid_group_size: usize) -> usize
Confirmations required for paid-list consensus given the number of peers in the paid-list close group for a key.
floor(paid_group_size / 2) + 1
Sourcepub fn random_neighbor_sync_interval(&self) -> Duration
pub fn random_neighbor_sync_interval(&self) -> Duration
Returns a random duration in [neighbor_sync_interval_min, neighbor_sync_interval_max].
Sourcepub fn audit_sample_count(total_keys: usize) -> usize
pub fn audit_sample_count(total_keys: usize) -> usize
Compute the number of keys to sample for an audit round, scaled dynamically by the total number of locally stored keys.
Formula: max(floor(sqrt(total_keys)), 1), capped at total_keys.
Sourcepub fn max_incoming_audit_keys(stored_chunks: usize) -> usize
pub fn max_incoming_audit_keys(stored_chunks: usize) -> usize
Maximum number of keys to accept in an incoming audit challenge.
Scales dynamically: 2 * audit_sample_count(stored_chunks). The 2x
margin accounts for the challenger having a larger store than us and
therefore sampling more keys.
Sourcepub fn audit_response_timeout(&self, chunk_count: usize) -> Duration
pub fn audit_response_timeout(&self, chunk_count: usize) -> Duration
Compute the audit response timeout for a challenge with chunk_count
keys: base + per_chunk * chunk_count.
Sourcepub fn random_audit_tick_interval(&self) -> Duration
pub fn random_audit_tick_interval(&self) -> Duration
Returns a random duration in [audit_tick_interval_min, audit_tick_interval_max].
Sourcepub fn random_self_lookup_interval(&self) -> Duration
pub fn random_self_lookup_interval(&self) -> Duration
Returns a random duration in [self_lookup_interval_min, self_lookup_interval_max].
Trait Implementations§
Source§impl Clone for ReplicationConfig
impl Clone for ReplicationConfig
Source§fn clone(&self) -> ReplicationConfig
fn clone(&self) -> ReplicationConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReplicationConfig
impl Debug for ReplicationConfig
Auto Trait Implementations§
impl Freeze for ReplicationConfig
impl RefUnwindSafe for ReplicationConfig
impl Send for ReplicationConfig
impl Sync for ReplicationConfig
impl Unpin for ReplicationConfig
impl UnsafeUnpin for ReplicationConfig
impl UnwindSafe for ReplicationConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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