pub enum CodecError {
CodecMismatch {
expected: CodecKind,
got: CodecKind,
},
CrcMismatch {
expected: u32,
got: u32,
},
SizeMismatch {
expected: u64,
got: u64,
},
Backend(Error),
Io(Error),
Join(JoinError),
UnregisteredCodec(CodecKind),
TruncatedStream {
expected: u64,
got: u64,
},
ManifestSizeExceedsLimit {
requested: u64,
limit: u64,
},
ManifestSizeMismatch {
manifest: u64,
actual: u64,
},
}Expand description
codec 操作のエラー型。anyhow::Error ではなく専用型にすることで、上位 (S4Service) が
HTTP エラーコードを意味的に出し分けやすくする。
Variants§
CodecMismatch
CrcMismatch
SizeMismatch
Backend(Error)
Io(Error)
Join(JoinError)
UnregisteredCodec(CodecKind)
TruncatedStream
v0.8.4 #73 M2: streaming compress consumed fewer input bytes than the
caller advertised (typically a client disconnect mid-PUT). Surfaced
from streaming::streaming_compress_to_frames when its
expected_size = Some(n) argument is supplied; the s4-server PUT
handler maps this to a 400 BadRequest so the client cannot rely on
silent success of a half-uploaded body.
ManifestSizeExceedsLimit
v0.8.5 #83 H-3: nvCOMP decompress refused to honour a manifest whose
original_size exceeds the safety ceiling (default 5 GiB — AWS S3
single-PUT max). Without this gate, a forged or corrupted manifest
can drive a Vec::with_capacity(huge) and trip an OOM before the
CRC check ever runs. Distinct from SizeMismatch because here the
manifest itself is rejected pre-allocation rather than a
post-decompress length comparison.
ManifestSizeMismatch
v0.8.5 #83 H-3: nvCOMP decompress saw a manifest whose
compressed_size field disagrees with the actual input payload
length. Surfaced before allocation so a forged header can’t drive
a sized read against truncated or padded input. Distinct from
SizeMismatch (which is the post-decompress original-size check):
this is a pre-flight check on the compressed side.
Trait Implementations§
Source§impl Debug for CodecError
impl Debug for CodecError
Source§impl Display for CodecError
impl Display for CodecError
Source§impl Error for CodecError
impl Error for CodecError
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()