You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-03 00:26:59 +02:00
storageFileRead() accepts a buffer for output rather than creating one.
This is more efficient overall and allows the caller to specify how many bytes will be read on each call. Reads are appended if the buffer already contains data but the buffer size will never increase. Allow Buffer object "used size" to be different than "allocated size". Add functions to manage used size and remaining size and update automatically when possible.
This commit is contained in:
@ -116,7 +116,10 @@ testRun()
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
String *controlFile = strNew("db/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL);
|
||||
PgControlFile control = {.systemId = 0xFACEFACE, .controlVersion = 1002, .catalogVersion = 201707211};
|
||||
storagePutNP(storageNewWriteNP(storageTest, controlFile), bufNewC(sizeof(PgControlFile), &control));
|
||||
Buffer *controlBuffer = bufNew(512);
|
||||
memcpy(bufPtr(controlBuffer), &control, sizeof(PgControlFile));
|
||||
bufUsedSet(controlBuffer, bufSize(controlBuffer));
|
||||
storagePutNP(storageNewWriteNP(storageTest, controlFile), controlBuffer);
|
||||
|
||||
storagePathCreateNP(storageTest, strNewFmt("%s/db/pg_wal", testPath()));
|
||||
|
||||
|
Reference in New Issue
Block a user