[][src]Struct git_odb::pack::index::File

pub struct File { /* fields omitted */ }

Implementations

impl File[src]

Instantiation

pub fn at(path: impl AsRef<Path>) -> Result<File, Error>[src]

impl File[src]

Iteration and access

pub fn iter_v1<'a>(&'a self) -> impl Iterator<Item = Entry> + 'a[src]

pub fn iter_v2<'a>(&'a self) -> impl Iterator<Item = Entry> + 'a[src]

pub fn oid_at_index(&self, index: u32) -> Id[src]

Returns 20 bytes sha1 at the given index in our list of (sorted) sha1 hashes. The index ranges from 0 to self.num_objects()

pub fn pack_offset_at_index(&self, index: u32) -> u64[src]

pub fn crc32_at_index(&self, index: u32) -> Option<u32>[src]

pub fn lookup(&self, id: Id) -> Option<u32>[src]

Returns the offset of the given SHA1 for use with the (oid|pack_offset|crc32)_at_index()

pub fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = Entry> + 'a>[src]

pub fn sorted_offsets(&self) -> Vec<u64>[src]

impl File[src]

pub fn traverse_with_index<P, Processor, E>(
    &self,
    check: SafetyCheck,
    thread_limit: Option<usize>,
    new_processor: impl Fn() -> Processor + Send + Sync,
    root: P,
    pack: &File
) -> Result<(Id, Outcome, P), Error> where
    P: Progress + Send,
    <P as Progress>::SubProgress: Send,
    Processor: FnMut(Kind, &[u8], &Entry, &mut <<P as Progress>::SubProgress as Progress>::SubProgress) -> Result<(), E>,
    E: Error + Send + Sync + 'static, 
[src]

impl File[src]

Verify and validate the content of the index file

pub fn traverse_with_lookup<P, C, Processor, E>(
    &self,
    check: SafetyCheck,
    thread_limit: Option<usize>,
    new_processor: impl Fn() -> Processor + Send + Sync,
    new_cache: impl Fn() -> C + Send + Sync,
    root: P,
    pack: &File
) -> Result<(Id, Outcome, P), Error> where
    P: Progress + Send,
    <P as Progress>::SubProgress: Send,
    <<P as Progress>::SubProgress as Progress>::SubProgress: Send,
    C: DecodeEntry,
    E: Error + Send + Sync + 'static,
    Processor: FnMut(Kind, &[u8], &Entry, &mut <<P as Progress>::SubProgress as Progress>::SubProgress) -> Result<(), E>, 
[src]

impl File[src]

Verify and validate the content of the index file

pub fn traverse<P, C, Processor, E>(
    &self,
    pack: &File,
    progress: Option<P>,
    new_processor: impl Fn() -> Processor + Send + Sync,
    new_cache: impl Fn() -> C + Send + Sync,
    Options { algorithm: algorithm, thread_limit: thread_limit, check: check }: Options
) -> Result<(Id, Outcome, Option<P>), Error> where
    P: Progress + Send,
    <P as Progress>::SubProgress: Send,
    <<P as Progress>::SubProgress as Progress>::SubProgress: Send,
    C: DecodeEntry,
    E: Error + Send + Sync + 'static,
    Processor: FnMut(Kind, &[u8], &Entry, &mut DoOrDiscard<<<P as Progress>::SubProgress as Progress>::SubProgress>) -> Result<(), E>, 
[src]

impl File[src]

Verify and validate the content of the index file

pub fn index_checksum(&self) -> Id[src]

pub fn pack_checksum(&self) -> Id[src]

pub fn verify_checksum(&self, progress: impl Progress) -> Result<Id, Error>[src]

pub fn verify_integrity<P, C>(
    &self,
    pack: Option<(&File, Mode, Algorithm)>,
    thread_limit: Option<usize>,
    progress: Option<P>,
    make_cache: impl Fn() -> C + Send + Sync
) -> Result<(Id, Option<Outcome>, Option<P>), Error> where
    P: Progress + Send,
    <P as Progress>::SubProgress: Send,
    <<P as Progress>::SubProgress as Progress>::SubProgress: Send,
    C: DecodeEntry
[src]

If pack is provided, it is expected (and validated to be) the pack belonging to this index. It will be used to validate internal integrity of the pack before checking each objects integrity is indeed as advertised via its SHA1 as stored in this index, as well as the CRC32 hash. redoing a lot of work across multiple objects.

pub fn verify_entry<P>(
    mode: Mode,
    encode_buf: &mut Vec<u8>,
    object_kind: Kind,
    buf: &[u8],
    index_entry: &Entry,
    progress: &mut P
) -> Result<(), Error> where
    P: Progress, 
[src]

impl File[src]

Various ways of writing an index file from pack entries

pub fn write_data_iter_to_stream<F, F2, P>(
    kind: Kind,
    make_resolver: F,
    entries: impl Iterator<Item = Result<Entry, Error>>,
    thread_limit: Option<usize>,
    root_progress: P,
    out: impl Write
) -> Result<Outcome, Error> where
    F: FnOnce() -> Result<F2>,
    F2: for<'r> Fn(EntrySlice, &'r mut Vec<u8>) -> Option<()> + Send + Sync,
    P: Progress,
    <P as Progress>::SubProgress: Send
[src]

Note that neither in-pack nor out-of-pack Ref Deltas are supported here, these must have been resolved beforehand. make_resolver(): It will only be called after the iterator stopped returning elements and produces a function that provides all bytes belonging to an entry.

impl File[src]

pub fn kind(&self) -> Kind[src]

pub fn path(&self) -> &Path[src]

pub fn num_objects(&self) -> u32[src]

pub fn version(&self) -> u32[src]

Trait Implementations

impl<'_> TryFrom<&'_ Path> for File[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for File

impl Send for File

impl Sync for File

impl Unpin for File

impl UnwindSafe for File

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> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<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<V, T> VZip<V> for T where
    V: MultiLane<T>,