Skip to content
Permalink
Browse files

Simplify storage object names.

Remove "File" and "Driver" from object names so they are shorter and easier to keep consistent.

Also remove the "driver" directory so storage implementations are visible directly under "storage".
  • Loading branch information...
dwsteele committed May 3, 2019
1 parent 8c712d8 commit 32ca27a20b13941cfab27672d6f383a0ba44fa20
Showing with 1,201 additions and 1,181 deletions.
  1. +4 −0 doc/xml/release.xml
  2. +1 −1 lib/pgBackRest/LibCAuto.pm
  3. +1 −1 lib/pgBackRest/Storage/Cifs/Driver.pm
  4. +2 −2 lib/pgBackRest/Storage/Posix/Driver.pm
  5. +1 −1 lib/pgBackRest/Storage/S3/Driver.pm
  6. +1 −1 libc/LibC.xs
  7. +6 −6 libc/Makefile.PL
  8. +1 −1 libc/build/lib/pgBackRestLibC/Build.pm
  9. +2 −2 libc/xs/storage/storage.xs
  10. +64 −64 src/Makefile.in
  11. +2 −2 src/command/archive/get/file.c
  12. +2 −2 src/command/archive/get/get.c
  13. +3 −3 src/command/archive/push/file.c
  14. +2 −2 src/command/remote/remote.c
  15. +1 −1 src/common/exec.c
  16. +1 −1 src/common/io/read.c
  17. +1 −1 src/common/io/write.c
  18. +3 −3 src/info/info.c
  19. +2 −2 src/perl/embed.auto.c
  20. +5 −5 src/perl/libc.auto.c
  21. +7 −9 src/storage/{driver → }/cifs/storage.c
  22. +7 −7 src/storage/{driver → }/cifs/storage.h
  23. +20 −20 src/storage/helper.c
  24. +4 −5 src/storage/{driver → }/posix/common.c
  25. +5 −5 src/storage/{driver → }/posix/common.h
  26. +47 −47 src/storage/{driver/posix/fileRead.c → posix/read.c}
  27. +6 −6 src/storage/{driver/s3/fileRead.h → posix/read.h}
  28. +80 −82 src/storage/{driver → }/posix/storage.c
  29. +8 −8 src/storage/{driver → }/posix/storage.h
  30. +11 −11 src/storage/{driver → }/posix/storage.intern.h
  31. +50 −50 src/storage/{driver/posix/fileWrite.c → posix/write.c}
  32. +7 −8 src/storage/{driver/posix/fileWrite.h → posix/write.h}
  33. +30 −30 src/storage/{fileRead.c → read.c}
  34. +15 −15 src/storage/{fileRead.h → read.h}
  35. +8 −8 src/storage/{fileRead.intern.h → read.intern.h}
  36. +12 −12 src/storage/{driver → }/remote/protocol.c
  37. +4 −4 src/storage/{driver → }/remote/protocol.h
  38. +35 −35 src/storage/{driver/remote/fileRead.c → remote/read.c}
  39. +6 −7 src/storage/{driver/remote/fileRead.h → remote/read.h}
  40. +50 −50 src/storage/{driver → }/remote/storage.c
  41. +7 −7 src/storage/{driver → }/remote/storage.h
  42. +9 −9 src/storage/{driver → }/remote/storage.intern.h
  43. +38 −38 src/storage/{driver/remote/fileWrite.c → remote/write.c}
  44. +7 −7 src/storage/{driver/remote/fileWrite.h → remote/write.h}
  45. +35 −35 src/storage/{driver/s3/fileRead.c → s3/read.c}
  46. +6 −6 src/storage/{driver/s3/fileWrite.h → s3/read.h}
  47. +63 −63 src/storage/{driver → }/s3/storage.c
  48. +10 −10 src/storage/{driver → }/s3/storage.h
  49. +18 −18 src/storage/{driver → }/s3/storage.intern.h
  50. +41 −41 src/storage/{driver/s3/fileWrite.c → s3/write.c}
  51. +6 −6 src/storage/{driver/posix/fileRead.h → s3/write.h}
  52. +42 −42 src/storage/storage.c
  53. +8 −8 src/storage/storage.h
  54. +5 −5 src/storage/storage.intern.h
  55. +42 −43 src/storage/{fileWrite.c → write.c}
  56. +21 −21 src/storage/{fileWrite.h → write.h}
  57. +8 −8 src/storage/{fileWrite.intern.h → write.intern.h}
  58. +63 −39 test/code-count/file-type.yaml
  59. +15 −15 test/define.yaml
  60. +2 −2 test/src/module/command/archiveCommonTest.c
  61. +6 −6 test/src/module/command/archiveGetTest.c
  62. +4 −4 test/src/module/command/archivePushTest.c
  63. +1 −1 test/src/module/command/backupCommonTest.c
  64. +2 −2 test/src/module/command/controlTest.c
  65. +2 −2 test/src/module/command/helpTest.c
  66. +2 −2 test/src/module/command/infoTest.c
  67. +2 −2 test/src/module/command/remoteTest.c
  68. +4 −4 test/src/module/common/iniTest.c
  69. +2 −2 test/src/module/common/lockTest.c
  70. +4 −4 test/src/module/info/infoTest.c
  71. +2 −2 test/src/module/postgres/interfaceTest.c
  72. +2 −2 test/src/module/protocol/protocolTest.c
  73. +3 −3 test/src/module/storage/cifsTest.c
  74. +116 −116 test/src/module/storage/posixTest.c
  75. +28 −28 test/src/module/storage/remoteTest.c
  76. +58 −58 test/src/module/storage/s3Test.c
