Expand description
This crate implements functions for syncing arbitrary binary content between
two locations. The underlying algorithm used is based on fast content
defined chunking. This works by first generating a Manifest
that lists
the files and chunks in the source folder. Using the sync
function pointed
at an empty or already populated destination folder the library will migrate
the contents of the destination to look like the source.
use binsync::{Manifest, CachingChunkProvider, Syncer};
let manifest = Manifest::from_path("foo/source");
let basic_provider = CachingChunkProvider::new("foo/source");
let mut syncer = Syncer::new("foo/destination", basic_provider, manifest);
syncer.sync().unwrap();
Structs§
- Caching
Chunk Provider - A caching chunk provider for local transfers. Attempts to read and save chunks as optimally as possible by caching file handles and chunks that are used more than once.
- Chunk
- The most basic building block. Holds the precomputed hash identifier along with the offset in the file and length of the chunk.
- File
Chunk Info - Information about a file and which chunks it contains.
- Manifest
- Holds a list of files and which chunks exist inside those files in which order. The manifest is the source of the syncer allowing us to know what we should be syncing to.
- Syncer
- Uses a manifest and a provider to sync data to the destination.
Enums§
Traits§
- Chunk
Provider - Trait for providing chunks. This allows you to customize the implementation of your provider to be from anywhere. For example it can be another folder on the same drive or fetch chunks from the internet using any protocol.
Functions§
- generate_
manifest - sync
- Helper function to sync the given input and output directories using the
CachingChunkProvider
. - sync_
from_ manifest - Helper function to execute the syncer on a given path with a provider and manifest supplied.
- sync_
with_ progress - Helper function to sync with a callback when progress is happening. The progress is reported from 0 to 100.