pub struct ReplicationManager { /* private fields */ }Expand description
Replication manager for distributed RDF data
Implementations§
Source§impl ReplicationManager
impl ReplicationManager
Sourcepub fn new(strategy: ReplicationStrategy, local_node_id: OxirsNodeId) -> Self
pub fn new(strategy: ReplicationStrategy, local_node_id: OxirsNodeId) -> Self
Create a new replication manager
Sourcepub fn with_raft_consensus(local_node_id: OxirsNodeId) -> Self
pub fn with_raft_consensus(local_node_id: OxirsNodeId) -> Self
Create a new replication manager with Raft consensus (default)
Sourcepub fn add_replica(&mut self, node_id: OxirsNodeId, address: String) -> bool
pub fn add_replica(&mut self, node_id: OxirsNodeId, address: String) -> bool
Add a replica to the replication set
Sourcepub fn remove_replica(&mut self, node_id: OxirsNodeId) -> bool
pub fn remove_replica(&mut self, node_id: OxirsNodeId) -> bool
Remove a replica from the replication set
Sourcepub fn get_replicas(&self) -> &HashMap<OxirsNodeId, ReplicaInfo>
pub fn get_replicas(&self) -> &HashMap<OxirsNodeId, ReplicaInfo>
Get all replicas
Sourcepub fn get_healthy_replicas(&self) -> Vec<&ReplicaInfo>
pub fn get_healthy_replicas(&self) -> Vec<&ReplicaInfo>
Get healthy replicas only
Sourcepub fn get_replica(&self, node_id: OxirsNodeId) -> Option<&ReplicaInfo>
pub fn get_replica(&self, node_id: OxirsNodeId) -> Option<&ReplicaInfo>
Get replica by node ID
Sourcepub fn update_replica_health(
&mut self,
node_id: OxirsNodeId,
is_healthy: bool,
) -> bool
pub fn update_replica_health( &mut self, node_id: OxirsNodeId, is_healthy: bool, ) -> bool
Update replica health status
Sourcepub fn update_replica_lag(
&mut self,
node_id: OxirsNodeId,
applied_index: u64,
current_index: u64,
)
pub fn update_replica_lag( &mut self, node_id: OxirsNodeId, applied_index: u64, current_index: u64, )
Update replica lag information
Sourcepub async fn health_check(&mut self, stale_threshold: Duration)
pub async fn health_check(&mut self, stale_threshold: Duration)
Check all replicas and mark stale ones as unhealthy
Sourcepub fn get_strategy(&self) -> &ReplicationStrategy
pub fn get_strategy(&self) -> &ReplicationStrategy
Get the current replication strategy
Sourcepub fn set_strategy(&mut self, strategy: ReplicationStrategy)
pub fn set_strategy(&mut self, strategy: ReplicationStrategy)
Change the replication strategy
Sourcepub fn get_stats(&self) -> &ReplicationStats
pub fn get_stats(&self) -> &ReplicationStats
Get replication statistics
Sourcepub fn is_replication_healthy(&self) -> bool
pub fn is_replication_healthy(&self) -> bool
Check if replication requirements are met
Sourcepub fn required_replica_count(&self) -> usize
pub fn required_replica_count(&self) -> usize
Get required replica count for the current strategy
Sourcepub async fn maintenance_tick(&mut self, stale_threshold: Duration)
pub async fn maintenance_tick(&mut self, stale_threshold: Duration)
Perform a single maintenance iteration: health-check replicas against
stale_threshold and log current stats. Separated from
ReplicationManager::run_maintenance’s infinite loop so a caller can
drive the cadence itself and re-check a shutdown flag between ticks
(see ClusterNode::start_background_tasks).
Sourcepub async fn run_maintenance(&mut self)
pub async fn run_maintenance(&mut self)
Run periodic maintenance tasks
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReplicationManager
impl RefUnwindSafe for ReplicationManager
impl Send for ReplicationManager
impl Sync for ReplicationManager
impl Unpin for ReplicationManager
impl UnsafeUnpin for ReplicationManager
impl UnwindSafe for ReplicationManager
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> 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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 moreimpl<T> MaybeDebug for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.