@@ -67,6 +67,10 @@
<p>Various <code>Buffer</code> improvements.</p>
</release-item>

<release-item>
<p>Simplify storage object names.</p>
</release-item>

<release-item>
<p>Add <code>ioWriteStr()</code> and <code>ioWriteStrLine()</code>.</p>
</release-item>
@@ -343,7 +343,7 @@ sub libcAutoExportTag

storage =>
[
'storageDriverPosixPathRemove',
'storagePosixPathRemove',
],

test =>
@@ -1,5 +1,5 @@
####################################################################################################################################
# CIFS Storage Driver
# CIFS Storage
#
# Implements storage functions for Posix-compliant file systems.
####################################################################################################################################
@@ -1,5 +1,5 @@
####################################################################################################################################
# Posix Storage Driver
# Posix Storage
#
# Implements storage functions for Posix-compliant file systems.
####################################################################################################################################
@@ -923,7 +923,7 @@ sub remove
require pgBackRest::LibC;
pgBackRest::LibC->import(qw(:storage));

storageDriverPosixPathRemove($strPathFile, !$bIgnoreMissing, $bRecurse)
storagePosixPathRemove($strPathFile, !$bIgnoreMissing, $bRecurse)
}
# Only remove the specified file
else
@@ -1,5 +1,5 @@
####################################################################################################################################
# S3 Storage Driver
# S3 Storage
####################################################################################################################################
package pgBackRest::Storage::S3::Driver;
use parent 'pgBackRest::Storage::S3::Request';
@@ -57,7 +57,7 @@ These includes are from the src directory. There is no Perl-specific code in th
#include "config/parse.h"
#include "perl/config.h"
#include "postgres/pageChecksum.h"
#include "storage/driver/posix/storage.h"
#include "storage/posix/storage.h"

