LocalReplicator

Trait LocalReplicator 

Source
pub trait LocalReplicator:
    Send
    + Sync
    + 'static {
    // Required methods
    async fn open(
        &self,
        cancellation_token: BoxedCancelToken,
    ) -> Result<WString>;
    async fn close(&self, cancellation_token: BoxedCancelToken) -> Result<()>;
    async fn change_role(
        &self,
        epoch: &Epoch,
        role: &ReplicaRole,
        cancellation_token: BoxedCancelToken,
    ) -> Result<()>;
    async fn update_epoch(
        &self,
        epoch: &Epoch,
        cancellation_token: BoxedCancelToken,
    ) -> Result<()>;
    fn get_current_progress(&self) -> Result<i64>;
    fn get_catch_up_capability(&self) -> Result<i64>;
    fn abort(&self);
}
Expand description

TODO: replicator has no public documentation

Required Methods§

Source

async fn open(&self, cancellation_token: BoxedCancelToken) -> Result<WString>

Opens replicator, and returns the replicator address that is visible to primary in ReplicaInformation. Remarks: Replicator does not have an assigned role yet and should setup listening endpoint.

Source

async fn close(&self, cancellation_token: BoxedCancelToken) -> Result<()>

Source

async fn change_role( &self, epoch: &Epoch, role: &ReplicaRole, cancellation_token: BoxedCancelToken, ) -> Result<()>

Change the replicator role.

Remarks: Replicator change_role is called before Replica change_role.

Source

async fn update_epoch( &self, epoch: &Epoch, cancellation_token: BoxedCancelToken, ) -> Result<()>

(TODO: This doc is from IStateProvider but not Replicator.) Indicates to a replica that the configuration of a replica set has changed due to a change or attempted change to the primary replica. The change occurs due to failure or load balancing of the previous primary replica. Epoch changes act as a barrier by segmenting operations into the exact configuration periods in which they were sent by a specific primary replica.

Called only on active/idle secondary replicas. Primary replica gets new epoch via change_role call.

Source

fn get_current_progress(&self) -> Result<i64>

Get the current LSN, end of log, called on secondaries. SF uses this to do primary selection. It is also passed to update_catch_up_replica_set_configuration() on primary. Primary uses this for catchup.

Source

fn get_catch_up_capability(&self) -> Result<i64>

Get the first LSN, beginning of log. Remarks: SF uses this to determine if other replicas can catch up from this replica. Other replica’s end of log must be higher than this replica’s beginning of log in order for the other replica to catchup, otherwise SF needs to drop the other replica (if the current replica is chosen to be primary).

Source

fn abort(&self)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<TraitVariantBlanketType: Replicator> LocalReplicator for TraitVariantBlanketType