Expand description
The Node
implementation that’s returned from
NodeBuilder
s.
This Node
implementation processes requests from NodeHandle
s. It
delegates to the outermost Decoration
,
thus giving decorations a chance to intercept.
Implementations
sourceimpl<N: NodeImpl> Shell<N, Unsendable>
impl<N: NodeImpl> Shell<N, Unsendable>
sourceimpl<N: NodeImpl> Shell<N, Sendable>
impl<N: NodeImpl> Shell<N, Sendable>
sourcepub fn enter<F, R>(&mut self, f: F) -> Rwhere
F: for<'a> FnOnce(&'a mut EnteredShellRef<'a, N>) -> R,
pub fn enter<F, R>(&mut self, f: F) -> Rwhere
F: for<'a> FnOnce(&'a mut EnteredShellRef<'a, N>) -> R,
Evaluates f
, providing access to the full Node
API through the
argument passed to f
.
sourcepub fn enter_on_poll<'a, F, R>(&'a mut self, f: F) -> EnterOnPoll<'a, R> ⓘwhere
F: FnOnce(&'a mut EnteredShell<N>) -> R,
R: 'a,
pub fn enter_on_poll<'a, F, R>(&'a mut self, f: F) -> EnterOnPoll<'a, R> ⓘwhere
F: FnOnce(&'a mut EnteredShell<N>) -> R,
R: 'a,
Returns a wrapper around the future or stream returned by f
that
calls enter
when polled.
sourcepub fn into_enter_on_poll<F, R>(self, f: F) -> EnterOnPollOwned<R> ⓘwhere
F: FnOnce(EnteredShell<N>) -> R,
pub fn into_enter_on_poll<F, R>(self, f: F) -> EnterOnPollOwned<R> ⓘwhere
F: FnOnce(EnteredShell<N>) -> R,
Returns a wrapper around the future or stream returned by f
that
calls enter
when polled.
sourcepub fn into_unsend(self) -> Shell<N, Unsendable>
pub fn into_unsend(self) -> Shell<N, Unsendable>
Turns this node into an unsendable one.
An unsendable node is easier to use but is !Send
.
sourcepub fn status(&self) -> NodeStatus
pub fn status(&self) -> NodeStatus
Node’s current status.
sourcepub fn participation(&self) -> Participation<RoundNumOf<N>>
pub fn participation(&self) -> Participation<RoundNumOf<N>>
Node’s current mode of participation.
sourcepub fn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<N>>
pub fn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<N>>
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.
sourcepub fn next_event(&mut self) -> impl Future<Output = Event<N::Invocation>> + '_
pub fn next_event(&mut self) -> impl Future<Output = Event<N::Invocation>> + '_
Returns a future that polls this node for events until the next one is returned.
sourcepub fn events(&mut self) -> impl Stream<Item = Event<N::Invocation>> + '_
pub fn events(&mut self) -> impl Stream<Item = Event<N::Invocation>> + '_
Returns a stream that polls this node for events.
sourcepub fn handle(&self) -> NodeHandle<N::Invocation>
pub fn handle(&self) -> NodeHandle<N::Invocation>
Returns a handle for this node.
A node handle can be freely sent between threads.
sourcepub fn shut_down(self) -> ShutdownOf<N>
pub fn shut_down(self) -> ShutdownOf<N>
Begins a graceful shutdown of this node.
Trait Implementations
sourceimpl<N, I> LeadershipAwareNode<(I,)> for Shell<N, Unsendable>where
N: NodeImpl + LeadershipAwareNode<I>,
impl<N, I> LeadershipAwareNode<(I,)> for Shell<N, Unsendable>where
N: NodeImpl + LeadershipAwareNode<I>,
sourcefn lax_leadership(&self) -> &[LeadershipFor<N>]
fn lax_leadership(&self) -> &[LeadershipFor<N>]
sourcefn strict_leadership(&self) -> &[LeadershipFor<N>]
fn strict_leadership(&self) -> &[LeadershipFor<N>]
sourceimpl<N> Node for Shell<N, Unsendable>where
N: NodeImpl,
impl<N> Node for Shell<N, Unsendable>where
N: NodeImpl,
type Invocation = <N as Node>::Invocation
type Invocation = <N as Node>::Invocation
sourcefn status(&self) -> NodeStatus
fn status(&self) -> NodeStatus
sourcefn participation(&self) -> Participation<RoundNumOf<Self>>
fn participation(&self) -> Participation<RoundNumOf<Self>>
sourcefn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<Self>>
fn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<Self>>
sourcefn handle(&self) -> NodeHandle<Self::Invocation>
fn handle(&self) -> NodeHandle<Self::Invocation>
sourcefn prepare_snapshot(&self) -> BoxFuture<'static, SnapshotFor<Self>>
fn prepare_snapshot(&self) -> BoxFuture<'static, SnapshotFor<Self>>
sourcefn affirm_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> BoxFuture<'static, Result<(), AffirmSnapshotError>>
fn affirm_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> BoxFuture<'static, Result<(), AffirmSnapshotError>>
sourcefn install_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> BoxFuture<'static, Result<(), InstallSnapshotError>>
fn install_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> BoxFuture<'static, Result<(), InstallSnapshotError>>
sourcefn read_stale<F, T>(&self, f: F) -> BoxFuture<'_, Result<T, Disoriented>>where
F: FnOnce(&StateOf<Self>) -> T + Send + 'static,
T: Send + 'static,
fn read_stale<F, T>(&self, f: F) -> BoxFuture<'_, Result<T, Disoriented>>where
F: FnOnce(&StateOf<Self>) -> T + Send + 'static,
T: Send + 'static,
sourcefn read_stale_infallibly<F, T>(&self, f: F) -> BoxFuture<'_, T>where
F: FnOnce(Option<&StateOf<Self>>) -> T + Send + 'static,
T: Send + 'static,
fn read_stale_infallibly<F, T>(&self, f: F) -> BoxFuture<'_, T>where
F: FnOnce(Option<&StateOf<Self>>) -> T + Send + 'static,
T: Send + 'static,
sourcefn read_stale_scoped<'read, F, T>(
&self,
f: F
) -> BoxFuture<'read, Result<T, Disoriented>>where
F: FnOnce(&StateOf<Self>) -> T + Send + 'read,
T: Send + 'static,
fn read_stale_scoped<'read, F, T>(
&self,
f: F
) -> BoxFuture<'read, Result<T, Disoriented>>where
F: FnOnce(&StateOf<Self>) -> T + Send + 'read,
T: Send + 'static,
sourcefn read_stale_scoped_infallibly<'read, F, T>(&self, f: F) -> BoxFuture<'read, T>where
F: FnOnce(Option<&StateOf<Self>>) -> T + Send + 'read,
T: Send + 'static,
fn read_stale_scoped_infallibly<'read, F, T>(&self, f: F) -> BoxFuture<'read, T>where
F: FnOnce(Option<&StateOf<Self>>) -> T + Send + 'read,
T: Send + 'static,
sourcefn append<A, P, R>(
&mut self,
applicable: A,
args: P
) -> BoxFuture<'static, AppendResultFor<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<A, P, R>(
&mut self,
applicable: A,
args: P
) -> BoxFuture<'static, AppendResultFor<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>>,
applicable
to the shared log.