Struct hash_roll::rsyncable::Rsyncable
[−]
[src]
pub struct Rsyncable { /* fields omitted */ }
Window-based splitter using a simple accumulator & modulus hash.
Used by the gzip rsyncable patch (still not merged, but widely distributed) as well as the rsyncrypto project to split the unerlying content into variable sized blocks prior to applying a filter (compression and/or encryption) to the blocks, which the intent of allowing the resulting filtered data to be more easily propogated via rsync.
- No maximum block size is provided.
- No minimum block size is provided.
PDF of block sizes: ???
Note that the defacto-standard parameters allow a slightly more efficient check for a block split (by replacing a modulus with a bitwise-and). This impl currently doesn't allow that optimization even if you provide appropriate parameters (we need type-level integers for that).
Parameters:
- window-len: The maximum number of bytes to be examined when deciding to split a block. set to 8192 by default in gzip-rsyncable & rsyncrypto)
- modulus: set to half of window-len (so, 4096) in gzip-rsyncable & rsyncrypto.
In-block state: - window of window-len bytes (use of the iterator interface means we also track more bytes than this) - sum (u64)
Between-block state:
- none
References:
S(n) = sum(c_i, var=i, top=n, bottom=n-8196)
A(n) = S(n) / 8192
H(n) = S(n) mod 4096
Trigger splits when H(n) == 0
Methods
impl Rsyncable
[src]
fn with_window_and_modulus(window: usize, modulus: u64) -> Rsyncable
Trait Implementations
impl Clone for Rsyncable
[src]
fn clone(&self) -> Rsyncable
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Rsyncable
[src]
impl PartialEq for Rsyncable
[src]
fn eq(&self, __arg_0: &Rsyncable) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Rsyncable) -> bool
This method tests for !=
.
impl Eq for Rsyncable
[src]
impl Splitter for Rsyncable
[src]
fn find_chunk_edge<'a, 'b>(&'a self, data: &'b [u8]) -> usize
Find the location (if any) to split data
based on this splitter. Read more
fn next_iter<'a, T: Iterator<Item = u8>>(&'a self, iter: T) -> Option<Vec<u8>>
Return chunks from a given iterator, split according to the splitter used. Read more
fn split<'b>(&self, data: &'b [u8]) -> (&'b [u8], &'b [u8])
Split data into 2 pieces using a given splitter. Read more
fn into_slices<'a>(self, data: &'a [u8]) -> SplitterSlices<'a, Self> where
Self: Sized,
Self: Sized,
Create an iterator over slices from a slice and a splitter. The splitter is consumed. Read more
fn as_slices<'a>(&'a self, data: &'a [u8]) -> SplitterSlices<'a, &Self> where
Self: Sized,
Self: Sized,
fn into_vecs<'a, T: Iterator<Item = u8>>(self, data: T) -> SplitterVecs<T, Self> where
Self: Sized,
Self: Sized,
Create an iterator of Vec<u8>
from an input Iterator of bytes. The splitter is consumed. Read more
fn as_vecs<'a, T: Iterator<Item = u8>>(
&'a self,
data: T
) -> SplitterVecs<T, &Self> where
Self: Sized,
&'a self,
data: T
) -> SplitterVecs<T, &Self> where
Self: Sized,