pub trait Node: Sized {
type Invocation: Invocation;
type Shutdown: Shutdown<Invocation = Self::Invocation>;
Show 13 methods
fn id(&self) -> NodeIdOf<Self>;
fn status(&self) -> NodeStatus;
fn participation(&self) -> Participation<RoundNumOf<Self>>;
fn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<Self>>;
fn handle(&self) -> NodeHandle<Self::Invocation>;
fn prepare_snapshot(&self) -> LocalBoxFuture<'static, SnapshotFor<Self>>;
fn affirm_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), AffirmSnapshotError>>;
fn install_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), InstallSnapshotError>>;
fn read_stale<F, T>(
&self,
f: F
) -> LocalBoxFuture<'_, Result<T, Disoriented>>
where
F: FnOnce(&StateOf<Self>) -> T + Send + 'static,
T: Send + 'static;
fn append<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'_, AppendResultFor<Self, A, R>>
where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>;
fn append_static<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'static, StaticAppendResultFor<Self, A, R>>
where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
R::StaticError: From<ShutDownOr<R::Error>>;
fn shut_down(self) -> Self::Shutdown;
fn next_event(&mut self) -> NextEvent<'_, Self>ⓘNotable traits for NextEvent<'a, N>impl<'a, N> Future for NextEvent<'a, N> where
N: Node, type Output = EventFor<N>;
{ ... }
}
Expand description
Node that participates in a cluster.
Required Associated Types
type Invocation: Invocation
type Invocation: Invocation
Parametrization of the paxakos algorithm.
type Shutdown: Shutdown<Invocation = Self::Invocation>
type Shutdown: Shutdown<Invocation = Self::Invocation>
Type that will perform graceful shutdown if requsted.
Required Methods
fn status(&self) -> NodeStatus
fn status(&self) -> NodeStatus
Node’s current status.
fn participation(&self) -> Participation<RoundNumOf<Self>>
fn participation(&self) -> Participation<RoundNumOf<Self>>
Node’s current mode of participation.
fn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<Self>>
fn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<Self>>
Polls the node’s event stream.
It is important to poll the node’s event stream because it implicitly drives the actions that keep the node up to date.
fn handle(&self) -> NodeHandle<Self::Invocation>
fn handle(&self) -> NodeHandle<Self::Invocation>
Returns a handle for this node.
A node handle can be freely sent between threads.
fn prepare_snapshot(&self) -> LocalBoxFuture<'static, SnapshotFor<Self>>
fn prepare_snapshot(&self) -> LocalBoxFuture<'static, SnapshotFor<Self>>
Requests that snapshot of the node’s current state be taken.
fn affirm_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), AffirmSnapshotError>>
fn affirm_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), AffirmSnapshotError>>
Affirms that the given snapshot was written to persistent storage.
Currently does nothing.
fn install_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), InstallSnapshotError>>
fn install_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), InstallSnapshotError>>
Requests that the given snapshot be installed.
The node will retain its current set of promises and preserve its mode of participation.
fn read_stale<F, T>(&self, f: F) -> LocalBoxFuture<'_, Result<T, Disoriented>> where
F: FnOnce(&StateOf<Self>) -> T + Send + 'static,
T: Send + 'static,
fn read_stale<F, T>(&self, f: F) -> LocalBoxFuture<'_, Result<T, Disoriented>> where
F: FnOnce(&StateOf<Self>) -> T + Send + 'static,
T: Send + 'static,
Reads the node’s current state.
As the name implies the state may be stale, i.e. other node’s may have advanced the shared state without this node being aware.
fn append<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'_, AppendResultFor<Self, A, R>> where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
fn append<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'_, AppendResultFor<Self, A, R>> where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
Appends applicable
to the shared log.
fn append_static<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'static, StaticAppendResultFor<Self, A, R>> where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
R::StaticError: From<ShutDownOr<R::Error>>,
fn append_static<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'static, StaticAppendResultFor<Self, A, R>> where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
R::StaticError: From<ShutDownOr<R::Error>>,
Appends applicable
to the shared log.