/***********************************************************************************************************************************
Helper macros
@@ -87,14 +87,14 @@ my @stryCFile =
'config/parse.c',
'perl/config.c',
'postgres/pageChecksum.c',
'storage/driver/posix/storage.c',
'storage/driver/posix/common.c',
'storage/driver/posix/fileRead.c',
'storage/driver/posix/fileWrite.c',
'storage/fileRead.c',
'storage/fileWrite.c',
'storage/posix/common.c',
'storage/posix/read.c',
'storage/posix/storage.c',
'storage/posix/write.c',
'storage/helper.c',
'storage/read.c',
'storage/storage.c',
'storage/write.c',
);

# Add ../src for files that are outside libc
@@ -149,7 +149,7 @@ my $rhExport =
'storage' =>
{
&BLD_EXPORTTYPE_SUB => [qw(
storageDriverPosixPathRemove
storagePosixPathRemove
)],
},

@@ -6,15 +6,15 @@ MODULE = pgBackRest::LibC PACKAGE = pgBackRest::LibC

####################################################################################################################################
void
storageDriverPosixPathRemove(path, errorOnMissing, recurse)
storagePosixPathRemove(path, errorOnMissing, recurse)
const char *path
bool errorOnMissing
bool recurse
CODE:
MEM_CONTEXT_XS_TEMP_BEGIN()
{
storagePathRemoveP(
storageDriverPosixNew(strNew("/"), 0640, 750, true, NULL), strNew(path), .errorOnMissing = errorOnMissing,
storagePosixNew(strNew("/"), 0640, 750, true, NULL), strNew(path), .errorOnMissing = errorOnMissing,
.recurse = recurse);
}
MEM_CONTEXT_XS_TEMP_END();

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -142,7 +142,7 @@ archiveGetFile(

if (archiveGetCheckResult.archiveFileActual != NULL)
{
StorageFileWrite *destination = storageNewWriteP(
StorageWrite *destination = storageNewWriteP(
storage, walDestination, .noCreatePath = true, .noSyncFile = !durable, .noSyncPath = !durable,
.noAtomic = !durable);

@@ -160,7 +160,7 @@ archiveGetFile(
if (strEndsWithZ(archiveGetCheckResult.archiveFileActual, "." GZIP_EXT))
ioFilterGroupAdd(filterGroup, gzipDecompressNew(false));

ioWriteFilterGroupSet(storageFileWriteIo(destination), filterGroup);
ioWriteFilterGroupSet(storageWriteIo(destination), filterGroup);

// Copy the file
storageCopyNP(
@@ -163,7 +163,7 @@ cmdArchiveGet(void)
if (found)
{
// Source is the WAL segment in the spool queue
StorageFileRead *source = storageNewReadNP(
StorageRead *source = storageNewReadNP(
storageSpool(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s", strPtr(walSegment)));

// A move will be attempted but if the spool queue and the WAL path are on different file systems then a copy
@@ -173,7 +173,7 @@ cmdArchiveGet(void)
// is safe because if the system crashes Postgres will not try to reuse a restored WAL segment but will instead
// request it again using the restore_command. In the case of a move this hardly matters since path syncs are
// cheap but if a copy is required we could save a lot of writes.
StorageFileWrite *destination = storageNewWriteP(
StorageWrite *destination = storageNewWriteP(
storageLocalWrite(), walDestination, .noCreatePath = true, .noSyncFile = true, .noSyncPath = true,
.noAtomic = true);

@@ -73,7 +73,7 @@ archivePushFile(
if (isSegment)
{
// Generate a sha1 checksum for the wal segment. ??? Probably need a function in storage for this.
IoRead *read = storageFileReadIo(storageNewReadNP(storageLocal(), walSource));
IoRead *read = storageReadIo(storageNewReadNP(storageLocal(), walSource));
IoFilterGroup *filterGroup = ioFilterGroupAdd(ioFilterGroupNew(), cryptoHashNew(HASH_TYPE_SHA1_STR));
ioReadFilterGroupSet(read, filterGroup);

@@ -117,7 +117,7 @@ archivePushFile(
// Only copy if the file was not found in the archive
if (walSegmentFile == NULL)
{
StorageFileRead *source = storageNewReadNP(storageLocal(), walSource);
StorageRead *source = storageNewReadNP(storageLocal(), walSource);

// Add filters
IoFilterGroup *filterGroup = ioFilterGroupNew();
@@ -133,7 +133,7 @@ archivePushFile(
if (cipherType != cipherTypeNone)
ioFilterGroupAdd(filterGroup, cipherBlockNew(cipherModeEncrypt, cipherType, BUFSTR(cipherPass), NULL));

ioReadFilterGroupSet(storageFileReadIo(source), filterGroup);
ioReadFilterGroupSet(storageReadIo(source), filterGroup);

// Copy the file
storageCopyNP(
@@ -13,7 +13,7 @@ Remote Command
#include "config/protocol.h"
#include "protocol/helper.h"
#include "protocol/server.h"
#include "storage/driver/remote/protocol.h"
#include "storage/remote/protocol.h"

/***********************************************************************************************************************************
Remote command
@@ -32,7 +32,7 @@ cmdRemote(int handleRead, int handleWrite)
ioWriteOpen(write);

ProtocolServer *server = protocolServerNew(name, PROTOCOL_SERVICE_REMOTE_STR, read, write);
protocolServerHandlerAdd(server, storageDriverRemoteProtocol);
protocolServerHandlerAdd(server, storageRemoteProtocol);
protocolServerHandlerAdd(server, configProtocol);

// Acquire a lock if this command needs one. We'll use the noop that is always sent from the client right after the
@@ -38,7 +38,7 @@ struct Exec
int handleWrite; // Write handle
int handleError; // Error handle

IoRead *ioReadHandle; // Handle read driver
IoRead *ioReadHandle; // Handle read interface
IoWrite *ioWriteHandle; // Handle write interface

IoRead *ioReadExec; // Wrapper for handle read interface
@@ -16,7 +16,7 @@ Object type
***********************************************************************************************************************************/
struct IoRead
{
MemContext *memContext; // Mem context of driver
MemContext *memContext; // Mem context
void *driver; // Driver object
IoReadInterface interface; // Driver interface
IoFilterGroup *filterGroup; // IO filters
@@ -16,7 +16,7 @@ Object type
***********************************************************************************************************************************/
struct IoWrite
{
MemContext *memContext; // Mem context of driver
MemContext *memContext; // Mem context
void *driver; // Driver object
IoWriteInterface interface; // Driver interface
IoFilterGroup *filterGroup; // IO filters
@@ -142,12 +142,12 @@ infoLoad(Info *this, const Storage *storage, const String *fileName, bool copyFi
const String *fileNameExt = copyFile ? strNewFmt("%s" INFO_COPY_EXT, strPtr(fileName)) : fileName;

// Attempt to load the file
StorageFileRead *infoRead = storageNewReadNP(storage, fileNameExt);
StorageRead *infoRead = storageNewReadNP(storage, fileNameExt);

if (cipherType != cipherTypeNone)
{
ioReadFilterGroupSet(
storageFileReadIo(infoRead),
storageReadIo(infoRead),
ioFilterGroupAdd(ioFilterGroupNew(), cipherBlockNew(cipherModeDecrypt, cipherType, BUFSTR(cipherPass), NULL)));
}

@@ -328,7 +328,7 @@ infoSave(
iniSet(ini, INFO_SECTION_BACKREST_STR, INFO_KEY_CHECKSUM_STR, jsonFromStr(infoHash(ini)));

// Save info file
IoWrite *infoWrite = storageFileWriteIo(storageNewWriteNP(storage, fileName));
IoWrite *infoWrite = storageWriteIo(storageNewWriteNP(storage, fileName));

if (cipherType != cipherTypeNone)
{
@@ -9651,7 +9651,7 @@ static const EmbeddedModule embeddedModule[] =
"\n"
"storage =>\n"
"[\n"
"'storageDriverPosixPathRemove',\n"
"'storagePosixPathRemove',\n"
"],\n"
"\n"
"test =>\n"
@@ -18395,7 +18395,7 @@ static const EmbeddedModule embeddedModule[] =
"require pgBackRest::LibC;\n"
"pgBackRest::LibC->import(qw(:storage));\n"
"\n"
"storageDriverPosixPathRemove($strPathFile, !$bIgnoreMissing, $bRecurse)\n"
"storagePosixPathRemove($strPathFile, !$bIgnoreMissing, $bRecurse)\n"
"}\n"
"\n"
"else\n"
@@ -65,7 +65,7 @@ These includes are from the src directory. There is no Perl-specific code in th
#include "config/parse.h"
#include "perl/config.h"
#include "postgres/pageChecksum.h"
#include "storage/driver/posix/storage.h"
#include "storage/posix/storage.h"

/***********************************************************************************************************************************
Helper macros
@@ -274,8 +274,8 @@ XS_EUPXS(XS_pgBackRest__LibC_libcUvSize)
/* INCLUDE: Including 'xs/storage/storage.xs' from 'xs/postgres/pageChecksum.xs' */


XS_EUPXS(XS_pgBackRest__LibC_storageDriverPosixPathRemove); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_pgBackRest__LibC_storageDriverPosixPathRemove)
XS_EUPXS(XS_pgBackRest__LibC_storagePosixPathRemove); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_pgBackRest__LibC_storagePosixPathRemove)
{
dVAR; dXSARGS;
if (items != 3)
@@ -290,7 +290,7 @@ XS_EUPXS(XS_pgBackRest__LibC_storageDriverPosixPathRemove)
MEM_CONTEXT_XS_TEMP_BEGIN()
{
storagePathRemoveP(
storageDriverPosixNew(strNew("/"), 0640, 750, true, NULL), strNew(path), .errorOnMissing = errorOnMissing,
storagePosixNew(strNew("/"), 0640, 750, true, NULL), strNew(path), .errorOnMissing = errorOnMissing,
.recurse = recurse);
}
MEM_CONTEXT_XS_TEMP_END();
@@ -1250,7 +1250,7 @@ XS_EXTERNAL(boot_pgBackRest__LibC)
#endif

newXS_deffile("pgBackRest::LibC::libcUvSize", XS_pgBackRest__LibC_libcUvSize);
newXS_deffile("pgBackRest::LibC::storageDriverPosixPathRemove", XS_pgBackRest__LibC_storageDriverPosixPathRemove);
newXS_deffile("pgBackRest::LibC::storagePosixPathRemove", XS_pgBackRest__LibC_storagePosixPathRemove);
newXS_deffile("pgBackRest::LibC::pageChecksum", XS_pgBackRest__LibC_pageChecksum);
newXS_deffile("pgBackRest::LibC::pageChecksumTest", XS_pgBackRest__LibC_pageChecksumTest);
newXS_deffile("pgBackRest::LibC::pageChecksumBufferTest", XS_pgBackRest__LibC_pageChecksumBufferTest);
@@ -1,25 +1,25 @@
/***********************************************************************************************************************************
CIFS Storage Driver
CIFS Storage
***********************************************************************************************************************************/
#include "build.auto.h"

#include "common/debug.h"
#include "common/log.h"
#include "common/memContext.h"
#include "common/regExp.h"
#include "storage/driver/cifs/storage.h"
#include "storage/driver/posix/storage.intern.h"
#include "storage/cifs/storage.h"
#include "storage/posix/storage.intern.h"

/***********************************************************************************************************************************
Driver type constant string
Storage type
***********************************************************************************************************************************/
STRING_EXTERN(STORAGE_DRIVER_CIFS_TYPE_STR, STORAGE_DRIVER_CIFS_TYPE);
STRING_EXTERN(STORAGE_CIFS_TYPE_STR, STORAGE_CIFS_TYPE);

/***********************************************************************************************************************************
New object
***********************************************************************************************************************************/
Storage *
storageDriverCifsNew(
storageCifsNew(
const String *path, mode_t modeFile, mode_t modePath, bool write, StoragePathExpressionCallback pathExpressionFunction)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@@ -31,7 +31,5 @@ storageDriverCifsNew(
FUNCTION_LOG_END();

FUNCTION_LOG_RETURN(
STORAGE,
storageDriverPosixNewInternal(
STORAGE_DRIVER_CIFS_TYPE_STR, path, modeFile, modePath, write, pathExpressionFunction, false));
STORAGE, storagePosixNewInternal(STORAGE_CIFS_TYPE_STR, path, modeFile, modePath, write, pathExpressionFunction, false));
}
@@ -1,21 +1,21 @@
/***********************************************************************************************************************************
CIFS Storage Driver
CIFS Storage
***********************************************************************************************************************************/
#ifndef STORAGE_DRIVER_CIFS_STORAGE_H
#define STORAGE_DRIVER_CIFS_STORAGE_H
#ifndef STORAGE_CIFS_STORAGE_H
#define STORAGE_CIFS_STORAGE_H

#include "storage/storage.intern.h"

/***********************************************************************************************************************************
Driver type constant
Storage type
***********************************************************************************************************************************/
#define STORAGE_DRIVER_CIFS_TYPE "cifs"
STRING_DECLARE(STORAGE_DRIVER_CIFS_TYPE_STR);
#define STORAGE_CIFS_TYPE "cifs"
STRING_DECLARE(STORAGE_CIFS_TYPE_STR);

/***********************************************************************************************************************************
Constructor
***********************************************************************************************************************************/
Storage *storageDriverCifsNew(
Storage *storageCifsNew(
const String *path, mode_t modeFile, mode_t modePath, bool write, StoragePathExpressionCallback pathExpressionFunction);

#endif
Oops, something went wrong.

0 comments on commit 32ca27a

Please sign in to comment.
You can’t perform that action at this time.