File-DirSync

 view release on metacpan or  search on metacpan

lib/File/DirSync.pm  view on Meta::CPAN

=head2 ignore( <node> )

Avoid recursing into directories named <node> within
source_directory.  It may be called multiple times to ignore
several directory names.

  $dirsync->ignore("CVS");

This method applies to both the rebuild() process and the
dirsync() process.

=head2 lockfile( <lockfile> )

If this option is used, <lockfile> will be used to
ensure that only one dirsync process is running at
a time.  If another process is concurrently running,
this process will immediately abort without doing
anything.  If <lockfile> does not exist, it will be
created.  This might be useful say for a cron that
runs dirsync every minute, but just in case it takes
longer than a minute to finish the dirsync process.
It would be a waste of resources to have multiple
simultaneous dirsync processes all attempting to
dirsync the same files.  The default is to always
dirsync.

=head2 verbose( [ <0_or_1> ] )

  $dirsync->verbose( 1 );

Read verbose setting or turn verbose off or on.
Default is off.

=head2 localmode( [ <0_or_1> ] )

Read or set local directory only mode to avoid
recursing into the directory descent.

  $dirsync->localmode( 1 );

Default is to perform the action recursively
by descending into all subdirectories of
source_directory.

=head2 nocache( [ <0_or_1> ] )

When mirroring from source_directory to destination_directory,
do not assume the rebuild() method has been run on the source
already to rebuild the dirsync cache.  All files will be
mirrored.

  $dirsync->nocache( 1 );

If enabled, it will significantly degrade the performance
of the mirroring process.  The default is 0 - assume that
rebuild() has already rebuilt the source cache.

=head2 gentle( [ <percent> [, <ops> ] ] )

Specify gentleness for all disk operations.
This is useful for those servers with very busy disk drives
and you need to slow down the sync process in order to allow
other processes the io slices they demand.
The <percent> is the realtime percentage of time you wish to
be sleeping instead of doing anything on the hard drive,
i.e., a low value (1) will spend most of the time working
and a high value (99) will spend most of the time sleeping.
The <ops> is the number of disk operations you wish to
perform in between each sleep interval.

  $dirsync->gentle( 25, 1_000 );

If gentle is called without arguments, then some default
"nice" values are set.
If gentle is not called at all, then it will process all disk
operations at full blast without sleeping at all.

=head2 proctitle( [ procname ] )

Enable proctitle mode which shows the current operation on the
process title.  If procname is specified, then it shows that
string in the "ps" listing.  Otherwise, the current $0 is used.
This is mostly for progress tracking for convenience purposes.

  $dirsync->proctitle( "SYNCING" );

Default is not to alter the process title at all.

=head2 tracking( [ <0_or_1> ] )

Enable or disable tracking mode.  Operation tracking is disabled
by default in order to reduce CPU and memory consumption.
See entries_* methods below for more details.

=head2 entries_updated()

Returns an array of all directories and files updated in the last
C<dirsync>, an empty list if it hasn't been run yet.

=head2 entries_removed()

Returns an array of all directories and files removed in the last
C<dirsync>, an empty list if it hasn't been run yet.

=head2 entries_skipped()

Returns an array of all directories and files that were skipped in the
last C<dirsync>, an empty list if it hasn't been run yet.

=head2 entries_failed()

Returns an array of all directories and files that failed in the last
C<dirsync>, an empty list if it hasn't been run yet.


=head1 TODO

Support for efficient incremental changes to large log files using
md5 checksum comparison on portions of or all of corresponding
parts of both the larger source and smaller destination files.
If no differences are found anywhere, including the very end of the



( run in 1.158 second using v1.01-cache-2.11-cpan-39bf76dae61 )