MockRpcService

Struct MockRpcService 

Source
pub struct MockRpcService {
    pub server_port: Option<u16>,
    pub expected_vote_response: Option<Result<VoteResponse, Status>>,
    pub expected_append_entries_response: Option<Result<AppendEntriesResponse, Status>>,
    pub expected_update_cluster_conf_response: Option<Result<ClusterConfUpdateResponse, Status>>,
    pub expected_client_propose_response: Option<Result<ClientResponse, Status>>,
    pub expected_client_read_response: Option<Result<ClientResponse, Status>>,
    pub expected_metadata_response: Option<Arc<dyn Fn(u16) -> Result<ClusterMembership, Status> + Send + Sync>>,
    pub expected_snapshot_response: Option<Result<SnapshotResponse, Status>>,
    pub expected_stream_snapshot_response: Option<Result<SnapshotChunk, Status>>,
    pub expected_purge_log_response: Option<Result<PurgeLogResponse, Status>>,
    pub expected_join_cluster_response: Option<Result<JoinResponse, Status>>,
    pub expected_discover_leader_response: Option<Result<LeaderDiscoveryResponse, Status>>,
}

Fields§

§server_port: Option<u16>§expected_vote_response: Option<Result<VoteResponse, Status>>§expected_append_entries_response: Option<Result<AppendEntriesResponse, Status>>§expected_update_cluster_conf_response: Option<Result<ClusterConfUpdateResponse, Status>>§expected_client_propose_response: Option<Result<ClientResponse, Status>>§expected_client_read_response: Option<Result<ClientResponse, Status>>§expected_metadata_response: Option<Arc<dyn Fn(u16) -> Result<ClusterMembership, Status> + Send + Sync>>§expected_snapshot_response: Option<Result<SnapshotResponse, Status>>§expected_stream_snapshot_response: Option<Result<SnapshotChunk, Status>>§expected_purge_log_response: Option<Result<PurgeLogResponse, Status>>§expected_join_cluster_response: Option<Result<JoinResponse, Status>>§expected_discover_leader_response: Option<Result<LeaderDiscoveryResponse, Status>>

Implementations§

Source§

impl MockRpcService

Source

pub fn with_metadata_response( self, f: impl Fn(u16) -> Result<ClusterMembership, Status> + Send + Sync + 'static, ) -> Self

Source

pub fn set_port(&mut self, port: u16)

Trait Implementations§

Source§

impl Clone for MockRpcService

Source§

fn clone(&self) -> MockRpcService

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ClusterManagementService for MockRpcService

Source§

fn update_cluster_conf<'life0, 'async_trait>( &'life0 self, _request: Request<ClusterConfChangeRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<ClusterConfUpdateResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_cluster_metadata<'life0, 'async_trait>( &'life0 self, _request: Request<MetadataRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<ClusterMembership>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn join_cluster<'life0, 'async_trait>( &'life0 self, _request: Request<JoinRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<JoinResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Request to join the cluster as a new learner node
Source§

fn discover_leader<'life0, 'async_trait>( &'life0 self, _request: Request<LeaderDiscoveryRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<LeaderDiscoveryResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

New RPC for leader discovery
Source§

impl Default for MockRpcService

Source§

fn default() -> MockRpcService

Returns the “default value” for a type. Read more
Source§

impl RaftClientService for MockRpcService

Source§

type WatchStream = ReceiverStream<Result<WatchResponse, Status>>

Server streaming response type for the Watch method.
Source§

fn handle_client_write<'life0, 'async_trait>( &'life0 self, _request: Request<ClientWriteRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<ClientResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn handle_client_read<'life0, 'async_trait>( &'life0 self, _request: Request<ClientReadRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<ClientResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn watch<'life0, 'async_trait>( &'life0 self, _request: Request<WatchRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::WatchStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Watch for changes on a specific key Read more
Source§

impl RaftElectionService for MockRpcService

Source§

fn request_vote<'life0, 'async_trait>( &'life0 self, _request: Request<VoteRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<VoteResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl RaftReplicationService for MockRpcService

Source§

fn append_entries<'life0, 'async_trait>( &'life0 self, _request: Request<AppendEntriesRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<AppendEntriesResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl SnapshotService for MockRpcService

Source§

type StreamSnapshotStream = Streaming<SnapshotChunk>

Server streaming response type for the StreamSnapshot method.
Source§

fn stream_snapshot<'life0, 'async_trait>( &'life0 self, _request: Request<Streaming<SnapshotAck>>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::StreamSnapshotStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Learner-driven snapshot streaming
Source§

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

Leader-driven snapshot streaming
Source§

fn purge_log<'life0, 'async_trait>( &'life0 self, _request: Request<PurgeLogRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<PurgeLogResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Log compaction request

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more