pub struct PayloadTooLarge { /* private fields */ }Expand description
Error indicating that an RPC is too large and cannot be sent.
This is a retryable error:
A RaftNetwork implementation returns this error to inform Openraft to divide an
AppendEntriesRequest into smaller chunks.
Openraft will immediately retry sending in smaller chunks.
If the request cannot be divided(contains only one entry), Openraft interprets it as
Unreachable.
A hint can be provided to help Openraft in splitting the request.
The application should also set an appropriate value for Config::max_payload_entries to
avoid returning this error if possible.
Example:
impl<C: RaftTypeConfig> RaftNetwork<C> for MyNetwork {
fn append_entries(&self,
rpc: AppendEntriesRequest<C>,
option: RPCOption
) -> Result<_, RPCError<C::NodeId, C::Node, RaftError<C::NodeId>>> {
if rpc.entries.len() > 10 {
return Err(PayloadTooLarge::new_entries_hint(10).into());
}
// ...
}
}Implementations§
Source§impl PayloadTooLarge
impl PayloadTooLarge
Sourcepub fn new_entries_hint(entries_hint: u64) -> PayloadTooLarge
pub fn new_entries_hint(entries_hint: u64) -> PayloadTooLarge
Create a new PayloadTooLarge, with entries hint, without the causing error.
Sourcepub fn with_source_error(self, e: &(impl Error + 'static)) -> PayloadTooLarge
pub fn with_source_error(self, e: &(impl Error + 'static)) -> PayloadTooLarge
Set the source error that causes this PayloadTooLarge error.
pub fn action(&self) -> RPCTypes
Sourcepub fn entries_hint(&self) -> u64
pub fn entries_hint(&self) -> u64
Get the hint for entries number.
Trait Implementations§
Source§impl Clone for PayloadTooLarge
impl Clone for PayloadTooLarge
Source§fn clone(&self) -> PayloadTooLarge
fn clone(&self) -> PayloadTooLarge
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PayloadTooLarge
impl Debug for PayloadTooLarge
Source§impl<'de> Deserialize<'de> for PayloadTooLarge
impl<'de> Deserialize<'de> for PayloadTooLarge
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PayloadTooLarge, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PayloadTooLarge, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for PayloadTooLarge
impl Display for PayloadTooLarge
impl Eq for PayloadTooLarge
Source§impl Error for PayloadTooLarge
impl Error for PayloadTooLarge
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl<NID, N, E> From<PayloadTooLarge> for RPCError<NID, N, E>
impl<NID, N, E> From<PayloadTooLarge> for RPCError<NID, N, E>
Source§fn from(source: PayloadTooLarge) -> RPCError<NID, N, E>
fn from(source: PayloadTooLarge) -> RPCError<NID, N, E>
Source§impl PartialEq for PayloadTooLarge
impl PartialEq for PayloadTooLarge
Source§fn eq(&self, other: &PayloadTooLarge) -> bool
fn eq(&self, other: &PayloadTooLarge) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PayloadTooLarge
impl Serialize for PayloadTooLarge
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for PayloadTooLarge
Auto Trait Implementations§
impl Freeze for PayloadTooLarge
impl RefUnwindSafe for PayloadTooLarge
impl Send for PayloadTooLarge
impl Sync for PayloadTooLarge
impl Unpin for PayloadTooLarge
impl UnsafeUnpin for PayloadTooLarge
impl UnwindSafe for PayloadTooLarge
Blanket Implementations§
impl<T> AppData for Twhere
T: OptionalSend + OptionalSync + 'static + OptionalSerde,
impl<T> AppDataResponse for Twhere
T: OptionalSend + OptionalSync + 'static + OptionalSerde,
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
key and return true if they are equal.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