[−][src]Struct bitar::ChunkIndex
Index of chunks for a file.
Allows us to map between chunk hashes and source content location.
Implementations
impl ChunkIndex[src]
pub fn new_empty() -> Self[src]
Create an empty chunk index.
pub fn add_chunk(&mut self, hash: HashSum, size: usize, offsets: &[u64])[src]
Add a chunk with size and offsets to the index.
pub fn remove(&mut self, hash: &HashSum) -> Option<ChunkLocation>[src]
Remove a chunk by hash.
pub fn contains(&self, hash: &HashSum) -> bool[src]
Test if a chunk is in the index.
pub fn len(&self) -> usize[src]
Get number of chunks in the index.
pub fn is_empty(&self) -> bool[src]
Test if index is empty.
pub fn offsets<'a>(
&'a self,
hash: &HashSum
) -> Option<impl Iterator<Item = u64> + 'a>[src]
&'a self,
hash: &HashSum
) -> Option<impl Iterator<Item = u64> + 'a>
Iterate source offsets of a chunk.
pub fn keys(&self) -> impl Iterator<Item = &HashSum>[src]
Iterate chunk hashes in index.
pub fn strip_chunks_already_in_place(
&self,
chunk_set: &mut ChunkIndex
) -> (usize, u64)[src]
&self,
chunk_set: &mut ChunkIndex
) -> (usize, u64)
Filter the given chunk index for chunks which are already in place in self
Returns the number of chunks filtered and total size of them.
pub fn reorder_ops(&self, new_order: &ChunkIndex) -> Vec<ReorderOp>[src]
Get a description of how to transform one source file into another.
The transformation is done by reordering the chunks of a file in place trying to match the new order. Only the chunks present in both the current index and the new index will be reordered, while chunks that are not present in the current index still has to be fetched from elsewhere.
pub fn iter_chunks(&self) -> impl Iterator<Item = (&HashSum, &ChunkLocation)>[src]
Iterate all chunks in the index.
Chunks are returned in undefined order.
Trait Implementations
impl Clone for ChunkIndex[src]
fn clone(&self) -> ChunkIndex[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for ChunkIndex[src]
Auto Trait Implementations
impl RefUnwindSafe for ChunkIndex
impl Send for ChunkIndex
impl Sync for ChunkIndex
impl Unpin for ChunkIndex
impl UnwindSafe for ChunkIndex
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,