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.
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
)