pub struct PrimaryDcManager { /* private fields */ }Expand description
The primary datacenter replication manager
Maintains the replication log, tracks replica progress, and ships entries to replicas.
Implementations§
Source§impl PrimaryDcManager
impl PrimaryDcManager
Sourcepub fn new(config: CrossDcConfig) -> Result<Self>
pub fn new(config: CrossDcConfig) -> Result<Self>
Create a new primary DC manager
Sourcepub fn add_replica(&self, dc_id: DcId, region: String)
pub fn add_replica(&self, dc_id: DcId, region: String)
Register a replica DC
Sourcepub fn remove_replica(&self, dc_id: &str)
pub fn remove_replica(&self, dc_id: &str)
Remove a replica DC
Sourcepub fn publish_upsert(
&self,
vector_id: String,
vector: Vec<f32>,
metadata: HashMap<String, String>,
) -> ReplicationSeq
pub fn publish_upsert( &self, vector_id: String, vector: Vec<f32>, metadata: HashMap<String, String>, ) -> ReplicationSeq
Publish a vector upsert to the replication log
Sourcepub fn publish_delete(&self, vector_id: String) -> ReplicationSeq
pub fn publish_delete(&self, vector_id: String) -> ReplicationSeq
Publish a vector deletion to the replication log
Sourcepub fn publish_heartbeat(&self) -> ReplicationSeq
pub fn publish_heartbeat(&self) -> ReplicationSeq
Publish a heartbeat entry
Sourcepub fn get_entries_for_replica(
&self,
_replica_dc: &str,
after_seq: ReplicationSeq,
) -> Vec<ReplicationEntry>
pub fn get_entries_for_replica( &self, _replica_dc: &str, after_seq: ReplicationSeq, ) -> Vec<ReplicationEntry>
Get entries for a specific replica starting from after_seq
Returns a batch of entries that the replica should apply.
Sourcepub fn acknowledge_replica(
&self,
dc_id: &str,
acked_seq: ReplicationSeq,
bytes_received: u64,
entries_received: u64,
) -> Result<()>
pub fn acknowledge_replica( &self, dc_id: &str, acked_seq: ReplicationSeq, bytes_received: u64, entries_received: u64, ) -> Result<()>
Record acknowledgment from a replica
Sourcepub fn record_replica_failure(&self, dc_id: &str)
pub fn record_replica_failure(&self, dc_id: &str)
Record a failure contacting a replica
Sourcepub fn get_replica_status(
&self,
) -> Vec<(DcId, ReplicaStatus, ReplicationSeq, Duration)>
pub fn get_replica_status( &self, ) -> Vec<(DcId, ReplicaStatus, ReplicationSeq, Duration)>
Get current replication status for all replicas
Sourcepub fn has_lagging_replicas(&self) -> bool
pub fn has_lagging_replicas(&self) -> bool
Check if any replica is beyond the lag tolerance
Sourcepub fn max_replica_lag_entries(&self) -> u64
pub fn max_replica_lag_entries(&self) -> u64
Get the maximum replica lag in entries
Sourcepub fn get_stats(&self) -> CrossDcStats
pub fn get_stats(&self) -> CrossDcStats
Get current statistics
Sourcepub fn current_seq(&self) -> ReplicationSeq
pub fn current_seq(&self) -> ReplicationSeq
Get the current sequence number
Sourcepub fn log_length(&self) -> usize
pub fn log_length(&self) -> usize
Get the number of entries in the replication log
Sourcepub fn replica_count(&self) -> usize
pub fn replica_count(&self) -> usize
Get the number of registered replicas
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrimaryDcManager
impl !RefUnwindSafe for PrimaryDcManager
impl Send for PrimaryDcManager
impl Sync for PrimaryDcManager
impl Unpin for PrimaryDcManager
impl UnsafeUnpin for PrimaryDcManager
impl !UnwindSafe for PrimaryDcManager
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> 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 moreSource§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,
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.