NAME
App::MBUtiny::Collector - Collector class
VIRSION
Version 1.03
SYNOPSIS
use App::MBUtiny::Collector;
my $collector_config = [
{
url => 'https://user:pass@example.com/mbutiny',
comment => 'Remote collector said blah-blah-blah',
timeout => 180
},
{
comment => 'Local collector said blah-blah-blah',
},
# ...
];
my $collector = new App::MBUtiny::Collector(
collector_config => $collector_config,
dbi => $dbi, # App::MBUtiny::Collector::DBI object
);
my $colret = $collector->check;
print STDERR $collector->error if $collector->error;
DESCRIPTION
Collector class
new
my $collector = new App::MBUtiny::Collector(
collector_config => [{}, {}, ...],
dbi_config => {...}, # App::MBUtiny::Collector::DBI arguments
dbi => $dbi, # App::MBUtiny::Collector::DBI object
);
Creates the collector object with local database supporting
- collector_config
-
collector_config => [ { url => 'https://user:pass@example.com/mbutiny', comment => 'Remote collector said blah-blah-blah', timeout => 180 }, { comment => 'Local collector said blah-blah-blah', }, # ... ],
Array of attributes for initializing specified collectors
- dbi
-
dbi => new App::MBUtiny::Collector::DBI(...),
Sets pre-initialized App::MBUtiny::Collector::DBI object
- dbi_config
-
dbi_config => {...},
Hash of App::MBUtiny::Collector::DBI arguments
check
my @collector_ids = $collector->check;
my $collector_ids = $collector->check; # text notation
Checks clist of available collectors and returns list of checked collectors as URLs or DSNs
See also "error" method
collectors
my @collector_list = $collector->collectora;
Returns list of initialized collectors
dbi
my $dbi = $collector->dbi;
Returns DBI object of local database (local collector)
error
print $collector->error("Foo"); # Foo
print $collector->error("Bar"); # Foo\nBar
print $collector->error; # Foo\nBar
print $collector->error(""); # <"">
Sets and gets the error pool
fixup
my @collector_ids = $collector->fixup(
operation => "del",
name => "foo",
file => "foo-2019-06-25.tar.gz",
);
Fixation of the "del" operation on current storage
my @collector_ids = $collector->fixup(
operation => "put",
name => "foo",
file => "foo-2019-06-25.tar.gz",
size => 123453,
md5 => "...",
sha1 => "...",
status => 1,
error => "...",
comment => "...",
);
Fixation of the "put" operation on current storage
- comment
-
Comment of the "put" operation
Scope: put
- error
-
Error message of the performed operation
Scope: put
- file
-
Name of backup file. Required argument
Scope: put, del
- md5, sha1
-
MD5 and SHA1 checksums of backup file
Scope: put
- name
-
Name of backup. Required argument
Scope: put, del
- operation
-
Name of operation: del/put
Default: put
- size
-
Size of backup file
Scope: put
- status
-
Status of backup operation: 0 or 1
Default: 0 (operation failed)
Scope: put
info
my %info = $collector->info(
name => "foo",
file => "foo-2019-06-25.tar.gz",
);
Gets information about specified file name
Returns hash of values in "AS IN DATABASE DEFINED" format, see App::MBUtiny::Collector::DBI
report
my @last_backup_files = $collector->report( start => 123456789 );
Returns list of last backups from all collectors as array of info-hashes.
See "info" method
PUBLIC FUNCTIONS
int2type
my $type = int2type(0); # internal
Returns name of specified type
NOTE: This variable NOT imported automatically
VARIABLES
COLLECTOR_TYPES
Returns hash-structure ("type_name" => int_value) of available collector types
NOTE: This variable imported automatically
HISTORY
See Changes
file
TO DO
See TODO
file
SEE ALSO
AUTHOR
Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>
COPYRIGHT
Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See LICENSE
file and https://dev.perl.org/licenses/