mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Add infoArchiveMove() and infoBackupMove().
This commit is contained in:
parent
5941f5631a
commit
ecb112f802
@ -35,6 +35,7 @@ struct InfoArchive
|
|||||||
InfoPg *infoPg; // Contents of the DB data
|
InfoPg *infoPg; // Contents of the DB data
|
||||||
};
|
};
|
||||||
|
|
||||||
|
OBJECT_DEFINE_MOVE(INFO_ARCHIVE);
|
||||||
OBJECT_DEFINE_FREE(INFO_ARCHIVE);
|
OBJECT_DEFINE_FREE(INFO_ARCHIVE);
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -43,6 +43,9 @@ Functions
|
|||||||
const String *infoArchiveIdHistoryMatch(
|
const String *infoArchiveIdHistoryMatch(
|
||||||
const InfoArchive *this, const unsigned int historyId, const unsigned int pgVersion, const uint64_t pgSystemId);
|
const InfoArchive *this, const unsigned int historyId, const unsigned int pgVersion, const uint64_t pgSystemId);
|
||||||
|
|
||||||
|
// Move to a new parent mem context
|
||||||
|
InfoArchive *infoArchiveMove(InfoArchive *this, MemContext *parentNew);
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Getters/Setters
|
Getters/Setters
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
|
@ -64,6 +64,7 @@ struct InfoBackup
|
|||||||
List *backup; // List of current backups and their associated data
|
List *backup; // List of current backups and their associated data
|
||||||
};
|
};
|
||||||
|
|
||||||
|
OBJECT_DEFINE_MOVE(INFO_BACKUP);
|
||||||
OBJECT_DEFINE_FREE(INFO_BACKUP);
|
OBJECT_DEFINE_FREE(INFO_BACKUP);
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
|
@ -74,6 +74,9 @@ void infoBackupDataAdd(const InfoBackup *this, const Manifest *manifest);
|
|||||||
// Delete backup from the current backup list
|
// Delete backup from the current backup list
|
||||||
void infoBackupDataDelete(const InfoBackup *this, const String *backupDeleteLabel);
|
void infoBackupDataDelete(const InfoBackup *this, const String *backupDeleteLabel);
|
||||||
|
|
||||||
|
// Move to a new parent mem context
|
||||||
|
InfoBackup *infoBackupMove(InfoBackup *this, MemContext *parentNew);
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Getters/Setters
|
Getters/Setters
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
|
@ -35,7 +35,14 @@ testRun(void)
|
|||||||
|
|
||||||
InfoArchive *info = NULL;
|
InfoArchive *info = NULL;
|
||||||
|
|
||||||
TEST_ASSIGN(info, infoArchiveNewLoad(ioBufferReadNew(contentLoad)), " load new archive info");
|
// Load and test move function
|
||||||
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
|
{
|
||||||
|
TEST_ASSIGN(info, infoArchiveNewLoad(ioBufferReadNew(contentLoad)), "load new archive info");
|
||||||
|
TEST_RESULT_VOID(infoArchiveMove(info, memContextPrior()), " move info");
|
||||||
|
}
|
||||||
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(infoArchiveId(info), "9.4-1", " archiveId set");
|
TEST_RESULT_STR_Z(infoArchiveId(info), "9.4-1", " archiveId set");
|
||||||
TEST_RESULT_PTR(infoArchivePg(info), info->infoPg, " infoPg set");
|
TEST_RESULT_PTR(infoArchivePg(info), info->infoPg, " infoPg set");
|
||||||
TEST_RESULT_STR(infoArchiveCipherPass(info), NULL, " no cipher sub");
|
TEST_RESULT_STR(infoArchiveCipherPass(info), NULL, " no cipher sub");
|
||||||
|
@ -40,9 +40,15 @@ testRun(void)
|
|||||||
"\"db-version\":\"9.4\"}\n"
|
"\"db-version\":\"9.4\"}\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Load to make sure ignore-section is ignored
|
InfoBackup *infoBackup = NULL;
|
||||||
InfoBackup *infoBackup;
|
|
||||||
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(contentLoad)), " new backup info");
|
// Load and test move function then make sure ignore-section is ignored
|
||||||
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
|
{
|
||||||
|
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(contentLoad)), "new backup info");
|
||||||
|
TEST_RESULT_VOID(infoBackupMove(infoBackup, memContextPrior()), " move info");
|
||||||
|
}
|
||||||
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
// Save to verify with new created info backup
|
// Save to verify with new created info backup
|
||||||
Buffer *contentSave = bufNew(0);
|
Buffer *contentSave = bufNew(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user