All Projects → rokups → Zinc

rokups / Zinc

Licence: mit
Block level data synchronization library

Labels

Projects that are alternatives of or similar to Zinc

Auto Gitlab Backup
A simple script to backup your Gitlab data. This script will copy the backup archives of your gitlab installation via rsync, or scp. Also, you can copy backups to Backblaze’s B2 Cloud Storage service.
Stars: ✭ 291 (+532.61%)
Mutual labels:  rsync
Gulp Tutorial
Code examples for my Gulp.js tutorial series
Stars: ✭ 383 (+732.61%)
Mutual labels:  rsync
Ustcmirror Images
Docker images used by ustcmirror 🚀
Stars: ✭ 29 (-36.96%)
Mutual labels:  rsync
Sync
syncs your local folder with remote folder using scp
Stars: ✭ 293 (+536.96%)
Mutual labels:  rsync
Linux Timemachine
Rsync-based OSX-like time machine for Linux, MacOS and BSD for atomic and resumable local and remote backups
Stars: ✭ 358 (+678.26%)
Mutual labels:  rsync
Butler
🎩 Command-line itch.io helper
Stars: ✭ 433 (+841.3%)
Mutual labels:  rsync
PyFiSync
Python (+ rsync or rclone) based intelligent file sync with automatic backups and file move/delete tracking.
Stars: ✭ 88 (+91.3%)
Mutual labels:  rsync
Ksync
Sync files between your local system and a kubernetes cluster.
Stars: ✭ 1,005 (+2084.78%)
Mutual labels:  rsync
Mirrorbits
Mirrorbits is a geographical download redirector written in Go for distributing files efficiently across a set of mirrors.
Stars: ✭ 365 (+693.48%)
Mutual labels:  rsync
Rsyncosx
A macOS GUI for rsync
Stars: ✭ 780 (+1595.65%)
Mutual labels:  rsync
Msrsync
Multi-stream rsync wrapper
Stars: ✭ 328 (+613.04%)
Mutual labels:  rsync
Gsync
gSync is an rsync based library for sending delta updates of files to a remote server.
Stars: ✭ 344 (+647.83%)
Mutual labels:  rsync
Go Sync
gosync is a library for Golang styled around zsync / rsync, written with the intent that it enables efficient differential file transfer in a number of ways. NB: I am unable to contribute to this at the moment
Stars: ✭ 494 (+973.91%)
Mutual labels:  rsync
Docker Sshd
Minimal Alpine Linux Docker image with sshd exposed and rsync installed
Stars: ✭ 291 (+532.61%)
Mutual labels:  rsync
Photos Sync
Sync OS X Photos to Anywhere (NAS, Dropbox, Amazon S3 or Glacier, Backblaze B2)
Stars: ✭ 29 (-36.96%)
Mutual labels:  rsync
Raspibackup
Backup and restore your running Raspberry
Stars: ✭ 268 (+482.61%)
Mutual labels:  rsync
Websync
websync is intended to be an rsync manager, where rsync tasks can be added, scheduled and maintained in a sane manner.
Stars: ✭ 432 (+839.13%)
Mutual labels:  rsync
Heroku Google Drive
Remote Google Drive client on Heroku using Rclone and Aria2
Stars: ✭ 44 (-4.35%)
Mutual labels:  rsync
Hactar
📃 An incremential daily backup script using rsync
Stars: ✭ 34 (-26.09%)
Mutual labels:  rsync
Rdiff Backup
Reverse differential backup tool, over a network or locally.
Stars: ✭ 510 (+1008.7%)
Mutual labels:  rsync

zinc - the reverse-rsync

Build Status

WARNING: DO NOT USE IT WITH IMPORTANT AND/OR NOT BACKED UP DATA. This code is of alpha quality.

rsync has become a synonym to efficient data synchronization. There are few issues however: server does heavy lifting and GPL license.

There was an attempt to bring rsync fully into a client by zsync project, however it appears to not be maintained any more, it's license is also non-permissive and code of zsync is not easily embeddable into other projects. This library is a humble attempt to fix these issues.

