1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-13 01:00:23 +02:00

Improve protocol handlers.

Make protocol handlers have one function per command. This allows the logic of finding the handler to be in ProtocolServer, isolates each command to a function, and removes the need to test the "not found" condition for each handler.
This commit is contained in:
David Steele
2021-03-16 13:09:34 -04:00
committed by GitHub
parent b1d945ebb7
commit 2016fac0d9
34 changed files with 866 additions and 611 deletions

View File

@ -235,7 +235,7 @@ testRun(void)
}
// *****************************************************************************************************************************
if (testBegin("Synchronous cmdArchivePush(), archivePushFile() and archivePushProtocol()"))
if (testBegin("Synchronous cmdArchivePush(), archivePushFile() and archivePushFileProtocol()"))
{
TEST_TITLE("command must be run on the pg host");
@ -445,8 +445,7 @@ testRun(void)
varLstAdd(paramList, varNewUInt64(cipherTypeNone));
varLstAdd(paramList, NULL);
TEST_RESULT_BOOL(
archivePushProtocol(PROTOCOL_COMMAND_ARCHIVE_PUSH_STR, paramList, server), true, "protocol archive put");
TEST_RESULT_VOID(archivePushFileProtocol(paramList, server), "protocol archive put");
TEST_RESULT_STR_Z(
strNewBuf(serverWrite),
"{\"out\":[[\"WAL file '000000010000000100000002' already exists in the repo1 archive with the same checksum"
@ -455,10 +454,6 @@ testRun(void)
bufUsedSet(serverWrite, 0);
// Check invalid protocol function
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_BOOL(archivePushProtocol(strNew(BOGUS_STR), paramList, server), false, "invalid function");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("multiple repos, one encrypted");