Struct git2::Odb[][src]

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

A structure to represent a git object database

Implementations

Creates an object database without any backends.

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.

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.

Iterate over all objects in the object database.s

Read an object from the database.

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

Write an object to the database.

Create stream for writing a pack file to the ODB

Checks if the object database has an object.

Potentially finds an object that starts with the given prefix.

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.

Adds an alternate disk backend to the object database.

Create a new mempack backend, and add it to this odb with the given priority. Higher values give the backend higher precedence. The default loose and pack backends have priorities 1 and 2 respectively (hard-coded in libgit2). A reference to the new mempack backend is returned on success. The lifetime of the backend must be contained within the lifetime of this odb, since deletion of the odb will also result in deletion of the mempack backend.

Here is an example that fails to compile because it tries to hold the mempack reference beyond the odb’s lifetime:

use git2::Odb;
let mempack = {
    let odb = Odb::new().unwrap();
    odb.add_new_mempack_backend(1000).unwrap()
};

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.