FlatFile::DataStore::Utils - a collection of utility routines for FlatFile::DataStore data stores.
VERSION: 0.12
Nothing is exported by default. The following may be exported individually; all three may be exported using the :all tag:
:all
- migrate - migrate_nohist - validate - compare
Examples:
use FlatFile::DataStore::Utils qw( migrate migrate_nohist validate compare ); use FlatFile::DataStore::Utils qw( :all );
use FlatFile::DataStore::Utils qw( migrate migrate_nohist validate compare ); my $from_dir = '/from/dir'; my $from_name = 'ds1'; my $to_dir = '/to/dir'; my $to_name = 'ds2'; validate( $from_dir, $from_name ); migrate ( $from_dir, $from_name, $to_dir, $to_name ); validate( $to_dir, $to_name ); compare ( $from_dir, $from_name, $to_dir, $to_name ); # optionally, migrate_nohist() will not copy any history # or deleted records: validate( $from_dir, $from_name ); migrate_nohist ( $from_dir, $from_name, $to_dir, $to_name ); validate( $to_dir, $to_name ); # can't compare anything (yet) after a nohist migrate
This module provides
- validate(), to validate a data store, checking that it can be traversed and that its past record data has not changed, and creating history and transaction files for comparison purposes.
- migrate(), to migrate a data store to a new data store. Use cases:
- The data has outgrown the data store as originally configured - You want a better configuration than originally conceived
- migrate_nohist(), to migrate a data store to a new data store without any update history and without any deleted records. This is normally discouraged (since the spirit of the module is to retain all history of activity), but it has its uses.
- compare(), to compare the files that validate() creates for one data store to the files that validate() creates for a second data store (following a migrate(), most likely). If these files (history, transaction, md5) are exactly equal, then the two data stores are equivalent, i.e., they both contain exactly the same records, even though their data files, etc., may be very differently configured.
Descriptions and parameters for the exportable subroutines are detailed below.
The directory of the data store.
The name of the data store.
The directory of the data store we're migrating from.
The name of the data store we're migrating from.
The directory of the data store we're migrating to.
The name of the data store we're migrating to.
The uri of the data store we're migrating to. If given, a new data store will be initialized. If this parameter is not given, it is assumed that the new data store has already been initialized.
This routine will not keep any record history and will not migrate deleted records.
Intended for post-migration comparisons, this routine writes a "$dir/$name.nohist" data file where each line contains two integers. The first integer is the record sequence number from the from_ds, and the second is from the to_ds. Using these, it should be possible to compare the user data and record data md5 signature from both data stores to verify that the data was migrated completely.
from_ds
to_ds
This routine compares the files written by validate() for each of the data stores to verify that after migration, the second data store contains exactly the same information as the first.
The directory of the data store we migrated from.
The name of the data store we migrated from.
The directory of the data store we migrated to.
The name of the data store we migrated to.
To install FlatFile::DataStore, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FlatFile::DataStore
CPAN shell
perl -MCPAN -e shell install FlatFile::DataStore
For more information on module installation, please visit the detailed CPAN module installation guide.