#[non_exhaustive]pub enum ResultCode {
Show 22 variants
Ok,
Unsupported,
NotFound,
InvalidArgument,
TooLarge,
Conflict,
Stale,
VersionSkew,
Unauthenticated,
Backend,
Forbidden,
StepUpRequired,
Unavailable,
ResourceLimit,
Cancelled,
DeadlineExceeded,
ExpiredSnapshot,
StaleGeneration,
TargetUnavailable,
Pending,
PlaneUnavailable,
Unrecognized(u16),
}Expand description
One logical outcome code spanning query, key-value, fork, and browse. Built
from a surface’s typed error via the From impls below. The typed error
keeps the detail, this is the shared classification.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ok
The operation succeeded (no error to classify).
Unsupported
The operation, or the managed surface, is not available here.
NotFound
A named entity (index, fork, key) does not exist.
InvalidArgument
The request was malformed or a field was out of range.
TooLarge
A result or value exceeded a size cap.
Conflict
A precondition lost a race (a compare-and-swap version mismatch, a fork promote/squash conflict).
Stale
A consistency level could not be met within the deadline (the read model is still catching up).
VersionSkew
The wire op version is not accepted by this peer.
Unauthenticated
No credential, or an invalid one: the caller is not authenticated.
Backend
The managed backend failed or was unreachable.
Forbidden
Authenticated, but the grant needed for the operation is missing.
StepUpRequired
Authenticated, but the operation needs a stronger authentication (a step-up) than the caller currently holds.
The request could not be served right now, and the same request may
succeed on a later attempt: the store was momentarily out of reach, a
connection was refused or dropped, a concurrency conflict was aborted, or
a resource limit was hit. Distinct from Backend, which
is a fault the caller cannot retry away. This is the one code a generic
client may safely retry with backoff, so it never has to parse a message
to decide (see is_retryable).
ResourceLimit
The query exceeded a server-enforced resource budget.
Cancelled
The query was cancelled through its execution identity.
DeadlineExceeded
The query did not finish before its absolute deadline.
ExpiredSnapshot
The requested historical snapshot is no longer retained.
StaleGeneration
The requested destination or backend generation is no longer current.
The resolved target is not ready to serve queries.
Pending
The mutation was accepted into the log, but its outcome is not known yet. Only a retry with the same operation identity may follow: it returns the recorded outcome once the mutation has applied. A new identity could apply the change a second time.
The streaming server could not reach its own plane, or the plane did not answer in time. The request may still apply, so a mutation repeats only under the same operation identity, on this node or another one.
Unrecognized(u16)
A code from a newer peer this build does not name. Decodes and re-encodes
byte-for-byte so an old build relays it rather than failing. Only a value
outside the named range (21 and up) should ever appear here: from_code
never produces Unrecognized for 0..=20, which map to the named
variants.
Implementations§
Source§impl ResultCode
impl ResultCode
Sourcepub const fn code(self) -> u16
pub const fn code(self) -> u16
The pinned numeric code, stable across repos and language ports.
Sourcepub const fn from_code(code: u16) -> Self
pub const fn from_code(code: u16) -> Self
The code for a pinned numeric value, where an unknown value becomes
Unrecognized rather than an error.
Sourcepub const fn http_status(self) -> u16
pub const fn http_status(self) -> u16
The HTTP status this code maps to, the one mapping every surface shares, so a status need not be decided per surface or per route.
Sourcepub const fn is_retryable(self) -> bool
pub const fn is_retryable(self) -> bool
Whether a caller may retry the identical request and reasonably expect a
different outcome. True only for the two transient classes: the store was
momentarily unreachable, or the read model had not caught up yet. Every
other code needs the request, the credential, or the data to change first,
so retrying it unchanged only wastes the attempt. Pending
is not in this set: only the original operation identity may be
retried, see is_pending.
Sourcepub const fn is_pending(self) -> bool
pub const fn is_pending(self) -> bool
Whether the mutation was accepted and its outcome is still unknown. The caller repeats the exact request with the same operation identity.
Whether the streaming server could not reach its own plane, or the
plane did not answer in time. The request may still apply. A client
repeats a mutation under the same operation identity, and may send it
to another node. Unlike Unavailable, which a
busy node or an unreachable destination answers, this one names the
node itself as the problem.
Trait Implementations§
Source§impl Clone for ResultCode
impl Clone for ResultCode
impl Copy for ResultCode
Source§impl Debug for ResultCode
impl Debug for ResultCode
Source§impl<'de> Deserialize<'de> for ResultCode
impl<'de> Deserialize<'de> for ResultCode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ResultCode
Source§impl From<&AuthzError> for ResultCode
impl From<&AuthzError> for ResultCode
Source§fn from(error: &AuthzError) -> Self
fn from(error: &AuthzError) -> Self
Source§impl From<&CheckpointError> for ResultCode
impl From<&CheckpointError> for ResultCode
Source§fn from(error: &CheckpointError) -> Self
fn from(error: &CheckpointError) -> Self
Source§impl From<&ForkError> for ResultCode
impl From<&ForkError> for ResultCode
Source§impl From<&GraphError> for ResultCode
impl From<&GraphError> for ResultCode
Source§fn from(error: &GraphError) -> Self
fn from(error: &GraphError) -> Self
Source§impl From<&KvError> for ResultCode
impl From<&KvError> for ResultCode
Source§impl From<&QueryError> for ResultCode
impl From<&QueryError> for ResultCode
Source§fn from(error: &QueryError) -> Self
fn from(error: &QueryError) -> Self
Source§impl From<&SessionError> for ResultCode
impl From<&SessionError> for ResultCode
Source§fn from(error: &SessionError) -> Self
fn from(error: &SessionError) -> Self
Source§impl PartialEq for ResultCode
impl PartialEq for ResultCode
Source§impl Serialize for ResultCode
impl Serialize for ResultCode
impl StructuralPartialEq for ResultCode
Auto Trait Implementations§
impl Freeze for ResultCode
impl RefUnwindSafe for ResultCode
impl Send for ResultCode
impl Sync for ResultCode
impl Unpin for ResultCode
impl UnsafeUnpin for ResultCode
impl UnwindSafe for ResultCode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.