Algorithm-History-Levels
view release on metacpan or search on metacpan
lib/Algorithm/History/Levels.pm view on Meta::CPAN
}
undef;
}
$SPEC{group_histories_into_levels} = {
v => 1.1,
summary => 'Group histories into levels',
description => <<'_',
This routine can group a single, linear histories into levels. This is be better
explained by an example. Suppose you produce daily database backups. Your backup
files are named:
mydb.2017-06-13.sql.gz
mydb.2017-06-12.sql.gz
mydb.2017-06-11.sql.gz
mydb.2017-06-10.sql.gz
mydb.2017-06-09.sql.gz
...
After a while, your backups grow into tens and then hundreds of dump files. You
typically want to keep certain number of backups only, for example: 7 daily
backups, 4 weekly backups, 6 monthly backups (so you practically have 6 months
of history but do not need to store 6*30 = 180 dumps, only 7 + 4 + 6 = 17). This
is the routine you can use to select which files to keep and which to discard.
You provide the list of histories either in the form of Unix timestamps:
[1497286800, 1497200400, 1497114000, ...]
or in the form of `[name, timestamp]` pairs, e.g.:
[
lib/Algorithm/History/Levels.pm view on Meta::CPAN
=head2 group_histories_into_levels
Usage:
group_histories_into_levels(%args) -> any
Group histories into levels.
This routine can group a single, linear histories into levels. This is be better
explained by an example. Suppose you produce daily database backups. Your backup
files are named:
mydb.2017-06-13.sql.gz
mydb.2017-06-12.sql.gz
mydb.2017-06-11.sql.gz
mydb.2017-06-10.sql.gz
mydb.2017-06-09.sql.gz
...
After a while, your backups grow into tens and then hundreds of dump files. You
typically want to keep certain number of backups only, for example: 7 daily
backups, 4 weekly backups, 6 monthly backups (so you practically have 6 months
of history but do not need to store 6*30 = 180 dumps, only 7 + 4 + 6 = 17). This
is the routine you can use to select which files to keep and which to discard.
You provide the list of histories either in the form of Unix timestamps:
[1497286800, 1497200400, 1497114000, ...]
or in the form of C<[name, timestamp]> pairs, e.g.:
[
( run in 1.563 second using v1.01-cache-2.11-cpan-49f99fa48dc )