#[non_exhaustive]pub enum UploadError {
Show 15 variants
HeaderMissing {
stream_empty: bool,
},
UnexpectedMessage {
header: bool,
},
BadPackId {
chunk: bool,
len: Option<usize>,
},
PackIdMismatch,
TotalMissing,
TotalTooLarge {
total: u64,
cap: u64,
},
TooManyChunks,
OffsetMissing,
OffsetGap {
offset: u64,
expected: u64,
},
ByteCountOverflow,
Overrun,
AfterLast,
NoLast,
LengthMismatch {
received: u64,
declared: u64,
},
DigestMismatch,
}Expand description
Why an upload stream was rejected.
The stream-shape variants (Self::HeaderMissing,
Self::UnexpectedMessage) and Self::DigestMismatch are raised by
the binding, which decodes messages and owns the sink; the validator
raises every other variant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
HeaderMissing
The stream did not start with a header. stream_empty when it ended
before any message.
UnexpectedMessage
A message after the header was not a chunk. header when it was a
second header, otherwise a message with no body.
BadPackId
A pack_id that is absent (len: None) or not 32 bytes long.
chunk when it was a chunk’s rather than the header’s.
PackIdMismatch
A chunk’s pack_id differs from the header’s.
TotalMissing
The header has no total_bytes.
TotalTooLarge
The declared total_bytes is over the binding’s cap.
TooManyChunks
More chunks than the binding’s cap arrived without last.
OffsetMissing
A chunk has no offset.
OffsetGap
A chunk’s offset is not the running byte count.
ByteCountOverflow
The running byte count overflowed u64.
Overrun
The chunks carry more bytes than the header declared.
AfterLast
A chunk arrived after the last one.
NoLast
The stream ended without a last chunk.
LengthMismatch
The last chunk arrived before the declared byte count.
DigestMismatch
The received bytes do not hash to the header’s pack_id.
Implementations§
Source§impl UploadError
impl UploadError
Sourcepub const fn code(self) -> Code
pub const fn code(self) -> Code
The Connect-side code: Code::ResourceExhausted for an oversized
declared total, Code::InvalidArgument for everything else.
Sourcepub const fn ssh_message(self) -> &'static str
pub const fn ssh_message(self) -> &'static str
mkit serve’s message, verbatim. Every one is sent with
ERROR_CODE_INVALID_REQUEST; the ssh binding maps codes itself.
Sourcepub fn connect_message(self) -> Cow<'static, str>
pub fn connect_message(self) -> Cow<'static, str>
mkit-transport-connect’s message, verbatim. TotalMissing,
OffsetMissing, TooManyChunks and AfterLast are new: that server
reads an absent total_bytes or offset as 0, has no chunk cap and
stops reading at last.
Trait Implementations§
Source§impl Clone for UploadError
impl Clone for UploadError
impl Copy for UploadError
Source§impl Debug for UploadError
impl Debug for UploadError
impl Eq for UploadError
Source§impl From<UploadError> for ServerError
impl From<UploadError> for ServerError
Source§fn from(err: UploadError) -> Self
fn from(err: UploadError) -> Self
The Connect code and message.