[][src]Struct git_odb::loose::Db

pub struct Db {
    pub path: PathBuf,
}

A database for reading and writing objects to disk, one file per object.

Fields

path: PathBuf

The directory in which objects are stored, containing 256 folders representing the hashes first byte.

Implementations

impl Db[src]

Iteration and traversal

pub fn iter(&self) -> impl Iterator<Item = Result<Id, Error>>[src]

Return an iterator over all objects contained in the database.

The Ids returned by the iterator can typically be used in the locate(…) method. Note that the result is not sorted or stable, thus ordering can change between runs.

impl Db[src]

Object lookup

pub fn locate(&self, id: Id<'_>) -> Option<Result<Object, Error>>[src]

Return the object identified by the given `id if present in this database.

Returns None if the object did not exist in the database.

impl Db[src]

Initialization

pub fn at(objects_directory: impl Into<PathBuf>) -> Db[src]

Initialize the Db with the objects_directory containing the hexadecimal first byte subdirectories, which in turn contain all loose objects.

In a git repository, this would be .git/objects.

Trait Implementations

impl Write for Db[src]

type Error = Error

The error type used for all trait methods. Read more

pub fn write_buf(
    &self,
    kind: Kind,
    from: &[u8],
    hash: HashKind
) -> Result<Id, Self::Error>
[src]

Write the given buffer in from to disk in one syscall at best.

This will cost at least 4 IO operations.

pub fn write_stream(
    &self,
    kind: Kind,
    size: u64,
    mut from: impl Read,
    hash: HashKind
) -> Result<Id, Self::Error>
[src]

Write the given stream in from to disk with at least one syscall.

This will cost at least 4 IO operations.

Auto Trait Implementations

impl RefUnwindSafe for Db[src]

impl Send for Db[src]

impl Sync for Db[src]

impl Unpin for Db[src]

impl UnwindSafe for Db[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,