2016-09-06 09:35:02 -04:00
|
|
|
####################################################################################################################################
|
|
|
|
# PROTOCOL LOCAL MINION MODULE
|
|
|
|
####################################################################################################################################
|
2017-05-15 11:12:14 -04:00
|
|
|
package pgBackRest::Protocol::Local::Minion;
|
|
|
|
use parent 'pgBackRest::Protocol::Command::Minion';
|
2016-09-06 09:35:02 -04:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings FATAL => qw(all);
|
|
|
|
use Carp qw(confess);
|
|
|
|
|
2017-06-21 08:02:21 -04:00
|
|
|
use pgBackRest::Archive::Push::File;
|
2017-05-15 16:01:00 -04:00
|
|
|
use pgBackRest::Backup::File;
|
2016-09-06 09:35:02 -04:00
|
|
|
use pgBackRest::Common::Log;
|
|
|
|
use pgBackRest::Config::Config;
|
2017-06-09 17:51:41 -04:00
|
|
|
use pgBackRest::Storage::Local;
|
|
|
|
use pgBackRest::Protocol::Base::Master;
|
2017-08-30 08:41:46 -04:00
|
|
|
use pgBackRest::Protocol::Base::Minion;
|
2017-05-15 11:12:14 -04:00
|
|
|
use pgBackRest::Protocol::Command::Minion;
|
|
|
|
use pgBackRest::Protocol::Helper;
|
2016-09-06 09:35:02 -04:00
|
|
|
use pgBackRest::RestoreFile;
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# CONSTRUCTOR
|
|
|
|
####################################################################################################################################
|
|
|
|
sub new
|
|
|
|
{
|
|
|
|
my $class = shift; # Class name
|
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
2017-06-09 17:51:41 -04:00
|
|
|
my ($strOperation) = logDebugParam(__PACKAGE__ . '->new');
|
2016-09-06 09:35:02 -04:00
|
|
|
|
|
|
|
# Init object and store variables
|
2017-08-25 16:47:47 -04:00
|
|
|
my $self = $class->SUPER::new(cfgCommandName(CFGCMD_LOCAL), cfgOption(CFGOPT_BUFFER_SIZE), cfgOption(CFGOPT_PROTOCOL_TIMEOUT));
|
2016-09-06 09:35:02 -04:00
|
|
|
bless $self, $class;
|
|
|
|
|
|
|
|
# Return from function and log return values if any
|
|
|
|
return logDebugReturn
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
{name => 'self', value => $self}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# init
|
|
|
|
####################################################################################################################################
|
|
|
|
sub init
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
my ($strOperation) = logDebugParam(__PACKAGE__ . '->init');
|
|
|
|
|
2016-12-03 17:34:51 -05:00
|
|
|
# Create anonymous subs for each command
|
|
|
|
my $hCommandMap =
|
|
|
|
{
|
2017-06-09 17:51:41 -04:00
|
|
|
&OP_ARCHIVE_PUSH_FILE => sub {archivePushFile(@{shift()})},
|
|
|
|
&OP_BACKUP_FILE => sub {backupFile(@{shift()})},
|
|
|
|
&OP_RESTORE_FILE => sub {restoreFile(@{shift()})},
|
2017-08-30 08:41:46 -04:00
|
|
|
|
|
|
|
# To be run after each command to keep the remote alive
|
|
|
|
&OP_POST => sub {protocolKeepAlive()},
|
2016-12-03 17:34:51 -05:00
|
|
|
};
|
2016-09-06 09:35:02 -04:00
|
|
|
|
2016-12-03 17:34:51 -05:00
|
|
|
# Return from function and log return values if any
|
|
|
|
return logDebugReturn
|
2016-09-06 09:35:02 -04:00
|
|
|
(
|
|
|
|
$strOperation,
|
2016-12-03 17:34:51 -05:00
|
|
|
{name => 'hCommandMap', value => $hCommandMap}
|
|
|
|
);
|
2016-09-06 09:35:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|