Skip to main content

TypeConfig

Struct TypeConfig 

Source
pub struct TypeConfig {}
Expand description

Declare the type configuration for example K/V store.

Trait Implementations§

Source§

impl Clone for TypeConfig

Source§

fn clone(&self) -> TypeConfig

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 Debug for TypeConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TypeConfig

Source§

fn default() -> TypeConfig

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

impl NetBackoff<TypeConfig> for NetworkConnection

Source§

fn backoff(&self) -> Backoff

Build a backoff instance if the target node is temporarily(or permanently) unreachable. Read more
Source§

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>>

Send a complete Snapshot to the target. Read more
Source§

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>>>
where S: Stream<Item = AppendEntriesRequest<TypeConfig>> + OptionalSend + Unpin + 'static,

Send a stream of AppendEntries RPCs to the target and return a stream of responses. Read more
Source§

impl NetTransferLeader<TypeConfig> for NetworkConnection

Source§

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

Source§

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

Source§

fn cmp(&self, other: &TypeConfig) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for TypeConfig

Source§

fn eq(&self, other: &TypeConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for TypeConfig

Source§

fn partial_cmp(&self, other: &TypeConfig) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl RaftEntry<TypeConfig> for Entry

Source§

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)

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>)

Set the log ID of this entry. Read more
Source§

fn new_blank(log_id: LogId<C>) -> Self
where Self: Sized + Final,

Create a new blank log entry. Read more
Source§

fn new_normal(log_id: LogId<C>, data: <C as RaftTypeConfig>::D) -> Self
where 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>) -> Self
where Self: Sized + Final,

Create a new membership log entry. Read more
Source§

fn log_id(&self) -> LogId<C>
where Self: Final,

Returns the LogId of this entry. Read more
Source§

fn index(&self) -> u64
where Self: Final,

Returns the index of this log entry. Read more
Source§

impl RaftLeaderId<TypeConfig> for LeaderId

Source§

type Committed = u64

The committed version of this leader ID. Read more
Source§

fn new(term: u64, node_id: u64) -> Self

Create a new leader ID for the given term and node.
Source§

fn term(&self) -> u64

Get the term number of this leader
Source§

fn node_id(&self) -> &u64

Get the node ID of this leader
Source§

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.

Source§

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

Create a new network instance sending RPCs to the target node. Read more
Source§

impl RaftPayload<TypeConfig> for Entry

Source§

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>

Source§

async fn build_snapshot(&mut self) -> Result<Snapshot<TypeConfig>, Error>

Build snapshot Read more
Source§

impl RaftStateMachine<TypeConfig> for Arc<FjallStateMachine>

Source§

type SnapshotBuilder = Arc<FjallStateMachine>

Snapshot builder type.
Source§

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

Get the snapshot builder for the state machine. Read more
Source§

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>

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>

Get a readable handle to the current snapshot. Read more
Source§

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

Try to create a snapshot builder for the state machine. Read more
Source§

impl RaftTypeConfig for TypeConfig

Source§

type D = SetRequest

Application-specific request data passed to the state machine.
Source§

type R = Response

Application-specific response data returned by the state machine.
Source§

type LeaderId = LeaderId

A Leader identifier in a cluster.
Source§

type Vote = Vote

Raft vote type. Read more
Source§

type Entry = Entry

Raft log entry, which can be built from an AppData.
Source§

type Node = Node

Raft application level node data
Source§

type SnapshotData = Vec<u8>

Snapshot data for exposing a snapshot for reading & writing. Read more
Source§

type NodeId = u64

A Raft node’s ID.
Source§

type Term = u64

Type representing a Raft term number. Read more
Source§

type Responder<T> = ProgressResponder<TypeConfig, T> where T: OptionalSend + 'static

Responder type for sending client write responses asynchronously. Read more
Source§

type AsyncRuntime = TokioRuntime

Asynchronous runtime type.
Source§

type ErrorSource = BoxedErrorSource

Error wrapper type for storage and network errors. Read more
Source§

impl RaftVote<TypeConfig> for Vote

Source§

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

Get a reference to this vote’s LeaderId(RaftLeaderId implementation). Read more
Source§

fn is_committed(&self) -> bool

Whether this vote has been committed by a quorum. Read more
Source§

fn to_owned_vote(&self) -> Vote<C>

Convert to the openraft-provided Vote struct. Read more
Source§

fn partial_cmp<V>(&self, other: &V) -> Option<Ordering>
where V: RaftVote<C>,

Compare this vote with another vote by partial order. Read more
Source§

impl Copy for TypeConfig

Source§

impl Eq for TypeConfig

Source§

impl StructuralPartialEq for TypeConfig

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> 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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<T> TypeConfigExt for T
where T: RaftTypeConfig,

Source§

fn now() -> <Self::AsyncRuntime as AsyncRuntime>::Instant

Returns the current time.
Source§

fn sleep(duration: Duration) -> <Self::AsyncRuntime as AsyncRuntime>::Sleep

Wait until duration has elapsed.
Source§

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

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,

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,

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,

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,

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,

Converts an mpsc receiver into a Stream. Read more
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>)

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,

Creates a Mutex lock. Read more
Source§

fn spawn<T>( future: T, ) -> <Self::AsyncRuntime as AsyncRuntime>::JoinHandle<<T as Future>::Output>
where T: Future + OptionalSend + 'static, <T as Future>::Output: OptionalSend + 'static,

Spawn a new task.
Source§

fn run<F, T>(future: F) -> T
where 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
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,

Run a blocking function on a separate thread. Read more
Source§

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::ErrorSource
where E: Error + 'static,

Create an error source from an error reference. Read more
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
Source§

impl<T> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,