Skip to main content

ReftableError

Enum ReftableError 

Source
#[non_exhaustive]
pub enum ReftableError {
Show 19 variants TooSmall { len: usize, }, BadMagic, UnsupportedVersion { version: u8, }, FooterVersionMismatch { header: u8, footer: u8, }, FooterChecksumMismatch { stored: u32, computed: u32, }, Truncated { field: ReftableField, }, InvalidUtf8 { field: ReftableField, }, PrefixTooLong { field: ReftableField, }, UnknownValueType { value_type: u8, }, InvalidBlockLength, InvalidRestartTable, InvalidLogKey, MissingTable { name: String, }, UnsortedRefs { previous: String, next: String, }, EntryTooLarge, EmptyRecordKey, Locked { lock_path: PathBuf, }, LockReleased, ExpectedMismatch { refname: String, expected: ObjectId, actual: Option<ObjectId>, },
}
Expand description

A reftable failure: malformed table bytes, a locked stack, or a rejected update.

Wrapped by Error::Reftable. Corruption variants describe what was wrong with the bytes; Self::Locked and Self::ExpectedMismatch are the conditions callers usually want to react to (retry, or re-read and redo).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

TooSmall

The file is shorter than its header and footer require.

Fields

§len: usize

Number of bytes available.

§

BadMagic

The header or footer does not start with the REFT magic.

§

UnsupportedVersion

The header names a format version other than 1 (SHA-1) or 2 (SHA-256).

Fields

§version: u8

Version byte from the header.

§

FooterVersionMismatch

The footer repeats a different version than the header.

Fields

§header: u8

Version byte from the header.

§footer: u8

Version byte from the footer.

§

FooterChecksumMismatch

The footer’s CRC-32 does not match its contents.

Fields

§stored: u32

CRC-32 recorded in the footer.

§computed: u32

CRC-32 computed over the footer bytes.

§

Truncated

The data ends inside a field.

Fields

§field: ReftableField

Field that was cut short.

§

InvalidUtf8

A text field is not valid UTF-8.

Fields

§field: ReftableField

Field holding the invalid bytes.

§

PrefixTooLong

A prefix-compressed key claims more shared bytes than the previous key has.

Fields

§field: ReftableField

Key whose prefix length is out of range.

§

UnknownValueType

A ref record uses a value type outside the format’s four kinds.

Fields

§value_type: u8

The 3-bit value type found in the record.

§

InvalidBlockLength

A block’s length points outside the file.

§

InvalidRestartTable

A block’s restart table is out of range or overlaps its records.

§

InvalidLogKey

A log record key lacks the refname NUL update_index layout.

§

MissingTable

tables.list names a table that is not part of the loaded stack.

Fields

§name: String

Table file name from tables.list.

§

UnsortedRefs

ReftableWriter::add_ref was called out of name order.

Fields

§previous: String

Name of the ref added before.

§next: String

Name of the ref that did not sort after it.

§

EntryTooLarge

A record does not fit in an empty block of the configured size.

§

EmptyRecordKey

A record with an empty key was written.

§

Locked

Another writer holds tables.list.lock.

Fields

§lock_path: PathBuf

Path of the held lock file.

§

LockReleased

The tables.list.lock guard was used after its lock had been committed.

§

ExpectedMismatch

A compare-and-swap update found a different value than it required.

Fields

§refname: String

Ref the update targeted.

§expected: ObjectId

Object id the update required.

§actual: Option<ObjectId>

Object id found, or None when the ref does not exist.

Trait Implementations§

Source§

impl Debug for ReftableError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ReftableError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ReftableError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ReftableError> for Error

Source§

fn from(source: ReftableError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.