Skip to content

Commit

Permalink
Split the archive-get and archive-push commands into separate modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwsteele committed Jan 11, 2017
1 parent 155c808 commit 7d1347c
Show file tree
Hide file tree
Showing 35 changed files with 3,656 additions and 3,540 deletions.
32 changes: 25 additions & 7 deletions bin/pgbackrest
Expand Up @@ -18,7 +18,6 @@ use File::Basename qw(dirname);

use lib dirname($0) . '/../lib';

use pgBackRest::Archive::Archive;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Exit;
use pgBackRest::Common::Lock;
Expand Down Expand Up @@ -121,17 +120,36 @@ local $EVAL_ERROR = undef; eval
confess &log(ERROR, 'repo-path \'' . optionGet(OPTION_REPO_PATH) . '\' does not exist', ERROR_PATH_MISSING);
}

################################################################################################################################
# Archive commands must run on the db host
################################################################################################################################
if ((commandTest(CMD_ARCHIVE_PUSH) || commandTest(CMD_ARCHIVE_GET)) && !isDbLocal())
{
confess &log(ERROR, commandGet() . ' command must be run on the db host', ERROR_HOST_INVALID);
}

################################################################################################################################
# Process archive-push command
################################################################################################################################
if (commandTest(CMD_ARCHIVE_PUSH))
{
# Load module dynamically
require pgBackRest::Archive::ArchivePush;
pgBackRest::Archive::ArchivePush->import();

exitSafe(new pgBackRest::Archive::ArchivePush()->process());
}

################################################################################################################################
# Process archive commands
################################################################################################################################
if (commandTest(CMD_ARCHIVE_PUSH) || commandTest(CMD_ARCHIVE_GET))
if (commandTest(CMD_ARCHIVE_GET))
{
if (!isDbLocal())
{
confess &log(ERROR, commandGet() . ' command must be run on the db host', ERROR_HOST_INVALID);
}
# Load module dynamically
require pgBackRest::Archive::ArchiveGet;
pgBackRest::Archive::ArchiveGet->import();

exitSafe(new pgBackRest::Archive::Archive()->process());
exitSafe(new pgBackRest::Archive::ArchiveGet()->process());
}

################################################################################################################################
Expand Down
2 changes: 1 addition & 1 deletion doc/xml/release.xml
Expand Up @@ -209,7 +209,7 @@
</release-item>

<release-item>
<p>Moved the <code>Archive</code> modules to the <path>Archive</path> directory.</p>
<p>Moved the <code>Archive</code> modules to the <path>Archive</path> directory and split the <cmd>archive-get</cmd> and <cmd>archive-push</cmd> commands into separate modules.</p>
</release-item>

<release-item>
Expand Down

0 comments on commit 7d1347c

Please sign in to comment.