pub trait IReplicator:
Send
+ Sync
+ 'static {
// Required methods
fn open<'life0, 'async_trait>(
&'life0 self,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<WString>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 self,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn change_role<'life0, 'async_trait>(
&'life0 self,
epoch: Epoch,
role: ReplicaRole,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_epoch<'life0, 'async_trait>(
&'life0 self,
epoch: Epoch,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
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§
Sourcefn open<'life0, 'async_trait>(
&'life0 self,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<WString>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open<'life0, 'async_trait>(
&'life0 self,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<WString>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.
fn close<'life0, 'async_trait>(
&'life0 self,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn change_role<'life0, 'async_trait>(
&'life0 self,
epoch: Epoch,
role: ReplicaRole,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn change_role<'life0, 'async_trait>(
&'life0 self,
epoch: Epoch,
role: ReplicaRole,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Change the replicator role.
Remarks: Replicator change_role is called before Replica change_role.
Sourcefn update_epoch<'life0, 'async_trait>(
&'life0 self,
epoch: Epoch,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_epoch<'life0, 'async_trait>(
&'life0 self,
epoch: Epoch,
cancellation_token: BoxedCancelToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
(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.
Sourcefn get_current_progress(&self) -> Result<i64>
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.
Sourcefn get_catch_up_capability(&self) -> Result<i64>
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).