mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Remove storageRead() and storageWriteDriver().
These functions were only being used in the tests. This usage likely dates to before the include directive was available in define.yaml.
This commit is contained in:
parent
1214f1d70b
commit
f3ae74b0d6
@ -60,21 +60,6 @@ storageReadNew(void *driver, const StorageReadInterface *interface)
|
||||
FUNCTION_LOG_RETURN(STORAGE_READ, this);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get file driver
|
||||
***********************************************************************************************************************************/
|
||||
void *
|
||||
storageRead(const StorageRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
|
||||
FUNCTION_TEST_RETURN(this->driver);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Should a missing file be ignored?
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -23,9 +23,4 @@ typedef struct StorageReadInterface
|
||||
|
||||
StorageRead *storageReadNew(void *driver, const StorageReadInterface *interface);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
void *storageRead(const StorageRead *this);
|
||||
|
||||
#endif
|
||||
|
@ -93,21 +93,6 @@ storageWriteCreatePath(const StorageWrite *this)
|
||||
FUNCTION_TEST_RETURN(this->interface->createPath);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get file driver
|
||||
***********************************************************************************************************************************/
|
||||
void *
|
||||
storageWriteDriver(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
|
||||
FUNCTION_TEST_RETURN(this->driver);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get the IO object
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -38,9 +38,4 @@ typedef struct StorageWriteInterface
|
||||
|
||||
StorageWrite *storageWriteNew(void *driver, const StorageWriteInterface *interface);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
void *storageWriteDriver(const StorageWrite *this);
|
||||
|
||||
#endif
|
||||
|
@ -443,6 +443,9 @@ unit:
|
||||
storage/helper: full
|
||||
storage/storage: full
|
||||
|
||||
include:
|
||||
- storage/write
|
||||
|
||||
# ********************************************************************************************************************************
|
||||
- name: protocol
|
||||
|
||||
|
@ -756,7 +756,7 @@ testRun(void)
|
||||
"new write file (set mode)");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageWriteIo(file)), " close file");
|
||||
TEST_RESULT_VOID(storageWritePosixClose(storageWriteDriver(file)), " close file again");
|
||||
TEST_RESULT_VOID(storageWritePosixClose(file->driver), " close file again");
|
||||
TEST_RESULT_INT(storageInfoP(storageTest, strPath(fileName)).mode, 0700, " check path mode");
|
||||
TEST_RESULT_INT(storageInfoP(storageTest, fileName).mode, 0600, " check file mode");
|
||||
}
|
||||
@ -853,7 +853,6 @@ testRun(void)
|
||||
StorageRead *file = NULL;
|
||||
|
||||
TEST_ASSIGN(file, storageNewReadP(storageTest, fileNoPerm, .ignoreMissing = true, .limit = VARUINT64(44)), "new read file");
|
||||
TEST_RESULT_PTR(storageRead(file), file->driver, " check driver");
|
||||
TEST_RESULT_BOOL(storageReadIgnoreMissing(file), true, " check ignore missing");
|
||||
TEST_RESULT_STR(storageReadName(file), fileNoPerm, " check name");
|
||||
TEST_RESULT_UINT(varUInt64(storageReadLimit(file)), 44, " check limit");
|
||||
@ -925,9 +924,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(ioRead(storageReadIo(file), outBuffer), " no data to load");
|
||||
TEST_RESULT_UINT(bufUsed(outBuffer), 0, " buffer is empty");
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
storageReadPosix(storageRead(file), outBuffer, true),
|
||||
" no data to load from driver either");
|
||||
TEST_RESULT_VOID(storageReadPosix(file->driver, outBuffer, true), " no data to load from driver either");
|
||||
TEST_RESULT_UINT(bufUsed(outBuffer), 0, " buffer is empty");
|
||||
|
||||
TEST_RESULT_BOOL(bufEq(buffer, expectedBuffer), true, " check file contents (all loaded)");
|
||||
@ -957,7 +954,6 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_BOOL(storageWriteAtomic(file), false, " check atomic");
|
||||
TEST_RESULT_BOOL(storageWriteCreatePath(file), false, " check create path");
|
||||
TEST_RESULT_PTR(storageWriteDriver(file), file->driver, " check file driver");
|
||||
TEST_RESULT_INT(storageWriteModeFile(file), 0444, " check mode file");
|
||||
TEST_RESULT_INT(storageWriteModePath(file), 0555, " check mode path");
|
||||
TEST_RESULT_STR(storageWriteName(file), fileNoPerm, " check name");
|
||||
@ -990,17 +986,17 @@ testRun(void)
|
||||
storageRemoveP(storageTest, fileTmp, .errorOnMissing = true);
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageWritePosix(storageWriteDriver(file), buffer), FileWriteError,
|
||||
storageWritePosix(file->driver, buffer), FileWriteError,
|
||||
"unable to write '%s.pgbackrest.tmp': [9] Bad file descriptor", strPtr(fileName));
|
||||
TEST_ERROR_FMT(
|
||||
storageWritePosixClose(storageWriteDriver(file)), FileSyncError, STORAGE_ERROR_WRITE_SYNC ": [9] Bad file descriptor",
|
||||
storageWritePosixClose(file->driver), FileSyncError, STORAGE_ERROR_WRITE_SYNC ": [9] Bad file descriptor",
|
||||
strPtr(fileTmp));
|
||||
|
||||
// Disable file sync so close() can be reached
|
||||
((StorageWritePosix *)file->driver)->interface.syncFile = false;
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageWritePosixClose(storageWriteDriver(file)), FileCloseError, STORAGE_ERROR_WRITE_CLOSE ": [9] Bad file descriptor",
|
||||
storageWritePosixClose(file->driver), FileCloseError, STORAGE_ERROR_WRITE_CLOSE ": [9] Bad file descriptor",
|
||||
strPtr(fileTmp));
|
||||
|
||||
// Set file handle to -1 so the close on free with not fail
|
||||
|
@ -395,9 +395,7 @@ testRun(void)
|
||||
TEST_RESULT_BOOL(bufEq(storageGetP(fileRead), contentBuf), true, "get file");
|
||||
TEST_RESULT_BOOL(storageReadIgnoreMissing(fileRead), false, "check ignore missing");
|
||||
TEST_RESULT_STR_Z(storageReadName(fileRead), hrnReplaceKey("{[path]}/repo/test.txt"), "check name");
|
||||
TEST_RESULT_UINT(
|
||||
storageReadRemote(storageRead(fileRead), bufNew(32), false), 0,
|
||||
"nothing more to read");
|
||||
TEST_RESULT_UINT(storageReadRemote(fileRead->driver, bufNew(32), false), 0, "nothing more to read");
|
||||
|
||||
TEST_ASSIGN(fileRead, storageNewReadP(storageRemote, strNew("test.txt")), "get file");
|
||||
TEST_RESULT_BOOL(bufEq(storageGetP(fileRead), contentBuf), true, " check contents");
|
||||
@ -549,7 +547,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_VOID(storagePutP(write, contentBuf), "write file");
|
||||
TEST_RESULT_UINT(((StorageWriteRemote *)write->driver)->protocolWriteBytes, bufSize(contentBuf), " check write size");
|
||||
TEST_RESULT_VOID(storageWriteRemoteClose((StorageWriteRemote *)storageWriteDriver(write)), "close file again");
|
||||
TEST_RESULT_VOID(storageWriteRemoteClose(write->driver), "close file again");
|
||||
TEST_RESULT_VOID(storageWriteFree(write), "free file");
|
||||
|
||||
// Make sure the file was written correctly
|
||||
|
@ -813,7 +813,7 @@ testRun(void)
|
||||
TEST_RESULT_BOOL(storageWriteSyncFile(write), true, "file is synced");
|
||||
TEST_RESULT_BOOL(storageWriteSyncPath(write), true, "path is synced");
|
||||
|
||||
TEST_RESULT_VOID(storageWriteS3Close((StorageWriteS3 *)storageWriteDriver(write)), "close file again");
|
||||
TEST_RESULT_VOID(storageWriteS3Close(write->driver), "close file again");
|
||||
|
||||
// Zero-length file
|
||||
TEST_ASSIGN(write, storageNewWriteP(s3, strNew("file.txt")), "new write file");
|
||||
|
Loading…
Reference in New Issue
Block a user