Synchronize files to a destination(local/remote) using a incremental algorithm
Project description
blocksync
This library allows blocksync script to be used as Python package, and supports more convenient and various functions than blocksync script.
Prerequisites
- Python 3.8 or later
Features
- Synchronize the destination (remote or local) files using an incremental algorithm.
- Supports all synchronization directions. (local-local, local-remote, remote-local)
- Support for callbacks that can run before(run once or per workers), after(run once or per workers), and during synchronization of files
- Support for synchronization suspend/resume, cancel.
- Most methods support method chaining.
- You can see the overall progress in a multi-threaded environment.
- You can proceed synchronization in the background.
- You can specify the number of workers (number of threads) to perform synchronization.
Installation
pip install blocksync
Quick start
When sync from/to remote, you can check the SSH connection options in paramiko docs.
from blocksync import local_to_local
manager, status = local_to_local("src.txt", "dest.txt", workers=4)
manager.wait_sync()
print(status)
# Output
[Worker 1]: Start sync(src.txt -> dest.txt) 1 blocks
[Worker 2]: Start sync(src.txt -> dest.txt) 1 blocks
[Worker 3]: Start sync(src.txt -> dest.txt) 1 blocks
[Worker 4]: Start sync(src.txt -> dest.txt) 1 blocks
{'workers': 4, 'chunk_size': 250, 'block_size': 250, 'src_size': 1000, 'dest_size': 1000, 'blocks': {'same': 4, 'diff': 0, 'done': 4}}
TODO
- Provide CLI
- Write docs and build a docs website
License
MIT License (For more information about this license, please see this)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
blocksync-3.0.1.tar.gz
(9.2 kB
view details)
File details
Details for the file blocksync-3.0.1.tar.gz.
File metadata
- Download URL: blocksync-3.0.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d519c9085b8649afe70a27f4c686429978e3042b2dee06c9b515cfa78451f83d
|
|
| MD5 |
51fe4eaca556effe17cba4fcffb001d5
|
|
| BLAKE2b-256 |
5d4bd41f350555a9b2ac915e61fc63a2026925bc1fc0a9a17755fa52c4ecd6ba
|