pub struct ReplicationManager { /* private fields */ }Expand description
Replication manager that coordinates replication state and operations.
This manages:
- Server replication role (Primary, Replica, Standalone)
- Write access control (replicas are read-only)
- Change streaming for replica consumers
- Replication status reporting
Implementations§
Source§impl ReplicationManager
impl ReplicationManager
Sourcepub fn new_primary(changelog: Arc<ChangeLog>) -> Self
pub fn new_primary(changelog: Arc<ChangeLog>) -> Self
Create a new replication manager in primary mode.
Sourcepub fn new_standalone(changelog: Arc<ChangeLog>) -> Self
pub fn new_standalone(changelog: Arc<ChangeLog>) -> Self
Create a new replication manager in standalone mode.
Sourcepub fn new_replica(
changelog: Arc<ChangeLog>,
applier: Arc<ReplicaApplier>,
primary_addr: String,
) -> Self
pub fn new_replica( changelog: Arc<ChangeLog>, applier: Arc<ReplicaApplier>, primary_addr: String, ) -> Self
Create a new replication manager in replica mode.
Sourcepub async fn role(&self) -> ReplicationRole
pub async fn role(&self) -> ReplicationRole
Get the current replication role.
Sourcepub async fn is_replica(&self) -> bool
pub async fn is_replica(&self) -> bool
Check if this server is a replica.
Sourcepub async fn is_primary(&self) -> bool
pub async fn is_primary(&self) -> bool
Check if this server is the primary.
Sourcepub async fn status(&self) -> ReplicationStatus
pub async fn status(&self) -> ReplicationStatus
Get the current replication status.
Sourcepub fn current_lsn(&self) -> u64
pub fn current_lsn(&self) -> u64
Get the current LSN.
Sourcepub fn stream_changes(
&self,
from_lsn: u64,
batch_size: u32,
) -> StreamChangesResponse
pub fn stream_changes( &self, from_lsn: u64, batch_size: u32, ) -> StreamChangesResponse
Stream changes from the given LSN.
Sourcepub fn stream_changes_filtered(
&self,
from_lsn: u64,
batch_size: u32,
entity_filter: Option<&[String]>,
) -> StreamChangesResponse
pub fn stream_changes_filtered( &self, from_lsn: u64, batch_size: u32, entity_filter: Option<&[String]>, ) -> StreamChangesResponse
Stream changes with entity filter.
Sourcepub fn applied_lsn(&self) -> Option<u64>
pub fn applied_lsn(&self) -> Option<u64>
Get the applied LSN (for replicas).
Sourcepub async fn promote_to_primary(&self)
pub async fn promote_to_primary(&self)
Promote this server to primary.
This is used when the primary fails and a replica needs to take over.
Sourcepub async fn demote_to_replica(&self, primary_addr: String)
pub async fn demote_to_replica(&self, primary_addr: String)
Demote this server to replica.
This is used when another server becomes primary.
Auto Trait Implementations§
impl !Freeze for ReplicationManager
impl !RefUnwindSafe for ReplicationManager
impl Send for ReplicationManager
impl Sync for ReplicationManager
impl Unpin for ReplicationManager
impl !UnwindSafe for ReplicationManager
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.