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§
Trait Implementations§
Source§impl Clone for MockRpcService
impl Clone for MockRpcService
Source§fn clone(&self) -> MockRpcService
fn clone(&self) -> MockRpcService
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ClusterManagementService for MockRpcService
impl ClusterManagementService for MockRpcService
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,
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,
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,
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
impl Default for MockRpcService
Source§fn default() -> MockRpcService
fn default() -> MockRpcService
Returns the “default value” for a type. Read more
Source§impl RaftClientService for MockRpcService
impl RaftClientService for MockRpcService
Source§type WatchStream = ReceiverStream<Result<WatchResponse, Status>>
type WatchStream = ReceiverStream<Result<WatchResponse, Status>>
Server streaming response type for the Watch method.
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,
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§impl RaftElectionService for MockRpcService
impl RaftElectionService for MockRpcService
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
impl RaftReplicationService for MockRpcService
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
impl SnapshotService for MockRpcService
Source§type StreamSnapshotStream = Streaming<SnapshotChunk>
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,
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,
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
Auto Trait Implementations§
impl !Freeze for MockRpcService
impl !RefUnwindSafe for MockRpcService
impl Send for MockRpcService
impl Sync for MockRpcService
impl Unpin for MockRpcService
impl !UnwindSafe for MockRpcService
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request