pub struct RPCOption { /* private fields */ }Expand description
An additional argument to the RaftNetwork methods to allow applications to customize
networking behaviors.
Implementations§
Source§impl RPCOption
impl RPCOption
pub fn new(hard_ttl: Duration) -> RPCOption
Sourcepub fn soft_ttl(&self) -> Duration
pub fn soft_ttl(&self) -> Duration
The moderate max interval an RPC should last for.
The hard_ttl() and soft_ttl() of RPCOption sets the hard limit and the moderate
limit of the duration for which an RPC should run. Once the soft_ttl() ends, the RPC
implementation should start to gracefully cancel the RPC, and once the hard_ttl() ends,
Openraft will terminate the ongoing RPC at once.
soft_ttl is smaller than hard_ttl() so that the RPC implementation can cancel the RPC
gracefully after soft_ttl and before hard_ttl.
soft_ttl is 3/4 of hard_ttl but it may change in future, do not rely on this ratio.
Sourcepub fn hard_ttl(&self) -> Duration
pub fn hard_ttl(&self) -> Duration
The hard limit of the interval an RPC should last for.
When exceeding this limit, the RPC will be dropped by Openraft at once.
Sourcepub fn snapshot_chunk_size(&self) -> Option<usize>
pub fn snapshot_chunk_size(&self) -> Option<usize>
Get the recommended size of the snapshot chunk for transport.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RPCOption
impl RefUnwindSafe for RPCOption
impl Send for RPCOption
impl Sync for RPCOption
impl Unpin for RPCOption
impl UnsafeUnpin for RPCOption
impl UnwindSafe for RPCOption
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
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more