[][src]Struct git2::Odb

pub struct Odb<'repo> { /* fields omitted */ }

A structure to represent a git object database

Methods

impl<'repo> Odb<'repo>[src]

pub fn new<'a>() -> Result<Odb<'a>, Error>[src]

Creates an object database without any backends.

pub fn reader(&self, oid: Oid) -> Result<(OdbReader, usize, ObjectType), Error>[src]

Create object database reading stream.

Note that most backends do not support streaming reads because they store their objects as compressed/delta'ed blobs. If the backend does not support streaming reads, use the read method instead.

pub fn writer(
    &self,
    size: usize,
    obj_type: ObjectType
) -> Result<OdbWriter, Error>
[src]

Create object database writing stream.

The type and final length of the object must be specified when opening the stream. If the backend does not support streaming writes, use the write method instead.

pub fn foreach<C>(&self, callback: C) -> Result<(), Error> where
    C: FnMut(&Oid) -> bool
[src]

Iterate over all objects in the object database.s

pub fn read(&self, oid: Oid) -> Result<OdbObject, Error>[src]

Read an object from the database.

pub fn read_header(&self, oid: Oid) -> Result<(usize, ObjectType), Error>[src]

Reads the header of an object from the database without reading the full content.

pub fn write(&self, kind: ObjectType, data: &[u8]) -> Result<Oid, Error>[src]

Write an object to the database.

pub fn exists(&self, oid: Oid) -> bool[src]

Checks if the object database has an object.

pub fn exists_prefix(&self, short_oid: Oid, len: usize) -> Result<Oid, Error>[src]

Potentially finds an object that starts with the given prefix.

pub fn refresh(&self) -> Result<(), Error>[src]

Refresh the object database. This should never be needed, and is provided purely for convenience. The object database will automatically refresh when an object is not found when requested.

pub fn add_disk_alternate(&self, path: &str) -> Result<(), Error>[src]

Adds an alternate disk backend to the object database.

Trait Implementations

impl<'repo> Drop for Odb<'repo>[src]

Auto Trait Implementations

impl<'repo> Unpin for Odb<'repo>

impl<'repo> !Sync for Odb<'repo>

impl<'repo> !Send for Odb<'repo>

impl<'repo> UnwindSafe for Odb<'repo>

impl<'repo> RefUnwindSafe for Odb<'repo>

Blanket Implementations

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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