pub struct Indexer<'odb> { /* private fields */ }
Expand description
A stream to write and index a packfile
This is equivalent to crate::OdbPackwriter
, but allows to store the pack
and index at an arbitrary path. It also does not require access to an object
database if, and only if, the pack file is self-contained (i.e. not “thin”).
Implementations§
Source§impl<'a> Indexer<'a>
impl<'a> Indexer<'a>
Sourcepub fn new(
odb: Option<&Odb<'a>>,
path: &Path,
mode: u32,
verify: bool,
) -> Result<Self, Error>
pub fn new( odb: Option<&Odb<'a>>, path: &Path, mode: u32, verify: bool, ) -> Result<Self, Error>
Create a new indexer
The Odb
is used to resolve base objects when fixing thin packs. It
can be None
if no thin pack is expected, in which case missing bases
will result in an error.
path
is the directory where the packfile should be stored.
mode
is the permissions to use for the output files, use 0
for defaults.
If verify
is false
, the indexer will bypass object connectivity checks.
Sourcepub fn commit(self) -> Result<String, Error>
pub fn commit(self) -> Result<String, Error>
Finalize the pack and index
Resolves any pending deltas and writes out the index file. The returned
string is the hexadecimal checksum of the packfile, which is also used
to name the pack and index files (pack-<checksum>.pack
and
pack-<checksum>.idx
respectively).
Trait Implementations§
Source§impl Write for Indexer<'_>
impl Write for Indexer<'_>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)Auto Trait Implementations§
impl<'odb> Freeze for Indexer<'odb>
impl<'odb> !RefUnwindSafe for Indexer<'odb>
impl<'odb> !Send for Indexer<'odb>
impl<'odb> !Sync for Indexer<'odb>
impl<'odb> Unpin for Indexer<'odb>
impl<'odb> !UnwindSafe for Indexer<'odb>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more