#[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
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
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
CorruptObject
An object’s stored bytes could not be decoded.
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
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.
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.
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
impl Error
Sourcepub fn is_name_conflict(&self) -> bool
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.
Sourcepub fn backend(msg: impl Display) -> Self
pub fn backend(msg: impl Display) -> Self
Build a Error::Backend from anything printable.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Source§impl From<Error> for Error
Every gix call that reports a gix_error::Error 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
(gix 0.88 reported Exn<Message> there; gix 0.90 reports the Error itself).
impl From<Error> for Error
Every gix call that reports a gix_error::Error 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
(gix 0.88 reported Exn<Message> there; gix 0.90 reports the Error itself).
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> 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
Source§impl<T> ErrorExt for T
impl<T> ErrorExt for T
Source§fn raise_typed(self) -> Exn<Self>where
Self: Sized,
fn raise_typed(self) -> Exn<Self>where
Self: Sized,
Self even when it is already an Error.Source§fn and_raise_typed<T>(self, context: T) -> Exn<T>
fn and_raise_typed<T>(self, context: T) -> Exn<T>
Self::and_raise(), retaining the context’s type in an exception.Source§fn raise_erased(self) -> Exnwhere
Self: Sized,
fn raise_erased(self) -> Exnwhere
Self: Sized,
crate::Error values reuse their existing frame and caller location.