Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error { InvalidRefName { name: String, reason: &'static str, }, RefNameConflict { name: String, conflicts_with: String, }, CorruptObject { oid: ObjectId, reason: String, }, MissingObject { id: ObjectId, referrer: Option<ObjectId>, }, HashKindMismatch { stored: Kind, requested: Kind, }, StoreLocked { path: PathBuf, }, Hash(Error), Io(Error), Backend(Error), }
Expand description

Everything gunnar-store itself can go wrong with.

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.
§

InvalidRefName

A reference name is not a legal git reference name.

Raised by crate::refname::validate. A name with a .. component in it is how a path sandbox gets walked out of, so this is a security boundary as much as a correctness one.

Fields

§name: String

The offending name, lossily decoded for display.

§reason: &'static str

Why it was rejected.

§

RefNameConflict

Two reference names cannot both exist: one is a directory prefix of the other.

refs/heads/x and refs/heads/x/y are a file and a directory of the same name in a loose-ref backend, and git refuses the pair on every backend so a repository stays convertible between them. Nothing raced and retrying will never help, which is why it is a variant of its own.

Measured, git 2.53.0, git push into a bare repository: the per-ref answer is ! [remote rejected] (refname conflict), and when both names arrive in one push the server refuses the batch with cannot process 'refs/heads/x' and 'refs/heads/x/y' at the same time.

Fields

§name: String

The reference the transaction tried to write.

§conflicts_with: String

The reference already present, or written by the same transaction, that is a directory prefix of name or has name as one.

§

CorruptObject

An object’s stored bytes could not be decoded.

Fields

§oid: ObjectId

The object that failed to decode.

§reason: String

Why decoding failed.

§

MissingObject

An object that something else points at is not in the store.

Raised while walking a reference’s closure: a repository that cannot serve one of its own refs. Not a fault of the caller’s request, which is why it is not an Error::Backend.

Fields

§id: ObjectId

The object that could not be found.

§referrer: Option<ObjectId>

What pointed at it, when that is known.

§

HashKindMismatch

The store was opened with one hash kind but is holding another.

A sha1 repo and a sha256 repo are different repos; silently mixing them would produce oids that no client can verify.

Fields

§stored: Kind

What the store already contains.

§requested: Kind

What the caller asked for.

§

StoreLocked

Another writer already holds this store’s exclusive lock.

Compare-and-swap over an append-only log is only sound with one writer: two appenders at the end of an Arrow IPC stream interleave and destroy the frame boundaries, and the format has no reservation protocol. A second gunnar therefore refuses to start (the Arrow-IPC ref log).

Since the liveness check this means the holder is alive, or that it could not be shown to be gone: no /proc, an unreadable owner line, or a lock written by a gunnar that recorded no start time. A lock whose owner is provably gone is reclaimed by ArrowLogStore::open itself and never produces this error. ArrowLogStore::force_unlock is for the undecidable remainder.

Fields

§path: PathBuf

The lock file that is already present.

§

Hash(Error)

Hashing failed. Since gix-hash 0.27 (gix 0.88, 2026-10-02) hashing reports a gix_error exception instead of hasher::Error; it is kept here as a gix_error::Error.

§

Io(Error)

I/O failed.

§

Backend(Error)

A backend-specific failure that has no gunnar-level meaning.

Implementations§

Source§

impl Error

Source

pub fn is_name_conflict(&self) -> bool

true if two names were refused because they cannot coexist.

Kept as a predicate rather than left to a matches! at each call site because receive-pack reports it to the client as a refname conflict, which is a different answer from a non-fast-forward and from an internal error, and a retry will never change it.

Source

pub fn backend(msg: impl Display) -> Self

Build a Error::Backend from anything printable.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Exn<Message>> for Error

Every gix call that reports Exn<Message> inside this crate is a hash computation (compute_hash, Hasher::try_finalize), so ? lands in Error::Hash exactly as #[from] gix_hash::hasher::Error did before gix 0.88.

Source§

fn from(err: Exn<Message>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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> ErrorExt for T
where T: Error + Send + Sync + 'static,

Source§

fn raise(self) -> Exn<Self>
where Self: Sized,

Raise this error as a new exception.
Source§

fn and_raise<T>(self, context: T) -> Exn<T>
where T: Error + Send + Sync + 'static, Self: Sized,

Raise this error as a child of a new exception with the given context error. Read more
Source§

fn raise_erased(self) -> Exn
where Self: Sized,

Raise this error as a new exception, with type erasure.
Source§

fn raise_all<T, I>(self, sources: I) -> Exn<Self>
where Self: Sized, T: Error + Send + Sync + 'static, I: IntoIterator, <I as IntoIterator>::Item: Into<Exn<T>>,

Raise this error as a new exception, with sources as causes.
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.