pub struct TypeConfig {}Expand description
Declare the type configuration for example K/V store.
Trait Implementations§
Source§impl Clone for TypeConfig
impl Clone for TypeConfig
Source§fn clone(&self) -> TypeConfig
fn clone(&self) -> TypeConfig
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 Debug for TypeConfig
impl Debug for TypeConfig
Source§impl Default for TypeConfig
impl Default for TypeConfig
Source§fn default() -> TypeConfig
fn default() -> TypeConfig
Returns the “default value” for a type. Read more
Source§impl NetBackoff<TypeConfig> for NetworkConnection
impl NetBackoff<TypeConfig> for NetworkConnection
Source§impl NetSnapshot<TypeConfig> for NetworkConnection
impl NetSnapshot<TypeConfig> for NetworkConnection
Source§async fn full_snapshot(
&mut self,
vote: <TypeConfig as RaftTypeConfig>::Vote,
snapshot: Snapshot<TypeConfig>,
_cancel: impl Future<Output = ReplicationClosed> + OptionalSend + 'static,
_option: RPCOption,
) -> Result<SnapshotResponse<TypeConfig>, StreamingError<TypeConfig>>
async fn full_snapshot( &mut self, vote: <TypeConfig as RaftTypeConfig>::Vote, snapshot: Snapshot<TypeConfig>, _cancel: impl Future<Output = ReplicationClosed> + OptionalSend + 'static, _option: RPCOption, ) -> Result<SnapshotResponse<TypeConfig>, StreamingError<TypeConfig>>
Send a complete Snapshot to the target. Read more
Source§impl NetStreamAppend<TypeConfig> for NetworkConnection
impl NetStreamAppend<TypeConfig> for NetworkConnection
Source§fn stream_append<'s, S>(
&'s mut self,
input: S,
_option: RPCOption,
) -> BoxFuture<'s, Result<BoxStream<'s, Result<StreamAppendResult<TypeConfig>, RPCError<TypeConfig, Infallible>>>, RPCError<TypeConfig, Infallible>>>
fn stream_append<'s, S>( &'s mut self, input: S, _option: RPCOption, ) -> BoxFuture<'s, Result<BoxStream<'s, Result<StreamAppendResult<TypeConfig>, RPCError<TypeConfig, Infallible>>>, RPCError<TypeConfig, Infallible>>>
Send a stream of AppendEntries RPCs to the target and return a stream of responses. Read more
Source§impl NetTransferLeader<TypeConfig> for NetworkConnection
impl NetTransferLeader<TypeConfig> for NetworkConnection
Source§async fn transfer_leader(
&mut self,
_req: TransferLeaderRequest<TypeConfig>,
_option: RPCOption,
) -> Result<(), RPCError<TypeConfig, Infallible>>
async fn transfer_leader( &mut self, _req: TransferLeaderRequest<TypeConfig>, _option: RPCOption, ) -> Result<(), RPCError<TypeConfig, Infallible>>
Send TransferLeader message to the target node. Read more
Source§impl NetVote<TypeConfig> for NetworkConnection
impl NetVote<TypeConfig> for NetworkConnection
Source§async fn vote(
&mut self,
req: VoteRequest<TypeConfig>,
_option: RPCOption,
) -> Result<VoteResponse<TypeConfig>, RPCError<TypeConfig, Infallible>>
async fn vote( &mut self, req: VoteRequest<TypeConfig>, _option: RPCOption, ) -> Result<VoteResponse<TypeConfig>, RPCError<TypeConfig, Infallible>>
Send a RequestVote RPC to the target.
Source§impl Ord for TypeConfig
impl Ord for TypeConfig
Source§fn cmp(&self, other: &TypeConfig) -> Ordering
fn cmp(&self, other: &TypeConfig) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for TypeConfig
impl PartialEq for TypeConfig
Source§impl PartialOrd for TypeConfig
impl PartialOrd for TypeConfig
Source§impl RaftEntry<TypeConfig> for Entry
impl RaftEntry<TypeConfig> for Entry
Source§fn new(log_id: LogIdOf<TypeConfig>, payload: EntryPayload<TypeConfig>) -> Self
fn new(log_id: LogIdOf<TypeConfig>, payload: EntryPayload<TypeConfig>) -> Self
Create a new log entry with log id and payload of application data or membership config. Read more
Source§fn log_id_parts(&self) -> (&u64, u64)
fn log_id_parts(&self) -> (&u64, u64)
Returns references to the components of this entry’s log ID: the committed leader ID and
index. Read more
Source§fn set_log_id(&mut self, new: LogIdOf<TypeConfig>)
fn set_log_id(&mut self, new: LogIdOf<TypeConfig>)
Set the log ID of this entry. Read more
Source§fn new_blank(log_id: LogId<C>) -> Selfwhere
Self: Sized + Final,
fn new_blank(log_id: LogId<C>) -> Selfwhere
Self: Sized + Final,
Create a new blank log entry. Read more
Source§fn new_normal(log_id: LogId<C>, data: <C as RaftTypeConfig>::D) -> Selfwhere
Self: Sized + Final,
fn new_normal(log_id: LogId<C>, data: <C as RaftTypeConfig>::D) -> Selfwhere
Self: Sized + Final,
Create a new normal log entry that contains application data. Read more
Source§fn new_membership(log_id: LogId<C>, m: Membership<C>) -> Selfwhere
Self: Sized + Final,
fn new_membership(log_id: LogId<C>, m: Membership<C>) -> Selfwhere
Self: Sized + Final,
Create a new membership log entry. Read more
Source§impl RaftLeaderId<TypeConfig> for LeaderId
impl RaftLeaderId<TypeConfig> for LeaderId
Source§fn to_committed(&self) -> Self::Committed
fn to_committed(&self) -> Self::Committed
Convert this leader ID to a committed leader ID. Read more
Source§impl RaftNetworkFactory<TypeConfig> for Network
Implementation of the RaftNetworkFactory trait for creating new network
connections. This factory creates gRPC client connections to other Raft
nodes.
impl RaftNetworkFactory<TypeConfig> for Network
Implementation of the RaftNetworkFactory trait for creating new network connections. This factory creates gRPC client connections to other Raft nodes.
Source§type Network = NetworkConnection
type Network = NetworkConnection
Actual type of the network handling a single connection.
Source§async fn new_client(
&mut self,
_: u64,
node: &<TypeConfig as RaftTypeConfig>::Node,
) -> Self::Network
async fn new_client( &mut self, _: u64, node: &<TypeConfig as RaftTypeConfig>::Node, ) -> Self::Network
Create a new network instance sending RPCs to the target node. Read more
Source§impl RaftPayload<TypeConfig> for Entry
impl RaftPayload<TypeConfig> for Entry
Source§fn get_membership(&self) -> Option<Membership<TypeConfig>>
fn get_membership(&self) -> Option<Membership<TypeConfig>>
Return
Some(Membership) if the entry payload contains a membership payload.Source§impl RaftSnapshotBuilder<TypeConfig> for Arc<FjallStateMachine>
impl RaftSnapshotBuilder<TypeConfig> for Arc<FjallStateMachine>
Source§async fn build_snapshot(&mut self) -> Result<Snapshot<TypeConfig>, Error>
async fn build_snapshot(&mut self) -> Result<Snapshot<TypeConfig>, Error>
Build snapshot Read more
Source§impl RaftStateMachine<TypeConfig> for Arc<FjallStateMachine>
impl RaftStateMachine<TypeConfig> for Arc<FjallStateMachine>
Source§type SnapshotBuilder = Arc<FjallStateMachine>
type SnapshotBuilder = Arc<FjallStateMachine>
Snapshot builder type.
Source§async fn applied_state(
&mut self,
) -> Result<(Option<LogIdOf<TypeConfig>>, StoredMembership<TypeConfig>), Error>
async fn applied_state( &mut self, ) -> Result<(Option<LogIdOf<TypeConfig>>, StoredMembership<TypeConfig>), Error>
Returns the last applied log id which is recorded in state machine, and the last applied
membership config. Read more
Source§async fn get_snapshot_builder(&mut self) -> Self::SnapshotBuilder
async fn get_snapshot_builder(&mut self) -> Self::SnapshotBuilder
Get the snapshot builder for the state machine. Read more
Source§async fn begin_receiving_snapshot(
&mut self,
) -> Result<SnapshotDataOf<TypeConfig>, Error>
async fn begin_receiving_snapshot( &mut self, ) -> Result<SnapshotDataOf<TypeConfig>, Error>
Create a new blank snapshot, returning a writable handle to the snapshot object. Read more
Source§async fn install_snapshot(
&mut self,
meta: &SnapshotMeta<TypeConfig>,
snapshot: SnapshotDataOf<TypeConfig>,
) -> Result<(), Error>
async fn install_snapshot( &mut self, meta: &SnapshotMeta<TypeConfig>, snapshot: SnapshotDataOf<TypeConfig>, ) -> Result<(), Error>
Install a snapshot which has finished streaming from the leader. Read more
Source§async fn get_current_snapshot(
&mut self,
) -> Result<Option<Snapshot<TypeConfig>>, Error>
async fn get_current_snapshot( &mut self, ) -> Result<Option<Snapshot<TypeConfig>>, Error>
Get a readable handle to the current snapshot. Read more
Source§async fn apply<Strm>(&mut self, entries: Strm) -> Result<(), Error>
async fn apply<Strm>(&mut self, entries: Strm) -> Result<(), Error>
Apply the given payload of entries to the state machine. Read more
Source§fn try_create_snapshot_builder(
&mut self,
force: bool,
) -> impl Future<Output = Option<Self::SnapshotBuilder>> + Send
fn try_create_snapshot_builder( &mut self, force: bool, ) -> impl Future<Output = Option<Self::SnapshotBuilder>> + Send
Try to create a snapshot builder for the state machine. Read more
Source§impl RaftTypeConfig for TypeConfig
impl RaftTypeConfig for TypeConfig
Source§type D = SetRequest
type D = SetRequest
Application-specific request data passed to the state machine.
Source§type SnapshotData = Vec<u8>
type SnapshotData = Vec<u8>
Snapshot data for exposing a snapshot for reading & writing. Read more
Source§type Responder<T> = ProgressResponder<TypeConfig, T>
where
T: OptionalSend + 'static
type Responder<T> = ProgressResponder<TypeConfig, T> where T: OptionalSend + 'static
Responder type for sending client write responses asynchronously. Read more
Source§type AsyncRuntime = TokioRuntime
type AsyncRuntime = TokioRuntime
Asynchronous runtime type.
Source§type ErrorSource = BoxedErrorSource
type ErrorSource = BoxedErrorSource
Error wrapper type for storage and network errors. Read more
Source§impl RaftVote<TypeConfig> for Vote
impl RaftVote<TypeConfig> for Vote
Source§fn from_leader_id(
leader_id: <TypeConfig as RaftTypeConfig>::LeaderId,
committed: bool,
) -> Self
fn from_leader_id( leader_id: <TypeConfig as RaftTypeConfig>::LeaderId, committed: bool, ) -> Self
Create a new vote for the specified leader with optional quorum commitment. Read more
Source§fn leader_id(&self) -> &<TypeConfig as RaftTypeConfig>::LeaderId
fn leader_id(&self) -> &<TypeConfig as RaftTypeConfig>::LeaderId
Get a reference to this vote’s LeaderId(
RaftLeaderId implementation). Read moreSource§fn is_committed(&self) -> bool
fn is_committed(&self) -> bool
Whether this vote has been committed by a quorum. Read more
impl Copy for TypeConfig
impl Eq for TypeConfig
impl StructuralPartialEq for TypeConfig
Auto Trait Implementations§
impl Freeze for TypeConfig
impl RefUnwindSafe for TypeConfig
impl Send for TypeConfig
impl Sync for TypeConfig
impl Unpin for TypeConfig
impl UnsafeUnpin for TypeConfig
impl UnwindSafe for TypeConfig
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> TypeConfigExt for Twhere
T: RaftTypeConfig,
impl<T> TypeConfigExt for Twhere
T: RaftTypeConfig,
Source§fn now() -> <Self::AsyncRuntime as AsyncRuntime>::Instant
fn now() -> <Self::AsyncRuntime as AsyncRuntime>::Instant
Returns the current time.
Source§fn sleep(duration: Duration) -> <Self::AsyncRuntime as AsyncRuntime>::Sleep
fn sleep(duration: Duration) -> <Self::AsyncRuntime as AsyncRuntime>::Sleep
Wait until
duration has elapsed.Source§fn yield_now() -> <Self::AsyncRuntime as AsyncRuntime>::Sleep
fn yield_now() -> <Self::AsyncRuntime as AsyncRuntime>::Sleep
Yield control back to the async runtime, allowing other tasks to run. Read more
Source§fn sleep_until(
deadline: <Self::AsyncRuntime as AsyncRuntime>::Instant,
) -> <Self::AsyncRuntime as AsyncRuntime>::Sleep
fn sleep_until( deadline: <Self::AsyncRuntime as AsyncRuntime>::Instant, ) -> <Self::AsyncRuntime as AsyncRuntime>::Sleep
Wait until
deadline is reached.Source§fn timeout<R, F>(
duration: Duration,
future: F,
) -> <Self::AsyncRuntime as AsyncRuntime>::Timeout<R, F>where
F: Future<Output = R> + OptionalSend,
fn timeout<R, F>(
duration: Duration,
future: F,
) -> <Self::AsyncRuntime as AsyncRuntime>::Timeout<R, F>where
F: Future<Output = R> + OptionalSend,
Require a
Future to complete before the specified duration has elapsed.Source§fn timeout_at<R, F>(
deadline: <Self::AsyncRuntime as AsyncRuntime>::Instant,
future: F,
) -> <Self::AsyncRuntime as AsyncRuntime>::Timeout<R, F>where
F: Future<Output = R> + OptionalSend,
fn timeout_at<R, F>(
deadline: <Self::AsyncRuntime as AsyncRuntime>::Instant,
future: F,
) -> <Self::AsyncRuntime as AsyncRuntime>::Timeout<R, F>where
F: Future<Output = R> + OptionalSend,
Require a
Future to complete before the specified instant in time.Source§fn oneshot<T>() -> (<<Self::AsyncRuntime as AsyncRuntime>::Oneshot as Oneshot>::Sender<T>, <<Self::AsyncRuntime as AsyncRuntime>::Oneshot as Oneshot>::Receiver<T>)where
T: OptionalSend,
fn oneshot<T>() -> (<<Self::AsyncRuntime as AsyncRuntime>::Oneshot as Oneshot>::Sender<T>, <<Self::AsyncRuntime as AsyncRuntime>::Oneshot as Oneshot>::Receiver<T>)where
T: OptionalSend,
Creates a new one-shot channel for sending single values. Read more
Source§fn mpsc<T>(
buffer: usize,
) -> (<<Self::AsyncRuntime as AsyncRuntime>::Mpsc as Mpsc>::Sender<T>, <<Self::AsyncRuntime as AsyncRuntime>::Mpsc as Mpsc>::Receiver<T>)where
T: OptionalSend,
fn mpsc<T>(
buffer: usize,
) -> (<<Self::AsyncRuntime as AsyncRuntime>::Mpsc as Mpsc>::Sender<T>, <<Self::AsyncRuntime as AsyncRuntime>::Mpsc as Mpsc>::Receiver<T>)where
T: OptionalSend,
Creates a mpsc channel for communicating between asynchronous
tasks with backpressure. Read more
Source§fn mpsc_to_stream<T>(
rx: <<Self::AsyncRuntime as AsyncRuntime>::Mpsc as Mpsc>::Receiver<T>,
) -> impl Stream<Item = T>where
T: OptionalSend,
fn mpsc_to_stream<T>(
rx: <<Self::AsyncRuntime as AsyncRuntime>::Mpsc as Mpsc>::Receiver<T>,
) -> impl Stream<Item = T>where
T: OptionalSend,
Source§fn watch_channel<T>(
init: T,
) -> (<<Self::AsyncRuntime as AsyncRuntime>::Watch as Watch>::Sender<T>, <<Self::AsyncRuntime as AsyncRuntime>::Watch as Watch>::Receiver<T>)where
T: OptionalSend + OptionalSync,
fn watch_channel<T>(
init: T,
) -> (<<Self::AsyncRuntime as AsyncRuntime>::Watch as Watch>::Sender<T>, <<Self::AsyncRuntime as AsyncRuntime>::Watch as Watch>::Receiver<T>)where
T: OptionalSend + OptionalSync,
Creates a watch channel for watching for changes to a value from multiple
points in the code base. Read more
Source§fn mutex<T>(value: T) -> <Self::AsyncRuntime as AsyncRuntime>::Mutex<T>where
T: OptionalSend,
fn mutex<T>(value: T) -> <Self::AsyncRuntime as AsyncRuntime>::Mutex<T>where
T: OptionalSend,
Creates a Mutex lock. Read more
Source§fn spawn<T>(
future: T,
) -> <Self::AsyncRuntime as AsyncRuntime>::JoinHandle<<T as Future>::Output>
fn spawn<T>( future: T, ) -> <Self::AsyncRuntime as AsyncRuntime>::JoinHandle<<T as Future>::Output>
Spawn a new task.
Source§fn run<F, T>(future: F) -> Twhere
F: Future<Output = T>,
T: OptionalSend,
fn run<F, T>(future: F) -> Twhere
F: Future<Output = T>,
T: OptionalSend,
Create a runtime and run the given future to completion. Read more
Source§fn spawn_blocking<F, T>(f: F) -> impl Future<Output = Result<T, Error>> + Send
fn spawn_blocking<F, T>(f: F) -> impl Future<Output = Result<T, Error>> + Send
Run a blocking function on a separate thread. Read more
Source§fn err_from_string(msg: impl ToString) -> Self::ErrorSource
fn err_from_string(msg: impl ToString) -> Self::ErrorSource
Create an error source from a string message. Read more
Source§fn err_from_error<E>(e: &E) -> Self::ErrorSourcewhere
E: Error + 'static,
fn err_from_error<E>(e: &E) -> Self::ErrorSourcewhere
E: Error + 'static,
Create an error source from an error reference. Read more