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]

Trait Implementations

impl Clone for Rsyncable
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Rsyncable
[src]

Formats the value using the given formatter.

impl PartialEq for Rsyncable
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Rsyncable
[src]

impl Splitter for Rsyncable
[src]

Find the location (if any) to split data based on this splitter. Read more

Return chunks from a given iterator, split according to the splitter used. Read more

Split data into 2 pieces using a given splitter. Read more

Create an iterator over slices from a slice and a splitter. The splitter is consumed. Read more

Create an iterator of Vec<u8> from an input Iterator of bytes. The splitter is consumed. Read more

impl Default for Rsyncable
[src]

Returns the "default value" for a type. Read more