Skip to main content

ReplicationService

Trait ReplicationService 

Source
pub trait ReplicationService:
    Send
    + Sync
    + 'static {
    type FollowStream: Stream<Item = Result<FollowResponse, Status>> + Send + 'static;

    // Required methods
    fn follow<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Streaming<FollowRequest>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::FollowStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn promote<'life0, 'async_trait>(
        &'life0 self,
        request: Request<PromoteRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<PromoteResult>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn switchover<'life0, 'async_trait>(
        &'life0 self,
        request: Request<SwitchoverRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<SwitchoverResult>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with ReplicationServiceServer.

Required Associated Types§

Source

type FollowStream: Stream<Item = Result<FollowResponse, Status>> + Send + 'static

Server streaming response type for the Follow method.

Required Methods§

Source

fn follow<'life0, 'async_trait>( &'life0 self, request: Request<Streaming<FollowRequest>>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::FollowStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

FollowRequest.hello -> FollowResponse.challenge -> FollowRequest.challenge_response -> FollowResponse.start, then either an image (image…, image_end) or straight records; the standby acknowledges what it applied and synced.

Source

fn promote<'life0, 'async_trait>( &'life0 self, request: Request<PromoteRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<PromoteResult>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Asked of a standby: stop following and serve as the primary. Signed by a key granted manage for *, over kernable.v1.promote, valid 60 s around issued_at.

Source

fn switchover<'life0, 'async_trait>( &'life0 self, request: Request<SwitchoverRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SwitchoverResult>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Asked of a primary with a standby in sync: hand the primary role over to it now. The primary refuses new requests (UNAVAILABLE), lets running ones finish, and waits until the standby holds every record. In a pair it then tells the witness HANDOVER and the standby claims at once; without a witness it sends the standby TAKE_OVER on its stream, and the standby takes over. Either way the old primary stops, and never serves as the primary again unless started to follow. Signed by a key granted manage for *, over kernable.v1.switchover, valid 60 s around issued_at. FAILED_PRECONDITION: no standby in sync, or the standby did not catch up in time (the primary then serves on).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§