Features

  • Block level file synchronization - downloads only missing pieces, reuses existing data.
  • No special server setup - any http(s) server supporting Range header will do.
  • Files are updated in-place - huge files of tens of gigabytes will not be copied and only changed parts will be written. Your SSD will be happy.
  • Progress reporting callbacks.
  • c++11 required.
  • Example implementation of synchronization tool written in c++.
  • Multithreaded.
  • Free as in freedom - use it however you like, in open source (preferably) or proprietary software, no strings attached.

How it works

  +-------------------------------- Server -------------------------------+
  | new_boundary_list = partition_file(new_file);                         |
  +-----------------------------------------------------------------------+
                                    |
                     [ Transport (for example http) ]
                                    |
  +---------------------------------- Client -----------------------------+
  | new_boundary_list = partition_file(old_file);                         |
  | delta = compare_files(old_boundary_list, new_boundary_list);          |
  | // Patch file                                                         |
  | for (const auto& operation : delta)                                   |
  | {                                                                     |
  |     if (operation.local == nullptr)                                   |
  |     {                                                                 |
  |         // Download block from remote file                            |
  |         auto* remote = operation.remote;                              |
  |         void* data = download_block(remote->start, remote->length);   |
  |         fp_old->seek(remote->start);                                  |
  |         fp_old->write(data, remote->length);                          |
  |     }                                                                 |
  |     else                                                              |
  |     {                                                                 |
  |         // Copy block from local file                                 |
  |         fp_old->seek(operation.local->start);                         |
  |         void* data = fp_old->read(operation.local->length);           |
  |         fp_old->seek(operation.remote->start);                        |
  |         fp_old->write(data, operation.local->length);                 |
  |     }                                                                 |
  | }                                                                     |
  +-----------------------------------------------------------------------+

On the served end new_boundary_list should be calculated once and written to a file for retrieval by client. Library is transport-agnostic and you may use any transport you desire. Http is named as a suggested transport because it eliminates need of any custom server setup and is most convenient option available today.

As you can see from diagram above process of synchronizing data is composed of three steps:

  1. Hashing: Latest version of the file is split into variable size blocks and for every block strong and weak hashes are calculated.
  2. Delta calculation: Client obtains the list of block, then splits a local file to variable size blocks and finally compares block lists of both files and determines which parts should be moved and which parts should be downloaded.
  3. Patching: Using a calculated delta map blocks in local file are rearranged much like a puzzle pieces, missing pieces are downloaded.

Example

Project comes with a testing tool zinc which is used mainly for debugging. Tool is reading and writing local files. Example below was performed in tmpfs, test files are two tar archives. new.tar contains 10 binary files 10MB each. old.tar is a copy of new.tar with one (middle) file removed and has a 10MB "hole" in the middle of file. Test performed on a i7-6800K CPU (6 core / 12 thread). Due to tmpfs you may consider test timing results as benchmark of core algorithm as file reading/writing basically happened in memory.

/tmp % sha1sum *.tar
6b9d22479a91b25347842f161eff53eab050b5d1  new.tar
71cf71c7d1433682a4b0577d982dcd5956233e7c  old.tar

/tmp % # Hash new ISO file. Produced json file is hosted on a remote (web)server along with the ISO
/tmp % zinc hash new.tar 
[########################################]

/tmp % ls new.tar*
new.tar  new.tar.json

/tmp % # Client system obtains json file with hashes from a remote server and finds different and matching blocks
/tmp % # Client system then moves existing matching blocks to their new locations while downloading missing blocks from remote server
/tmp % time zinc sync old.tar new.tar
[########################################]
Copied bytes: 51987553
Downloaded bytes: 14265606
Download savings: 87%
zinc sync old.tar   0.73s user 0.33s system 533% cpu 0.199 total

/tmp % # File was updated in less than a second
/tmp % sha1sum *.tar
6b9d22479a91b25347842f161eff53eab050b5d1  new.tar
6b9d22479a91b25347842f161eff53eab050b5d1  old.tar

Other similar software

  • rsync - inspiration of zinc
  • zsync - inspiration of zinc
  • xdelta - delta updates library
  • goodsync - proprietary block level synchronization utility
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].