IO::BlockSync - Syncronize changed blocks
Version 0.002
BlockSync can some of the same stuff that bigsync (by Egor Egorov) can - it's just written in perl.
BlockSync copies data from source file to destination file (can be a block device) and calculates checksum on each block it copies. On all runs after the first only the changed blocks will be copied.
use IO::BlockSync; # OOP way my $bs = IO::BlockSync->new( src => '/path/to/source/file', dst => '/path/to/destination/file', chk => '/path/to/chk/file', ); $bs->run; # Non OOP way BlockSync( src => '/path/to/source/file', dst => '/path/to/destination/file', chk => '/path/to/chk/file', );
Look in README.pod
README.pod
Can also be found on GitHub or meta::cpan
Run BlockSync non-object-oriented
Path to source file.
mandatory - string (containing path) or filehandle
Destination file. If not set, then only checksum file will be updated.
optional - string (containing path) or filehandle
Path to checksum file.
Block size to use in bytes.
optional - integer - defaults to 1_048_576 B (1 MB)
Sub that retrurn hashed data.
optional - sub - defaults to sub that return MD5 hash followed by newline
Seek in dst file, instead of writing blocks only containing \0
optional - boolean - defaults to 0 (false)
Truncate the destination file to same size as source file. Does not work on block devices. Will only be tried if data has default value (whole file is copied).
data
List of areas (in bytes) inside the source file that should be looked at. Usefull if you know excactly which blocks in src that could have changed.
data => [ {start => 0, end => 9999}, {start => 88888, end => 777777}, ]
optional - array of hashes - defaults to "whole file"
Sub that will be run everytime a block has been read (and written).
optional - sub - default to sub doing nothing
This is the method that starts copying data.
This software is copyright (c) 2019 by Thor Dreier-Hansen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Terms of the Perl programming language system itself:
the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or
the "Artistic License"
See http://dev.perl.org/licenses/ for more information.
To install IO::BlockSync, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IO::BlockSync
CPAN shell
perl -MCPAN -e shell install IO::BlockSync
For more information on module installation, please visit the detailed CPAN module installation guide.