You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-29 08:21:11 +03:00
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".
This commit is contained in:
@ -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,7 +6,7 @@ MODULE = pgBackRest::LibC PACKAGE = pgBackRest::LibC
|
||||
|
||||
####################################################################################################################################
|
||||
void
|
||||
storageDriverPosixPathRemove(path, errorOnMissing, recurse)
|
||||
storagePosixPathRemove(path, errorOnMissing, recurse)
|
||||
const char *path
|
||||
bool errorOnMissing
|
||||
bool recurse
|
||||
@ -14,7 +14,7 @@ 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();
|
||||
|
150
src/Makefile.in
150
src/Makefile.in
@ -135,22 +135,22 @@ SRCS = \
|
||||
protocol/parallel.c \
|
||||
protocol/parallelJob.c \
|
||||
protocol/server.c \
|
||||
storage/driver/cifs/storage.c \
|
||||
storage/driver/posix/common.c \
|
||||
storage/driver/posix/fileRead.c \
|
||||
storage/driver/posix/fileWrite.c \
|
||||
storage/driver/posix/storage.c \
|
||||
storage/driver/remote/fileRead.c \
|
||||
storage/driver/remote/fileWrite.c \
|
||||
storage/driver/remote/protocol.c \
|
||||
storage/driver/remote/storage.c \
|
||||
storage/driver/s3/fileRead.c \
|
||||
storage/driver/s3/fileWrite.c \
|
||||
storage/driver/s3/storage.c \
|
||||
storage/fileRead.c \
|
||||
storage/fileWrite.c \
|
||||
storage/cifs/storage.c \
|
||||
storage/posix/common.c \
|
||||
storage/posix/read.c \
|
||||
storage/posix/storage.c \
|
||||
storage/posix/write.c \
|
||||
storage/remote/read.c \
|
||||
storage/remote/protocol.c \
|
||||
storage/remote/storage.c \
|
||||
storage/remote/write.c \
|
||||
storage/s3/read.c \
|
||||
storage/s3/storage.c \
|
||||
storage/s3/write.c \
|
||||
storage/helper.c \
|
||||
storage/read.c \
|
||||
storage/storage.c \
|
||||
storage/write.c \
|
||||
main.c
|
||||
|
||||
# Create obj list from source list
|
||||
@ -187,25 +187,25 @@ clean:
|
||||
####################################################################################################################################
|
||||
# Compile rules
|
||||
####################################################################################################################################
|
||||
command/archive/common.o: command/archive/common.c build.auto.h command/archive/common.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
command/archive/common.o: command/archive/common.c build.auto.h command/archive/common.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h postgres/version.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/archive/common.c -o command/archive/common.o
|
||||
|
||||
command/archive/get/file.o: command/archive/get/file.c build.auto.h command/archive/common.h command/archive/get/file.h command/control/control.h common/assert.h common/compress/gzip/common.h common/compress/gzip/decompress.h common/crypto/cipherBlock.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/info.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
command/archive/get/file.o: command/archive/get/file.c build.auto.h command/archive/common.h command/archive/get/file.h command/control/control.h common/assert.h common/compress/gzip/common.h common/compress/gzip/decompress.h common/crypto/cipherBlock.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/info.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/archive/get/file.c -o command/archive/get/file.o
|
||||
|
||||
command/archive/get/get.o: command/archive/get/get.c build.auto.h command/archive/common.h command/archive/get/file.h command/archive/get/protocol.h command/command.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h perl/exec.h postgres/interface.h protocol/client.h protocol/command.h protocol/helper.h protocol/parallel.h protocol/parallelJob.h protocol/server.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
command/archive/get/get.o: command/archive/get/get.c build.auto.h command/archive/common.h command/archive/get/file.h command/archive/get/protocol.h command/command.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h perl/exec.h postgres/interface.h protocol/client.h protocol/command.h protocol/helper.h protocol/parallel.h protocol/parallelJob.h protocol/server.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/archive/get/get.c -o command/archive/get/get.o
|
||||
|
||||
command/archive/get/protocol.o: command/archive/get/protocol.c build.auto.h command/archive/get/file.h command/archive/get/protocol.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/server.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
command/archive/get/protocol.o: command/archive/get/protocol.c build.auto.h command/archive/get/file.h command/archive/get/protocol.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/server.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/archive/get/protocol.c -o command/archive/get/protocol.o
|
||||
|
||||
command/archive/push/file.o: command/archive/push/file.c build.auto.h command/archive/common.h command/archive/push/file.h command/control/control.h common/assert.h common/compress/gzip/common.h common/compress/gzip/compress.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
command/archive/push/file.o: command/archive/push/file.c build.auto.h command/archive/common.h command/archive/push/file.h command/control/control.h common/assert.h common/compress/gzip/common.h common/compress/gzip/compress.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h postgres/interface.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/archive/push/file.c -o command/archive/push/file.o
|
||||
|
||||
command/archive/push/protocol.o: command/archive/push/protocol.c build.auto.h command/archive/push/file.h command/archive/push/protocol.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/server.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
command/archive/push/protocol.o: command/archive/push/protocol.c build.auto.h command/archive/push/file.h command/archive/push/protocol.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/server.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/archive/push/protocol.c -o command/archive/push/protocol.o
|
||||
|
||||
command/archive/push/push.o: command/archive/push/push.c build.auto.h command/archive/common.h command/archive/push/file.h command/archive/push/protocol.h command/command.h command/control/control.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/fork.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h info/info.h info/infoArchive.h info/infoPg.h postgres/interface.h protocol/client.h protocol/command.h protocol/helper.h protocol/parallel.h protocol/parallelJob.h protocol/server.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
command/archive/push/push.o: command/archive/push/push.c build.auto.h command/archive/common.h command/archive/push/file.h command/archive/push/protocol.h command/command.h command/control/control.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/fork.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h info/info.h info/infoArchive.h info/infoPg.h postgres/interface.h protocol/client.h protocol/command.h protocol/helper.h protocol/parallel.h protocol/parallelJob.h protocol/server.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/archive/push/push.c -o command/archive/push/push.o
|
||||
|
||||
command/backup/common.o: command/backup/common.c build.auto.h command/backup/common.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h
|
||||
@ -214,19 +214,19 @@ command/backup/common.o: command/backup/common.c build.auto.h command/backup/com
|
||||
command/command.o: command/command.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/command.c -o command/command.o
|
||||
|
||||
command/control/control.o: command/control/control.c build.auto.h command/control/control.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
command/control/control.o: command/control/control.c build.auto.h command/control/control.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/control/control.c -o command/control/control.o
|
||||
|
||||
command/help/help.o: command/help/help.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/help/help.c -o command/help/help.o
|
||||
|
||||
command/info/info.o: command/info/info.c build.auto.h command/archive/common.h command/info/info.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/info.h info/infoArchive.h info/infoBackup.h info/infoPg.h perl/exec.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
command/info/info.o: command/info/info.c build.auto.h command/archive/common.h command/info/info.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/info.h info/infoArchive.h info/infoBackup.h info/infoPg.h perl/exec.h postgres/interface.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/info/info.c -o command/info/info.o
|
||||
|
||||
command/local/local.o: command/local/local.c build.auto.h command/archive/get/protocol.h command/archive/push/protocol.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/protocol.h protocol/client.h protocol/command.h protocol/helper.h protocol/server.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/local/local.c -o command/local/local.o
|
||||
|
||||
command/remote/remote.o: command/remote/remote.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/protocol.h protocol/client.h protocol/command.h protocol/helper.h protocol/server.h storage/driver/remote/protocol.h
|
||||
command/remote/remote.o: command/remote/remote.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/protocol.h protocol/client.h protocol/command.h protocol/helper.h protocol/server.h storage/remote/protocol.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c command/remote/remote.c -o command/remote/remote.o
|
||||
|
||||
common/compress/gzip/common.o: common/compress/gzip/common.c build.auto.h common/assert.h common/compress/gzip/common.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/convert.h
|
||||
@ -319,7 +319,7 @@ common/io/tls/client.o: common/io/tls/client.c build.auto.h common/assert.h comm
|
||||
common/io/write.o: common/io/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c common/io/write.c -o common/io/write.o
|
||||
|
||||
common/lock.o: common/lock.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/helper.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
common/lock.o: common/lock.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/helper.h storage/info.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c common/lock.c -o common/lock.o
|
||||
|
||||
common/log.o: common/log.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/time.h common/type/convert.h
|
||||
@ -382,25 +382,25 @@ config/exec.o: config/exec.c build.auto.h common/assert.h common/debug.h common/
|
||||
config/load.o: config/load.c build.auto.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/io.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c config/load.c -o config/load.o
|
||||
|
||||
config/parse.o: config/parse.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/parse.auto.c config/parse.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
config/parse.o: config/parse.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/parse.auto.c config/parse.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c config/parse.c -o config/parse.o
|
||||
|
||||
config/protocol.o: config/protocol.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/protocol.h protocol/client.h protocol/command.h protocol/server.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c config/protocol.c -o config/protocol.o
|
||||
|
||||
info/info.o: info/info.c build.auto.h common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h
|
||||
info/info.o: info/info.c build.auto.h common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c info/info.c -o info/info.o
|
||||
|
||||
info/infoArchive.o: info/infoArchive.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
info/infoArchive.o: info/infoArchive.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c info/infoArchive.c -o info/infoArchive.o
|
||||
|
||||
info/infoBackup.o: info/infoBackup.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoBackup.h info/infoManifest.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
info/infoBackup.o: info/infoBackup.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoBackup.h info/infoManifest.h info/infoPg.h postgres/interface.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c info/infoBackup.c -o info/infoBackup.o
|
||||
|
||||
info/infoManifest.o: info/infoManifest.c build.auto.h common/error.auto.h common/error.h common/memContext.h common/type/buffer.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h info/infoManifest.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c info/infoManifest.c -o info/infoManifest.o
|
||||
|
||||
info/infoPg.o: info/infoPg.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoPg.h postgres/interface.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
info/infoPg.o: info/infoPg.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoPg.h postgres/interface.h postgres/version.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c info/infoPg.c -o info/infoPg.o
|
||||
|
||||
main.o: main.c build.auto.h command/archive/get/get.h command/archive/push/push.h command/command.h command/help/help.h command/info/info.h command/local/local.h command/remote/remote.h common/assert.h common/debug.h common/error.auto.h common/error.h common/exit.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/interface.h version.h
|
||||
@ -409,10 +409,10 @@ main.o: main.c build.auto.h command/archive/get/get.h command/archive/push/push.
|
||||
perl/config.o: perl/config.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c perl/config.c -o perl/config.o
|
||||
|
||||
perl/exec.o: perl/exec.c ../libc/LibC.h build.auto.h common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h perl/config.h perl/embed.auto.c perl/exec.h perl/libc.auto.c postgres/pageChecksum.h storage/driver/posix/storage.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h ../libc/xs/common/encode.xsh ../libc/xs/crypto/cipherBlock.xsh ../libc/xs/crypto/hash.xsh
|
||||
perl/exec.o: perl/exec.c ../libc/LibC.h build.auto.h common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h perl/config.h perl/embed.auto.c perl/exec.h perl/libc.auto.c postgres/pageChecksum.h storage/info.h storage/posix/storage.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h ../libc/xs/common/encode.xsh ../libc/xs/crypto/cipherBlock.xsh ../libc/xs/crypto/hash.xsh
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c perl/exec.c -o perl/exec.o
|
||||
|
||||
postgres/interface.o: postgres/interface.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h
|
||||
postgres/interface.o: postgres/interface.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/version.h postgres/version.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c postgres/interface.c -o postgres/interface.o
|
||||
|
||||
postgres/interface/v083.o: postgres/interface/v083.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h postgres/interface.h postgres/interface/version.auto.h postgres/interface/version.h postgres/interface/version.intern.h postgres/version.h
|
||||
@ -469,50 +469,50 @@ protocol/parallelJob.o: protocol/parallelJob.c build.auto.h common/assert.h comm
|
||||
protocol/server.o: protocol/server.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c protocol/server.c -o protocol/server.o
|
||||
|
||||
storage/driver/cifs/storage.o: storage/driver/cifs/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/cifs/storage.h storage/driver/posix/storage.h storage/driver/posix/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/cifs/storage.c -o storage/driver/cifs/storage.o
|
||||
storage/cifs/storage.o: storage/cifs/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/cifs/storage.h storage/info.h storage/posix/storage.h storage/posix/storage.intern.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/cifs/storage.c -o storage/cifs/storage.o
|
||||
|
||||
storage/driver/posix/common.o: storage/driver/posix/common.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/driver/posix/common.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/posix/common.c -o storage/driver/posix/common.o
|
||||
|
||||
storage/driver/posix/fileRead.o: storage/driver/posix/fileRead.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/common.h storage/driver/posix/fileRead.h storage/driver/posix/storage.h storage/driver/posix/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/posix/fileRead.c -o storage/driver/posix/fileRead.o
|
||||
|
||||
storage/driver/posix/fileWrite.o: storage/driver/posix/fileWrite.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/common.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/driver/posix/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/posix/fileWrite.c -o storage/driver/posix/fileWrite.o
|
||||
|
||||
storage/driver/posix/storage.o: storage/driver/posix/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/posix/common.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/driver/posix/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/posix/storage.c -o storage/driver/posix/storage.o
|
||||
|
||||
storage/driver/remote/fileRead.o: storage/driver/remote/fileRead.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/driver/remote/fileRead.h storage/driver/remote/protocol.h storage/driver/remote/storage.h storage/driver/remote/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/remote/fileRead.c -o storage/driver/remote/fileRead.o
|
||||
|
||||
storage/driver/remote/fileWrite.o: storage/driver/remote/fileWrite.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/driver/remote/fileWrite.h storage/driver/remote/protocol.h storage/driver/remote/storage.h storage/driver/remote/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/remote/fileWrite.c -o storage/driver/remote/fileWrite.o
|
||||
|
||||
storage/driver/remote/protocol.o: storage/driver/remote/protocol.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/server.h storage/driver/remote/protocol.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/helper.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/remote/protocol.c -o storage/driver/remote/protocol.o
|
||||
|
||||
storage/driver/remote/storage.o: storage/driver/remote/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/driver/remote/fileRead.h storage/driver/remote/fileWrite.h storage/driver/remote/protocol.h storage/driver/remote/storage.h storage/driver/remote/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/remote/storage.c -o storage/driver/remote/storage.o
|
||||
|
||||
storage/driver/s3/fileRead.o: storage/driver/s3/fileRead.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/s3/fileRead.h storage/driver/s3/storage.h storage/driver/s3/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/s3/fileRead.c -o storage/driver/s3/fileRead.o
|
||||
|
||||
storage/driver/s3/fileWrite.o: storage/driver/s3/fileWrite.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h storage/driver/s3/fileWrite.h storage/driver/s3/storage.h storage/driver/s3/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/s3/fileWrite.c -o storage/driver/s3/fileWrite.o
|
||||
|
||||
storage/driver/s3/storage.o: storage/driver/s3/storage.c build.auto.h common/assert.h common/crypto/hash.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h storage/driver/s3/fileRead.h storage/driver/s3/fileWrite.h storage/driver/s3/storage.h storage/driver/s3/storage.intern.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/driver/s3/storage.c -o storage/driver/s3/storage.o
|
||||
|
||||
storage/fileRead.o: storage/fileRead.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/fileRead.h storage/fileRead.intern.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/fileRead.c -o storage/fileRead.o
|
||||
|
||||
storage/fileWrite.o: storage/fileWrite.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/fileWrite.h storage/fileWrite.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/fileWrite.c -o storage/fileWrite.o
|
||||
|
||||
storage/helper.o: storage/helper.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/client.h protocol/command.h protocol/helper.h storage/driver/cifs/storage.h storage/driver/posix/storage.h storage/driver/remote/storage.h storage/driver/s3/storage.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/helper.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
storage/helper.o: storage/helper.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/client.h protocol/command.h protocol/helper.h storage/cifs/storage.h storage/helper.h storage/info.h storage/posix/storage.h storage/read.h storage/read.intern.h storage/remote/storage.h storage/s3/storage.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/helper.c -o storage/helper.o
|
||||
|
||||
storage/storage.o: storage/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/fileWrite.intern.h storage/info.h storage/storage.h storage/storage.intern.h version.h
|
||||
storage/posix/common.o: storage/posix/common.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/posix/common.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/posix/common.c -o storage/posix/common.o
|
||||
|
||||
storage/posix/read.o: storage/posix/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/posix/common.h storage/posix/read.h storage/posix/storage.h storage/posix/storage.intern.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/posix/read.c -o storage/posix/read.o
|
||||
|
||||
storage/posix/storage.o: storage/posix/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/posix/common.h storage/posix/read.h storage/posix/storage.h storage/posix/storage.intern.h storage/posix/write.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/posix/storage.c -o storage/posix/storage.o
|
||||
|
||||
storage/posix/write.o: storage/posix/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/posix/common.h storage/posix/storage.h storage/posix/storage.intern.h storage/posix/write.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/posix/write.c -o storage/posix/write.o
|
||||
|
||||
storage/read.o: storage/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/read.h storage/read.intern.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/read.c -o storage/read.o
|
||||
|
||||
storage/remote/protocol.o: storage/remote/protocol.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/server.h storage/helper.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/remote/protocol.c -o storage/remote/protocol.o
|
||||
|
||||
storage/remote/read.o: storage/remote/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/remote/read.h storage/remote/storage.h storage/remote/storage.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/remote/read.c -o storage/remote/read.o
|
||||
|
||||
storage/remote/storage.o: storage/remote/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/remote/read.h storage/remote/storage.h storage/remote/storage.intern.h storage/remote/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/remote/storage.c -o storage/remote/storage.o
|
||||
|
||||
storage/remote/write.o: storage/remote/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/remote/storage.h storage/remote/storage.intern.h storage/remote/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/remote/write.c -o storage/remote/write.o
|
||||
|
||||
storage/s3/read.o: storage/s3/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/read.h storage/read.intern.h storage/s3/read.h storage/s3/storage.h storage/s3/storage.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/s3/read.c -o storage/s3/read.o
|
||||
|
||||
storage/s3/storage.o: storage/s3/storage.c build.auto.h common/assert.h common/crypto/hash.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h storage/info.h storage/read.h storage/read.intern.h storage/s3/read.h storage/s3/storage.h storage/s3/storage.intern.h storage/s3/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/s3/storage.c -o storage/s3/storage.o
|
||||
|
||||
storage/s3/write.o: storage/s3/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h storage/info.h storage/read.h storage/read.intern.h storage/s3/storage.h storage/s3/storage.intern.h storage/s3/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/s3/write.c -o storage/s3/write.o
|
||||
|
||||
storage/storage.o: storage/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/info.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/storage.c -o storage/storage.o
|
||||
|
||||
storage/write.o: storage/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/write.h storage/write.intern.h version.h
|
||||
$(CC) $(CFLAGS) $(CMAKE) -c storage/write.c -o storage/write.o
|
||||
|
@ -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,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
CIFS Storage Driver
|
||||
CIFS Storage
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -7,19 +7,19 @@ CIFS Storage Driver
|
||||
#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
|
@ -10,10 +10,10 @@ Storage Helper
|
||||
#include "common/regExp.h"
|
||||
#include "config/config.h"
|
||||
#include "protocol/helper.h"
|
||||
#include "storage/driver/cifs/storage.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/driver/remote/storage.h"
|
||||
#include "storage/driver/s3/storage.h"
|
||||
#include "storage/cifs/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
#include "storage/remote/storage.h"
|
||||
#include "storage/s3/storage.h"
|
||||
#include "storage/helper.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -105,7 +105,7 @@ storageLocal(void)
|
||||
|
||||
MEM_CONTEXT_BEGIN(storageHelper.memContext)
|
||||
{
|
||||
storageHelper.storageLocal = storageDriverPosixNew(
|
||||
storageHelper.storageLocal = storagePosixNew(
|
||||
FSLASH_STR, STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL);
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
@ -130,7 +130,7 @@ storageLocalWrite(void)
|
||||
|
||||
MEM_CONTEXT_BEGIN(storageHelper.memContext)
|
||||
{
|
||||
storageHelper.storageLocalWrite = storageDriverPosixNew(
|
||||
storageHelper.storageLocalWrite = storagePosixNew(
|
||||
FSLASH_STR, STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
@ -153,7 +153,7 @@ storagePg(void)
|
||||
|
||||
MEM_CONTEXT_BEGIN(storageHelper.memContext)
|
||||
{
|
||||
storageHelper.storagePg = storageDriverPosixNew(
|
||||
storageHelper.storagePg = storagePosixNew(
|
||||
cfgOptionStr(cfgOptPgPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL);
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
@ -176,7 +176,7 @@ storagePgWrite(void)
|
||||
|
||||
MEM_CONTEXT_BEGIN(storageHelper.memContext)
|
||||
{
|
||||
storageHelper.storagePgWrite = storageDriverPosixNew(
|
||||
storageHelper.storagePgWrite = storagePosixNew(
|
||||
cfgOptionStr(cfgOptPgPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
@ -276,37 +276,37 @@ storageRepoGet(const String *type, bool write)
|
||||
// Use remote storage
|
||||
if (!repoIsLocal())
|
||||
{
|
||||
result = storageDriverRemoteNew(
|
||||
result = storageRemoteNew(
|
||||
STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, write, storageRepoPathExpression,
|
||||
protocolRemoteGet(protocolStorageTypeRepo));
|
||||
}
|
||||
// Use the CIFS driver
|
||||
// Use CIFS storage
|
||||
else if (strEqZ(type, STORAGE_TYPE_CIFS))
|
||||
{
|
||||
result = storageDriverCifsNew(
|
||||
result = storageCifsNew(
|
||||
cfgOptionStr(cfgOptRepoPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, write, storageRepoPathExpression);
|
||||
}
|
||||
// Use the Posix driver
|
||||
// Use Posix storage
|
||||
else if (strEqZ(type, STORAGE_TYPE_POSIX))
|
||||
{
|
||||
result = storageDriverPosixNew(
|
||||
result = storagePosixNew(
|
||||
cfgOptionStr(cfgOptRepoPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, write, storageRepoPathExpression);
|
||||
}
|
||||
// Use the S3 driver
|
||||
// Use S3 storage
|
||||
else if (strEqZ(type, STORAGE_TYPE_S3))
|
||||
{
|
||||
// Set the default port
|
||||
unsigned int port = STORAGE_DRIVER_S3_PORT_DEFAULT;
|
||||
unsigned int port = STORAGE_S3_PORT_DEFAULT;
|
||||
|
||||
// Extract port from the endpoint and host if it is present
|
||||
const String *endPoint = cfgOptionHostPort(cfgOptRepoS3Endpoint, &port);
|
||||
const String *host = cfgOptionHostPort(cfgOptRepoS3Host, &port);
|
||||
|
||||
result = storageDriverS3New(
|
||||
result = storageS3New(
|
||||
cfgOptionStr(cfgOptRepoPath), write, storageRepoPathExpression, cfgOptionStr(cfgOptRepoS3Bucket), endPoint,
|
||||
cfgOptionStr(cfgOptRepoS3Region), cfgOptionStr(cfgOptRepoS3Key), cfgOptionStr(cfgOptRepoS3KeySecret),
|
||||
cfgOptionTest(cfgOptRepoS3Token) ? cfgOptionStr(cfgOptRepoS3Token) : NULL, STORAGE_DRIVER_S3_PARTSIZE_MIN, host, port,
|
||||
STORAGE_DRIVER_S3_TIMEOUT_DEFAULT, cfgOptionBool(cfgOptRepoS3VerifySsl),
|
||||
cfgOptionTest(cfgOptRepoS3Token) ? cfgOptionStr(cfgOptRepoS3Token) : NULL, STORAGE_S3_PARTSIZE_MIN, host, port,
|
||||
STORAGE_S3_TIMEOUT_DEFAULT, cfgOptionBool(cfgOptRepoS3VerifySsl),
|
||||
cfgOptionTest(cfgOptRepoS3CaFile) ? cfgOptionStr(cfgOptRepoS3CaFile) : NULL,
|
||||
cfgOptionTest(cfgOptRepoS3CaPath) ? cfgOptionStr(cfgOptRepoS3CaPath) : NULL);
|
||||
}
|
||||
@ -415,7 +415,7 @@ storageSpool(void)
|
||||
|
||||
MEM_CONTEXT_BEGIN(storageHelper.memContext)
|
||||
{
|
||||
storageHelper.storageSpool = storageDriverPosixNew(
|
||||
storageHelper.storageSpool = storagePosixNew(
|
||||
cfgOptionStr(cfgOptSpoolPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false,
|
||||
storageSpoolPathExpression);
|
||||
}
|
||||
@ -440,7 +440,7 @@ storageSpoolWrite(void)
|
||||
|
||||
MEM_CONTEXT_BEGIN(storageHelper.memContext)
|
||||
{
|
||||
storageHelper.storageSpoolWrite = storageDriverPosixNew(
|
||||
storageHelper.storageSpoolWrite = storagePosixNew(
|
||||
cfgOptionStr(cfgOptSpoolPath), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true,
|
||||
storageSpoolPathExpression);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ Posix Common File Routines
|
||||
#include <unistd.h>
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "storage/driver/posix/common.h"
|
||||
#include "storage/posix/common.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Open a file
|
||||
@ -15,8 +15,7 @@ Open a file
|
||||
Returns the handle of the open file, or -1 for reads if the file is missing and -1 for writes if the path is mssing.
|
||||
***********************************************************************************************************************************/
|
||||
int
|
||||
storageDriverPosixFileOpen(
|
||||
const String *name, int flags, mode_t mode, bool ignoreMissing, bool file, const char *purpose)
|
||||
storagePosixFileOpen(const String *name, int flags, mode_t mode, bool ignoreMissing, bool file, const char *purpose)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STRING, name);
|
||||
@ -51,7 +50,7 @@ storageDriverPosixFileOpen(
|
||||
Sync a file/directory handle
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageDriverPosixFileSync(int handle, const String *name, bool file, bool closeOnError)
|
||||
storagePosixFileSync(int handle, const String *name, bool file, bool closeOnError)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(INT, handle);
|
||||
@ -81,7 +80,7 @@ storageDriverPosixFileSync(int handle, const String *name, bool file, bool close
|
||||
Close a file/directory handle
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageDriverPosixFileClose(int handle, const String *name, bool file)
|
||||
storagePosixFileClose(int handle, const String *name, bool file)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(INT, handle);
|
@ -1,8 +1,8 @@
|
||||
/***********************************************************************************************************************************
|
||||
Posix Common File Routines
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_POSIX_COMMON_H
|
||||
#define STORAGE_DRIVER_POSIX_COMMON_H
|
||||
#ifndef STORAGE_POSIX_COMMON_H
|
||||
#define STORAGE_POSIX_COMMON_H
|
||||
|
||||
#include "common/error.h"
|
||||
#include "common/type/string.h"
|
||||
@ -10,8 +10,8 @@ Posix Common File Routines
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
int storageDriverPosixFileOpen(const String *name, int flags, mode_t mode, bool ignoreMissing, bool file, const char *purpose);
|
||||
void storageDriverPosixFileSync(int handle, const String *name, bool file, bool closeOnError);
|
||||
void storageDriverPosixFileClose(int handle, const String *name, bool file);
|
||||
int storagePosixFileOpen(const String *name, int flags, mode_t mode, bool ignoreMissing, bool file, const char *purpose);
|
||||
void storagePosixFileSync(int handle, const String *name, bool file, bool closeOnError);
|
||||
void storagePosixFileClose(int handle, const String *name, bool file);
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Posix Storage File Read Driver
|
||||
Posix Storage Read
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -11,42 +11,42 @@ Posix Storage File Read Driver
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/object.h"
|
||||
#include "storage/driver/posix/common.h"
|
||||
#include "storage/driver/posix/fileRead.h"
|
||||
#include "storage/driver/posix/storage.intern.h"
|
||||
#include "storage/fileRead.intern.h"
|
||||
#include "storage/posix/common.h"
|
||||
#include "storage/posix/read.h"
|
||||
#include "storage/posix/storage.intern.h"
|
||||
#include "storage/read.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object types
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileReadDriverPosix
|
||||
typedef struct StorageReadPosix
|
||||
{
|
||||
MemContext *memContext; // Object mem context
|
||||
StorageFileReadInterface interface; // Driver interface
|
||||
StorageDriverPosix *storage; // Storage that created this object
|
||||
StorageReadInterface interface; // Interface
|
||||
StoragePosix *storage; // Storage that created this object
|
||||
|
||||
int handle;
|
||||
bool eof;
|
||||
} StorageFileReadDriverPosix;
|
||||
} StorageReadPosix;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_DRIVER_POSIX_TYPE \
|
||||
StorageFileReadDriverPosix *
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_DRIVER_POSIX_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageFileReadDriverPosix", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_READ_POSIX_TYPE \
|
||||
StorageReadPosix *
|
||||
#define FUNCTION_LOG_STORAGE_READ_POSIX_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageReadPosix", buffer, bufferSize)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Close the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileReadDriverPosixClose(THIS_VOID)
|
||||
storageReadPosixClose(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileReadDriverPosix);
|
||||
THIS(StorageReadPosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ_POSIX, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -55,7 +55,7 @@ storageFileReadDriverPosixClose(THIS_VOID)
|
||||
if (this->handle != -1)
|
||||
{
|
||||
// Close the file
|
||||
storageDriverPosixFileClose(this->handle, this->interface.name, true);
|
||||
storagePosixFileClose(this->handle, this->interface.name, true);
|
||||
|
||||
this->handle = -1;
|
||||
}
|
||||
@ -67,15 +67,15 @@ storageFileReadDriverPosixClose(THIS_VOID)
|
||||
Free the object
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileReadDriverPosixFree(StorageFileReadDriverPosix *this)
|
||||
storageReadPosixFree(StorageReadPosix *this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ_POSIX, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
if (this != NULL)
|
||||
{
|
||||
storageFileReadDriverPosixClose(this);
|
||||
storageReadPosixClose(this);
|
||||
|
||||
memContextCallbackClear(this->memContext);
|
||||
memContextFree(this->memContext);
|
||||
@ -88,12 +88,12 @@ storageFileReadDriverPosixFree(StorageFileReadDriverPosix *this)
|
||||
Open the file
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageFileReadDriverPosixOpen(THIS_VOID)
|
||||
storageReadPosixOpen(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileReadDriverPosix);
|
||||
THIS(StorageReadPosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ_POSIX, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -102,12 +102,12 @@ storageFileReadDriverPosixOpen(THIS_VOID)
|
||||
bool result = false;
|
||||
|
||||
// Open the file and handle errors
|
||||
this->handle = storageDriverPosixFileOpen(this->interface.name, O_RDONLY, 0, this->interface.ignoreMissing, true, "read");
|
||||
this->handle = storagePosixFileOpen(this->interface.name, O_RDONLY, 0, this->interface.ignoreMissing, true, "read");
|
||||
|
||||
// On success set free callback to ensure file handle is freed
|
||||
if (this->handle != -1)
|
||||
{
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageFileReadDriverPosixFree, this);
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageReadPosixFree, this);
|
||||
result = true;
|
||||
}
|
||||
|
||||
@ -118,12 +118,12 @@ storageFileReadDriverPosixOpen(THIS_VOID)
|
||||
Read from a file
|
||||
***********************************************************************************************************************************/
|
||||
static size_t
|
||||
storageFileReadDriverPosix(THIS_VOID, Buffer *buffer, bool block)
|
||||
storageReadPosix(THIS_VOID, Buffer *buffer, bool block)
|
||||
{
|
||||
THIS(StorageFileReadDriverPosix);
|
||||
THIS(StorageReadPosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||
FUNCTION_LOG_PARAM(BOOL, block);
|
||||
FUNCTION_LOG_END();
|
||||
@ -160,12 +160,12 @@ storageFileReadDriverPosix(THIS_VOID, Buffer *buffer, bool block)
|
||||
Has file reached EOF?
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageFileReadDriverPosixEof(THIS_VOID)
|
||||
storageReadPosixEof(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileReadDriverPosix);
|
||||
THIS(StorageReadPosix);
|
||||
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ_DRIVER_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ_POSIX, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -177,12 +177,12 @@ storageFileReadDriverPosixEof(THIS_VOID)
|
||||
Get handle (file descriptor)
|
||||
***********************************************************************************************************************************/
|
||||
static int
|
||||
storageFileReadDriverPosixHandle(const THIS_VOID)
|
||||
storageReadPosixHandle(const THIS_VOID)
|
||||
{
|
||||
THIS(const StorageFileReadDriverPosix);
|
||||
THIS(const StorageReadPosix);
|
||||
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ_DRIVER_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ_POSIX, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -193,8 +193,8 @@ storageFileReadDriverPosixHandle(const THIS_VOID)
|
||||
/***********************************************************************************************************************************
|
||||
New object
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *
|
||||
storageFileReadDriverPosixNew(StorageDriverPosix *storage, const String *name, bool ignoreMissing)
|
||||
StorageRead *
|
||||
storageReadPosixNew(StoragePosix *storage, const String *name, bool ignoreMissing)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STRING, name);
|
||||
@ -203,34 +203,34 @@ storageFileReadDriverPosixNew(StorageDriverPosix *storage, const String *name, b
|
||||
|
||||
ASSERT(name != NULL);
|
||||
|
||||
StorageFileRead *this = NULL;
|
||||
StorageRead *this = NULL;
|
||||
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageFileReadDriverPosix")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageReadPosix")
|
||||
{
|
||||
StorageFileReadDriverPosix *driver = memNew(sizeof(StorageFileReadDriverPosix));
|
||||
StorageReadPosix *driver = memNew(sizeof(StorageReadPosix));
|
||||
driver->memContext = MEM_CONTEXT_NEW();
|
||||
|
||||
driver->interface = (StorageFileReadInterface)
|
||||
driver->interface = (StorageReadInterface)
|
||||
{
|
||||
.type = STORAGE_DRIVER_POSIX_TYPE_STR,
|
||||
.type = STORAGE_POSIX_TYPE_STR,
|
||||
.name = strDup(name),
|
||||
.ignoreMissing = ignoreMissing,
|
||||
|
||||
.ioInterface = (IoReadInterface)
|
||||
{
|
||||
.eof = storageFileReadDriverPosixEof,
|
||||
.handle = storageFileReadDriverPosixHandle,
|
||||
.open = storageFileReadDriverPosixOpen,
|
||||
.read = storageFileReadDriverPosix,
|
||||
.eof = storageReadPosixEof,
|
||||
.handle = storageReadPosixHandle,
|
||||
.open = storageReadPosixOpen,
|
||||
.read = storageReadPosix,
|
||||
},
|
||||
};
|
||||
|
||||
driver->storage = storage;
|
||||
driver->handle = -1;
|
||||
|
||||
this = storageFileReadNew(driver, &driver->interface);
|
||||
this = storageReadNew(driver, &driver->interface);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_READ, this);
|
||||
FUNCTION_LOG_RETURN(STORAGE_READ, this);
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
/***********************************************************************************************************************************
|
||||
S3 Storage File Read Driver
|
||||
Posix Storage Read
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_S3_FILEREAD_H
|
||||
#define STORAGE_DRIVER_S3_FILEREAD_H
|
||||
#ifndef STORAGE_POSIX_READ_H
|
||||
#define STORAGE_POSIX_READ_H
|
||||
|
||||
#include "storage/driver/s3/storage.intern.h"
|
||||
#include "storage/fileRead.h"
|
||||
#include "storage/posix/storage.h"
|
||||
#include "storage/read.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *storageFileReadDriverS3New(StorageDriverS3 *storage, const String *name, bool ignoreMissing);
|
||||
StorageRead *storageReadPosixNew(StoragePosix *storage, const String *name, bool ignoreMissing);
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Posix Storage Driver
|
||||
Posix Storage
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -18,20 +18,20 @@ Posix Storage Driver
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/regExp.h"
|
||||
#include "storage/driver/posix/fileRead.h"
|
||||
#include "storage/driver/posix/fileWrite.h"
|
||||
#include "storage/driver/posix/storage.intern.h"
|
||||
#include "storage/driver/posix/common.h"
|
||||
#include "storage/posix/common.h"
|
||||
#include "storage/posix/read.h"
|
||||
#include "storage/posix/storage.intern.h"
|
||||
#include "storage/posix/write.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Driver type constant string
|
||||
Storage type
|
||||
***********************************************************************************************************************************/
|
||||
STRING_EXTERN(STORAGE_DRIVER_POSIX_TYPE_STR, STORAGE_DRIVER_POSIX_TYPE);
|
||||
STRING_EXTERN(STORAGE_POSIX_TYPE_STR, STORAGE_POSIX_TYPE);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
struct StorageDriverPosix
|
||||
struct StoragePosix
|
||||
{
|
||||
MemContext *memContext; // Object memory context
|
||||
bool syncPath; // Will paths be synced?
|
||||
@ -41,12 +41,12 @@ struct StorageDriverPosix
|
||||
Does a file exist? This function is only for files, not paths.
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageDriverPosixExists(THIS_VOID, const String *path)
|
||||
storagePosixExists(THIS_VOID, const String *path)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
@ -75,12 +75,12 @@ storageDriverPosixExists(THIS_VOID, const String *path)
|
||||
File/path info
|
||||
***********************************************************************************************************************************/
|
||||
static StorageInfo
|
||||
storageDriverPosixInfo(THIS_VOID, const String *file, bool ignoreMissing, bool followLink)
|
||||
storagePosixInfo(THIS_VOID, const String *file, bool ignoreMissing, bool followLink)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_PARAM(BOOL, followLink);
|
||||
@ -150,11 +150,11 @@ storageDriverPosixInfo(THIS_VOID, const String *file, bool ignoreMissing, bool f
|
||||
Info for all files/paths in a path
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverPosixInfoListEntry(
|
||||
StorageDriverPosix *this, const String *path, const String *name, StorageInfoListCallback callback, void *callbackData)
|
||||
storagePosixInfoListEntry(
|
||||
StoragePosix *this, const String *path, const String *name, StorageInfoListCallback callback, void *callbackData)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STRING, path);
|
||||
FUNCTION_TEST_PARAM(STRING, name);
|
||||
FUNCTION_TEST_PARAM(FUNCTIONP, callback);
|
||||
@ -170,7 +170,7 @@ storageDriverPosixInfoListEntry(
|
||||
{
|
||||
String *pathInfo = strEqZ(name, ".") ? strDup(path) : strNewFmt("%s/%s", strPtr(path), strPtr(name));
|
||||
|
||||
StorageInfo storageInfo = storageDriverPosixInfo(this, pathInfo, true, false);
|
||||
StorageInfo storageInfo = storagePosixInfo(this, pathInfo, true, false);
|
||||
|
||||
if (storageInfo.exists)
|
||||
{
|
||||
@ -185,13 +185,12 @@ storageDriverPosixInfoListEntry(
|
||||
}
|
||||
|
||||
static bool
|
||||
storageDriverPosixInfoList(
|
||||
THIS_VOID, const String *path, bool errorOnMissing, StorageInfoListCallback callback, void *callbackData)
|
||||
storagePosixInfoList(THIS_VOID, const String *path, bool errorOnMissing, StorageInfoListCallback callback, void *callbackData)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_PARAM(FUNCTIONP, callback);
|
||||
@ -229,7 +228,7 @@ storageDriverPosixInfoList(
|
||||
while (dirEntry != NULL)
|
||||
{
|
||||
// Get info and perform callback
|
||||
storageDriverPosixInfoListEntry(this, path, STR(dirEntry->d_name), callback, callbackData);
|
||||
storagePosixInfoListEntry(this, path, STR(dirEntry->d_name), callback, callbackData);
|
||||
|
||||
// Get next entry
|
||||
dirEntry = readdir(dir);
|
||||
@ -252,12 +251,12 @@ storageDriverPosixInfoList(
|
||||
Get a list of files from a directory
|
||||
***********************************************************************************************************************************/
|
||||
static StringList *
|
||||
storageDriverPosixList(THIS_VOID, const String *path, bool errorOnMissing, const String *expression)
|
||||
storagePosixList(THIS_VOID, const String *path, bool errorOnMissing, const String *expression)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_PARAM(STRING, expression);
|
||||
@ -324,14 +323,14 @@ storageDriverPosixList(THIS_VOID, const String *path, bool errorOnMissing, const
|
||||
Move a path/file
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageDriverPosixMove(THIS_VOID, StorageFileRead *source, StorageFileWrite *destination)
|
||||
storagePosixMove(THIS_VOID, StorageRead *source, StorageWrite *destination)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ, source);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE, destination);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ, source);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE, destination);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -342,8 +341,8 @@ storageDriverPosixMove(THIS_VOID, StorageFileRead *source, StorageFileWrite *de
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
const String *sourceFile = storageFileReadName(source);
|
||||
const String *destinationFile = storageFileWriteName(destination);
|
||||
const String *sourceFile = storageReadName(source);
|
||||
const String *destinationFile = storageWriteName(destination);
|
||||
const String *destinationPath = strPath(destinationFile);
|
||||
|
||||
// Attempt to move the file
|
||||
@ -352,17 +351,17 @@ storageDriverPosixMove(THIS_VOID, StorageFileRead *source, StorageFileWrite *de
|
||||
// Detemine which file/path is missing
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
if (!storageDriverPosixExists(this, sourceFile))
|
||||
if (!storagePosixExists(this, sourceFile))
|
||||
THROW_SYS_ERROR_FMT(FileMissingError, "unable to move missing file '%s'", strPtr(sourceFile));
|
||||
|
||||
if (!storageFileWriteCreatePath(destination))
|
||||
if (!storageWriteCreatePath(destination))
|
||||
{
|
||||
THROW_SYS_ERROR_FMT(
|
||||
PathMissingError, "unable to move '%s' to missing path '%s'", strPtr(sourceFile), strPtr(destinationPath));
|
||||
}
|
||||
|
||||
storageDriverPosixPathCreate(this, destinationPath, false, false, storageFileWriteModePath(destination));
|
||||
result = storageDriverPosixMove(this, source, destination);
|
||||
storagePosixPathCreate(this, destinationPath, false, false, storageWriteModePath(destination));
|
||||
result = storagePosixMove(this, source, destination);
|
||||
}
|
||||
// Else the destination is on a different device so a copy will be needed
|
||||
else if (errno == EXDEV)
|
||||
@ -376,12 +375,12 @@ storageDriverPosixMove(THIS_VOID, StorageFileRead *source, StorageFileWrite *de
|
||||
else
|
||||
{
|
||||
// Sync source path if the destination path was synced and the paths are not equal
|
||||
if (storageFileWriteSyncPath(destination))
|
||||
if (storageWriteSyncPath(destination))
|
||||
{
|
||||
String *sourcePath = strPath(sourceFile);
|
||||
|
||||
if (!strEq(destinationPath, sourcePath))
|
||||
storageDriverPosixPathSync(this, sourcePath, false);
|
||||
storagePosixPathSync(this, sourcePath, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -393,13 +392,13 @@ storageDriverPosixMove(THIS_VOID, StorageFileRead *source, StorageFileWrite *de
|
||||
/***********************************************************************************************************************************
|
||||
New file read object
|
||||
***********************************************************************************************************************************/
|
||||
static StorageFileRead *
|
||||
storageDriverPosixNewRead(THIS_VOID, const String *file, bool ignoreMissing)
|
||||
static StorageRead *
|
||||
storagePosixNewRead(THIS_VOID, const String *file, bool ignoreMissing)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_END();
|
||||
@ -407,21 +406,21 @@ storageDriverPosixNewRead(THIS_VOID, const String *file, bool ignoreMissing)
|
||||
ASSERT(this != NULL);
|
||||
ASSERT(file != NULL);
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_READ, storageFileReadDriverPosixNew(this, file, ignoreMissing));
|
||||
FUNCTION_LOG_RETURN(STORAGE_READ, storageReadPosixNew(this, file, ignoreMissing));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
New file write object
|
||||
***********************************************************************************************************************************/
|
||||
static StorageFileWrite *
|
||||
storageDriverPosixNewWrite(
|
||||
THIS_VOID, const String *file, mode_t modeFile, mode_t modePath, const String *user, const String *group,
|
||||
time_t timeModified, bool createPath, bool syncFile, bool syncPath, bool atomic)
|
||||
static StorageWrite *
|
||||
storagePosixNewWrite(
|
||||
THIS_VOID, const String *file, mode_t modeFile, mode_t modePath, const String *user, const String *group, time_t timeModified,
|
||||
bool createPath, bool syncFile, bool syncPath, bool atomic)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(MODE, modeFile);
|
||||
FUNCTION_LOG_PARAM(MODE, modePath);
|
||||
@ -438,8 +437,8 @@ storageDriverPosixNewWrite(
|
||||
ASSERT(file != NULL);
|
||||
|
||||
FUNCTION_LOG_RETURN(
|
||||
STORAGE_FILE_WRITE,
|
||||
storageFileWriteDriverPosixNew(
|
||||
STORAGE_WRITE,
|
||||
storageWritePosixNew(
|
||||
this, file, modeFile, modePath, user, group, timeModified, createPath, syncFile, this->syncPath ? syncPath : false,
|
||||
atomic));
|
||||
}
|
||||
@ -448,12 +447,12 @@ storageDriverPosixNewWrite(
|
||||
Create a path
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageDriverPosixPathCreate(THIS_VOID, const String *path, bool errorOnExists, bool noParentCreate, mode_t mode)
|
||||
storagePosixPathCreate(THIS_VOID, const String *path, bool errorOnExists, bool noParentCreate, mode_t mode)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnExists);
|
||||
FUNCTION_LOG_PARAM(BOOL, noParentCreate);
|
||||
@ -469,8 +468,8 @@ storageDriverPosixPathCreate(THIS_VOID, const String *path, bool errorOnExists,
|
||||
// If the parent path does not exist then create it if allowed
|
||||
if (errno == ENOENT && !noParentCreate)
|
||||
{
|
||||
storageDriverPosixPathCreate(this, strPath(path), errorOnExists, noParentCreate, mode);
|
||||
storageDriverPosixPathCreate(this, path, errorOnExists, noParentCreate, mode);
|
||||
storagePosixPathCreate(this, strPath(path), errorOnExists, noParentCreate, mode);
|
||||
storagePosixPathCreate(this, path, errorOnExists, noParentCreate, mode);
|
||||
}
|
||||
// Ignore path exists if allowed
|
||||
else if (errno != EEXIST || errorOnExists)
|
||||
@ -484,12 +483,12 @@ storageDriverPosixPathCreate(THIS_VOID, const String *path, bool errorOnExists,
|
||||
Remove a path
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverPosixPathRemove(THIS_VOID, const String *path, bool errorOnMissing, bool recurse)
|
||||
storagePosixPathRemove(THIS_VOID, const String *path, bool errorOnMissing, bool recurse)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_PARAM(BOOL, recurse);
|
||||
@ -504,7 +503,7 @@ storageDriverPosixPathRemove(THIS_VOID, const String *path, bool errorOnMissing,
|
||||
if (recurse)
|
||||
{
|
||||
// Get a list of files in this path
|
||||
StringList *fileList = storageDriverPosixList(this, path, errorOnMissing, NULL);
|
||||
StringList *fileList = storagePosixList(this, path, errorOnMissing, NULL);
|
||||
|
||||
// Only continue if the path exists
|
||||
if (fileList != NULL)
|
||||
@ -519,7 +518,7 @@ storageDriverPosixPathRemove(THIS_VOID, const String *path, bool errorOnMissing,
|
||||
{
|
||||
// These errors indicate that the entry is actually a path so we'll try to delete it that way
|
||||
if (errno == EPERM || errno == EISDIR) // {uncovered - EPERM is not returned on tested systems}
|
||||
storageDriverPosixPathRemove(this, file, false, true);
|
||||
storagePosixPathRemove(this, file, false, true);
|
||||
// Else error
|
||||
else
|
||||
THROW_SYS_ERROR_FMT(PathRemoveError, "unable to remove path/file '%s'", strPtr(file));
|
||||
@ -544,12 +543,12 @@ storageDriverPosixPathRemove(THIS_VOID, const String *path, bool errorOnMissing,
|
||||
Sync a path
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageDriverPosixPathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
storagePosixPathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_END();
|
||||
@ -560,16 +559,16 @@ storageDriverPosixPathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
if (this->syncPath)
|
||||
{
|
||||
// Open directory and handle errors
|
||||
int handle = storageDriverPosixFileOpen(path, O_RDONLY, 0, ignoreMissing, false, "sync");
|
||||
int handle = storagePosixFileOpen(path, O_RDONLY, 0, ignoreMissing, false, "sync");
|
||||
|
||||
// On success
|
||||
if (handle != -1)
|
||||
{
|
||||
// Attempt to sync the directory
|
||||
storageDriverPosixFileSync(handle, path, false, true);
|
||||
storagePosixFileSync(handle, path, false, true);
|
||||
|
||||
// Close the directory
|
||||
storageDriverPosixFileClose(handle, path, false);
|
||||
storagePosixFileClose(handle, path, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -580,12 +579,12 @@ storageDriverPosixPathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
Remove a file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverPosixRemove(THIS_VOID, const String *file, bool errorOnMissing)
|
||||
storagePosixRemove(THIS_VOID, const String *file, bool errorOnMissing)
|
||||
{
|
||||
THIS(StorageDriverPosix);
|
||||
THIS(StoragePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_END();
|
||||
@ -607,7 +606,7 @@ storageDriverPosixRemove(THIS_VOID, const String *file, bool errorOnMissing)
|
||||
New object
|
||||
***********************************************************************************************************************************/
|
||||
Storage *
|
||||
storageDriverPosixNewInternal(
|
||||
storagePosixNewInternal(
|
||||
const String *type, const String *path, mode_t modeFile, mode_t modePath, bool write,
|
||||
StoragePathExpressionCallback pathExpressionFunction, bool syncPath)
|
||||
{
|
||||
@ -629,18 +628,17 @@ storageDriverPosixNewInternal(
|
||||
// Create the object
|
||||
Storage *this = NULL;
|
||||
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageDriverPosix")
|
||||
MEM_CONTEXT_NEW_BEGIN("StoragePosix")
|
||||
{
|
||||
StorageDriverPosix *driver = memNew(sizeof(StorageDriverPosix));
|
||||
StoragePosix *driver = memNew(sizeof(StoragePosix));
|
||||
driver->memContext = MEM_CONTEXT_NEW();
|
||||
driver->syncPath = syncPath;
|
||||
|
||||
this = storageNewP(
|
||||
type, path, modeFile, modePath, write, pathExpressionFunction, driver, .exists = storageDriverPosixExists,
|
||||
.info = storageDriverPosixInfo, .infoList = storageDriverPosixInfoList, .list = storageDriverPosixList,
|
||||
.move = storageDriverPosixMove, .newRead = storageDriverPosixNewRead, .newWrite = storageDriverPosixNewWrite,
|
||||
.pathCreate = storageDriverPosixPathCreate, .pathRemove = storageDriverPosixPathRemove,
|
||||
.pathSync = storageDriverPosixPathSync, .remove = storageDriverPosixRemove);
|
||||
type, path, modeFile, modePath, write, pathExpressionFunction, driver, .exists = storagePosixExists,
|
||||
.info = storagePosixInfo, .infoList = storagePosixInfoList, .list = storagePosixList, .move = storagePosixMove,
|
||||
.newRead = storagePosixNewRead, .newWrite = storagePosixNewWrite, .pathCreate = storagePosixPathCreate,
|
||||
.pathRemove = storagePosixPathRemove, .pathSync = storagePosixPathSync, .remove = storagePosixRemove);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
@ -648,7 +646,7 @@ storageDriverPosixNewInternal(
|
||||
}
|
||||
|
||||
Storage *
|
||||
storageDriverPosixNew(
|
||||
storagePosixNew(
|
||||
const String *path, mode_t modeFile, mode_t modePath, bool write, StoragePathExpressionCallback pathExpressionFunction)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
@ -661,6 +659,6 @@ storageDriverPosixNew(
|
||||
|
||||
FUNCTION_LOG_RETURN(
|
||||
STORAGE,
|
||||
storageDriverPosixNewInternal(
|
||||
STORAGE_DRIVER_POSIX_TYPE_STR, path, modeFile, modePath, write, pathExpressionFunction, true));
|
||||
storagePosixNewInternal(
|
||||
STORAGE_POSIX_TYPE_STR, path, modeFile, modePath, write, pathExpressionFunction, true));
|
||||
}
|
@ -1,26 +1,26 @@
|
||||
/***********************************************************************************************************************************
|
||||
Posix Storage Driver
|
||||
Posix Storage
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_POSIX_STORAGE_H
|
||||
#define STORAGE_DRIVER_POSIX_STORAGE_H
|
||||
#ifndef STORAGE_POSIX_STORAGE_H
|
||||
#define STORAGE_POSIX_STORAGE_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageDriverPosix StorageDriverPosix;
|
||||
typedef struct StoragePosix StoragePosix;
|
||||
|
||||
#include "storage/storage.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Driver type constant
|
||||
Storage type
|
||||
***********************************************************************************************************************************/
|
||||
#define STORAGE_DRIVER_POSIX_TYPE "posix"
|
||||
STRING_DECLARE(STORAGE_DRIVER_POSIX_TYPE_STR);
|
||||
#define STORAGE_POSIX_TYPE "posix"
|
||||
STRING_DECLARE(STORAGE_POSIX_TYPE_STR);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
Storage *storageDriverPosixNew(
|
||||
Storage *storagePosixNew(
|
||||
const String *path, mode_t modeFile, mode_t modePath, bool write, StoragePathExpressionCallback pathExpressionFunction);
|
||||
|
||||
#endif
|
@ -1,31 +1,31 @@
|
||||
/***********************************************************************************************************************************
|
||||
Posix Storage Driver Internal
|
||||
Posix Storage Internal
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_POSIX_STORAGE_INTERN_H
|
||||
#define STORAGE_DRIVER_POSIX_STORAGE_INTERN_H
|
||||
#ifndef STORAGE_POSIX_STORAGE_INTERN_H
|
||||
#define STORAGE_POSIX_STORAGE_INTERN_H
|
||||
|
||||
#include "common/object.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
Storage *storageDriverPosixNewInternal(
|
||||
Storage *storagePosixNewInternal(
|
||||
const String *type, const String *path, mode_t modeFile, mode_t modePath, bool write,
|
||||
StoragePathExpressionCallback pathExpressionFunction, bool pathSync);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
void storageDriverPosixPathCreate(THIS_VOID, const String *path, bool errorOnExists, bool noParentCreate, mode_t mode);
|
||||
void storageDriverPosixPathSync(THIS_VOID, const String *path, bool ignoreMissing);
|
||||
void storagePosixPathCreate(THIS_VOID, const String *path, bool errorOnExists, bool noParentCreate, mode_t mode);
|
||||
void storagePosixPathSync(THIS_VOID, const String *path, bool ignoreMissing);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_DRIVER_POSIX_TYPE \
|
||||
StorageDriverPosix *
|
||||
#define FUNCTION_LOG_STORAGE_DRIVER_POSIX_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageDriverPosix *", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_POSIX_TYPE \
|
||||
StoragePosix *
|
||||
#define FUNCTION_LOG_STORAGE_POSIX_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StoragePosix *", buffer, bufferSize)
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Posix Storage File Write Driver
|
||||
Posix Storage File write
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -15,32 +15,32 @@ Posix Storage File Write Driver
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/object.h"
|
||||
#include "storage/driver/posix/common.h"
|
||||
#include "storage/driver/posix/fileWrite.h"
|
||||
#include "storage/driver/posix/storage.intern.h"
|
||||
#include "storage/fileWrite.intern.h"
|
||||
#include "storage/posix/common.h"
|
||||
#include "storage/posix/storage.intern.h"
|
||||
#include "storage/posix/write.h"
|
||||
#include "storage/write.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileWriteDriverPosix
|
||||
typedef struct StorageWritePosix
|
||||
{
|
||||
MemContext *memContext; // Object mem context
|
||||
StorageFileWriteInterface interface; // Driver interface
|
||||
StorageDriverPosix *storage; // Storage that created this object
|
||||
StorageWriteInterface interface; // Interface
|
||||
StoragePosix *storage; // Storage that created this object
|
||||
|
||||
const String *nameTmp;
|
||||
const String *path;
|
||||
int handle;
|
||||
} StorageFileWriteDriverPosix;
|
||||
} StorageWritePosix;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_DRIVER_POSIX_TYPE \
|
||||
StorageFileWriteDriverPosix *
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_DRIVER_POSIX_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageFileWriteDriverPosix", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_POSIX_TYPE \
|
||||
StorageWritePosix *
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_POSIX_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageWritePosix", buffer, bufferSize)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
File open constants
|
||||
@ -54,12 +54,12 @@ Since open is called more than once use constants to make sure these parameters
|
||||
Close the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverPosixClose(THIS_VOID)
|
||||
storageWritePosixClose(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileWriteDriverPosix);
|
||||
THIS(StorageWritePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_POSIX, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -69,10 +69,10 @@ storageFileWriteDriverPosixClose(THIS_VOID)
|
||||
{
|
||||
// Sync the file
|
||||
if (this->interface.syncFile)
|
||||
storageDriverPosixFileSync(this->handle, this->nameTmp, true, false);
|
||||
storagePosixFileSync(this->handle, this->nameTmp, true, false);
|
||||
|
||||
// Close the file
|
||||
storageDriverPosixFileClose(this->handle, this->nameTmp, true);
|
||||
storagePosixFileClose(this->handle, this->nameTmp, true);
|
||||
|
||||
// Update modified time
|
||||
if (this->interface.timeModified != 0)
|
||||
@ -96,7 +96,7 @@ storageFileWriteDriverPosixClose(THIS_VOID)
|
||||
|
||||
// Sync the path
|
||||
if (this->interface.syncPath)
|
||||
storageDriverPosixPathSync(this->storage, this->path, false);
|
||||
storagePosixPathSync(this->storage, this->path, false);
|
||||
|
||||
// This marks the file as closed
|
||||
this->handle = -1;
|
||||
@ -109,10 +109,10 @@ storageFileWriteDriverPosixClose(THIS_VOID)
|
||||
Free object
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverPosixFree(StorageFileWriteDriverPosix *this)
|
||||
storageWritePosixFree(StorageWritePosix *this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_POSIX, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
if (this != NULL)
|
||||
@ -123,7 +123,7 @@ storageFileWriteDriverPosixFree(StorageFileWriteDriverPosix *this)
|
||||
// is called first the assumption is that some kind of error occurred and we should only close the handle to free
|
||||
// resources.
|
||||
if (this->handle != -1)
|
||||
storageDriverPosixFileClose(this->handle, this->interface.name, true);
|
||||
storagePosixFileClose(this->handle, this->interface.name, true);
|
||||
|
||||
memContextFree(this->memContext);
|
||||
}
|
||||
@ -135,34 +135,34 @@ storageFileWriteDriverPosixFree(StorageFileWriteDriverPosix *this)
|
||||
Open the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverPosixOpen(THIS_VOID)
|
||||
storageWritePosixOpen(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileWriteDriverPosix);
|
||||
THIS(StorageWritePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_POSIX, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
ASSERT(this->handle == -1);
|
||||
|
||||
// Open the file and handle errors
|
||||
this->handle = storageDriverPosixFileOpen(
|
||||
this->handle = storagePosixFileOpen(
|
||||
this->nameTmp, FILE_OPEN_FLAGS, this->interface.modeFile, this->interface.createPath, true, FILE_OPEN_PURPOSE);
|
||||
|
||||
// If path is missing
|
||||
if (this->handle == -1)
|
||||
{
|
||||
// Create the path
|
||||
storageDriverPosixPathCreate(this->storage, this->path, false, false, this->interface.modePath);
|
||||
storagePosixPathCreate(this->storage, this->path, false, false, this->interface.modePath);
|
||||
|
||||
// Try the open again
|
||||
this->handle = storageDriverPosixFileOpen(
|
||||
this->handle = storagePosixFileOpen(
|
||||
this->nameTmp, FILE_OPEN_FLAGS, this->interface.modeFile, false, true, FILE_OPEN_PURPOSE);
|
||||
}
|
||||
|
||||
// Set free callback to ensure file handle is freed
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageFileWriteDriverPosixFree, this);
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageWritePosixFree, this);
|
||||
|
||||
// Update user/group owner
|
||||
if (this->interface.user != NULL || this->interface.group != NULL)
|
||||
@ -198,12 +198,12 @@ storageFileWriteDriverPosixOpen(THIS_VOID)
|
||||
Write to the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverPosix(THIS_VOID, const Buffer *buffer)
|
||||
storageWritePosix(THIS_VOID, const Buffer *buffer)
|
||||
{
|
||||
THIS(StorageFileWriteDriverPosix);
|
||||
THIS(StorageWritePosix);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_POSIX, this);
|
||||
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
@ -222,12 +222,12 @@ storageFileWriteDriverPosix(THIS_VOID, const Buffer *buffer)
|
||||
Get handle (file descriptor)
|
||||
***********************************************************************************************************************************/
|
||||
static int
|
||||
storageFileWriteDriverPosixHandle(const THIS_VOID)
|
||||
storageWritePosixHandle(const THIS_VOID)
|
||||
{
|
||||
THIS(const StorageFileWriteDriverPosix);
|
||||
THIS(const StorageWritePosix);
|
||||
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE_DRIVER_POSIX, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE_POSIX, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -238,13 +238,13 @@ storageFileWriteDriverPosixHandle(const THIS_VOID)
|
||||
/***********************************************************************************************************************************
|
||||
New object
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *
|
||||
storageFileWriteDriverPosixNew(
|
||||
StorageDriverPosix *storage, const String *name, mode_t modeFile, mode_t modePath, const String *user, const String *group,
|
||||
StorageWrite *
|
||||
storageWritePosixNew(
|
||||
StoragePosix *storage, const String *name, mode_t modeFile, mode_t modePath, const String *user, const String *group,
|
||||
time_t timeModified, bool createPath, bool syncFile, bool syncPath, bool atomic)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_POSIX, storage);
|
||||
FUNCTION_LOG_PARAM(STORAGE_POSIX, storage);
|
||||
FUNCTION_LOG_PARAM(STRING, name);
|
||||
FUNCTION_LOG_PARAM(MODE, modeFile);
|
||||
FUNCTION_LOG_PARAM(MODE, modePath);
|
||||
@ -262,16 +262,16 @@ storageFileWriteDriverPosixNew(
|
||||
ASSERT(modeFile != 0);
|
||||
ASSERT(modePath != 0);
|
||||
|
||||
StorageFileWrite *this = NULL;
|
||||
StorageWrite *this = NULL;
|
||||
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageFileWriteDriverPosix")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageWritePosix")
|
||||
{
|
||||
StorageFileWriteDriverPosix *driver = memNew(sizeof(StorageFileWriteDriverPosix));
|
||||
StorageWritePosix *driver = memNew(sizeof(StorageWritePosix));
|
||||
driver->memContext = MEM_CONTEXT_NEW();
|
||||
|
||||
driver->interface = (StorageFileWriteInterface)
|
||||
driver->interface = (StorageWriteInterface)
|
||||
{
|
||||
.type = STORAGE_DRIVER_POSIX_TYPE_STR,
|
||||
.type = STORAGE_POSIX_TYPE_STR,
|
||||
.name = strDup(name),
|
||||
.atomic = atomic,
|
||||
.createPath = createPath,
|
||||
@ -285,10 +285,10 @@ storageFileWriteDriverPosixNew(
|
||||
|
||||
.ioInterface = (IoWriteInterface)
|
||||
{
|
||||
.close = storageFileWriteDriverPosixClose,
|
||||
.handle = storageFileWriteDriverPosixHandle,
|
||||
.open = storageFileWriteDriverPosixOpen,
|
||||
.write = storageFileWriteDriverPosix,
|
||||
.close = storageWritePosixClose,
|
||||
.handle = storageWritePosixHandle,
|
||||
.open = storageWritePosixOpen,
|
||||
.write = storageWritePosix,
|
||||
},
|
||||
};
|
||||
|
||||
@ -297,9 +297,9 @@ storageFileWriteDriverPosixNew(
|
||||
driver->path = strPath(name);
|
||||
driver->handle = -1;
|
||||
|
||||
this = storageFileWriteNew(driver, &driver->interface);
|
||||
this = storageWriteNew(driver, &driver->interface);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_LOG_RETURN(STORAGE_WRITE, this);
|
||||
}
|
@ -1,18 +1,17 @@
|
||||
/***********************************************************************************************************************************
|
||||
Posix Storage File Write Driver
|
||||
Posix Storage File write
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_POSIX_FILEWRITE_H
|
||||
#define STORAGE_DRIVER_POSIX_FILEWRITE_H
|
||||
#ifndef STORAGE_POSIX_WRITE_H
|
||||
#define STORAGE_POSIX_WRITE_H
|
||||
|
||||
#include "storage/fileWrite.intern.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/fileWrite.h"
|
||||
#include "storage/posix/storage.h"
|
||||
#include "storage/write.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *storageFileWriteDriverPosixNew(
|
||||
StorageDriverPosix *storage, const String *name, mode_t modeFile, mode_t modePath, const String *user, const String *group,
|
||||
StorageWrite *storageWritePosixNew(
|
||||
StoragePosix *storage, const String *name, mode_t modeFile, mode_t modePath, const String *user, const String *group,
|
||||
time_t timeModified, bool createPath, bool syncFile, bool syncPath, bool atomic);
|
||||
|
||||
#endif
|
@ -1,66 +1,66 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Read Interface
|
||||
Storage Read Interface
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "storage/fileRead.intern.h"
|
||||
#include "storage/read.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
struct StorageFileRead
|
||||
struct StorageRead
|
||||
{
|
||||
MemContext *memContext; // Object mem context
|
||||
void *driver;
|
||||
const StorageFileReadInterface *interface;
|
||||
const StorageReadInterface *interface;
|
||||
IoRead *io;
|
||||
};
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_INTERFACE_TYPE \
|
||||
StorageFileReadInterface
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(&value, "StorageFileReadInterface", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_READ_INTERFACE_TYPE \
|
||||
StorageReadInterface
|
||||
#define FUNCTION_LOG_STORAGE_READ_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(&value, "StorageReadInterface", buffer, bufferSize)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Create a new storage file
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *
|
||||
storageFileReadNew(void *driver, const StorageFileReadInterface *interface)
|
||||
StorageRead *
|
||||
storageReadNew(void *driver, const StorageReadInterface *interface)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM_P(VOID, driver);
|
||||
FUNCTION_LOG_PARAM_P(STORAGE_FILE_READ_INTERFACE, interface);
|
||||
FUNCTION_LOG_PARAM_P(STORAGE_READ_INTERFACE, interface);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(driver != NULL);
|
||||
ASSERT(interface != NULL);
|
||||
|
||||
StorageFileRead *this = NULL;
|
||||
StorageRead *this = NULL;
|
||||
|
||||
this = memNew(sizeof(StorageFileRead));
|
||||
this = memNew(sizeof(StorageRead));
|
||||
this->memContext = memContextCurrent();
|
||||
this->driver = driver;
|
||||
this->interface = interface;
|
||||
|
||||
this->io = ioReadNew(driver, interface->ioInterface);
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_READ, this);
|
||||
FUNCTION_LOG_RETURN(STORAGE_READ, this);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Move the file object to a new context
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *
|
||||
storageFileReadMove(StorageFileRead *this, MemContext *parentNew)
|
||||
StorageRead *
|
||||
storageReadMove(StorageRead *this, MemContext *parentNew)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ, this);
|
||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
@ -76,10 +76,10 @@ storageFileReadMove(StorageFileRead *this, MemContext *parentNew)
|
||||
Get file driver
|
||||
***********************************************************************************************************************************/
|
||||
void *
|
||||
storageFileReadDriver(const StorageFileRead *this)
|
||||
storageRead(const StorageRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -91,10 +91,10 @@ storageFileReadDriver(const StorageFileRead *this)
|
||||
Should a missing file be ignored?
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileReadIgnoreMissing(const StorageFileRead *this)
|
||||
storageReadIgnoreMissing(const StorageRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -106,10 +106,10 @@ storageFileReadIgnoreMissing(const StorageFileRead *this)
|
||||
Get io interface
|
||||
***********************************************************************************************************************************/
|
||||
IoRead *
|
||||
storageFileReadIo(const StorageFileRead *this)
|
||||
storageReadIo(const StorageRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -121,10 +121,10 @@ storageFileReadIo(const StorageFileRead *this)
|
||||
Get file name
|
||||
***********************************************************************************************************************************/
|
||||
const String *
|
||||
storageFileReadName(const StorageFileRead *this)
|
||||
storageReadName(const StorageRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -136,10 +136,10 @@ storageFileReadName(const StorageFileRead *this)
|
||||
Get file type
|
||||
***********************************************************************************************************************************/
|
||||
const String *
|
||||
storageFileReadType(const StorageFileRead *this)
|
||||
storageReadType(const StorageRead *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -151,7 +151,7 @@ storageFileReadType(const StorageFileRead *this)
|
||||
Render as string for logging
|
||||
***********************************************************************************************************************************/
|
||||
String *
|
||||
storageFileReadToLog(const StorageFileRead *this)
|
||||
storageReadToLog(const StorageRead *this)
|
||||
{
|
||||
return strNewFmt(
|
||||
"{type: %s, name: %s, ignoreMissing: %s}", strPtr(this->interface->type), strPtr(strToLog(this->interface->name)),
|
||||
@ -162,10 +162,10 @@ storageFileReadToLog(const StorageFileRead *this)
|
||||
Free the file
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFileReadFree(const StorageFileRead *this)
|
||||
storageReadFree(const StorageRead *this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
if (this != NULL)
|
@ -1,42 +1,42 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Read Interface
|
||||
Storage Read Interface
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_FILEREAD_H
|
||||
#define STORAGE_FILEREAD_H
|
||||
#ifndef STORAGE_READ_H
|
||||
#define STORAGE_READ_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileRead StorageFileRead;
|
||||
typedef struct StorageRead StorageRead;
|
||||
|
||||
#include "common/io/read.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *storageFileReadMove(StorageFileRead *this, MemContext *parentNew);
|
||||
StorageRead *storageReadMove(StorageRead *this, MemContext *parentNew);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Getters
|
||||
***********************************************************************************************************************************/
|
||||
IoRead *storageFileReadIo(const StorageFileRead *this);
|
||||
bool storageFileReadIgnoreMissing(const StorageFileRead *this);
|
||||
const String *storageFileReadName(const StorageFileRead *this);
|
||||
const String *storageFileReadType(const StorageFileRead *this);
|
||||
IoRead *storageReadIo(const StorageRead *this);
|
||||
bool storageReadIgnoreMissing(const StorageRead *this);
|
||||
const String *storageReadName(const StorageRead *this);
|
||||
const String *storageReadType(const StorageRead *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Destructor
|
||||
***********************************************************************************************************************************/
|
||||
void storageFileReadFree(const StorageFileRead *this);
|
||||
void storageReadFree(const StorageRead *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
String *storageFileReadToLog(const StorageFileRead *this);
|
||||
String *storageReadToLog(const StorageRead *this);
|
||||
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_TYPE \
|
||||
StorageFileRead *
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_FORMAT(value, buffer, bufferSize) \
|
||||
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, storageFileReadToLog, buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_READ_TYPE \
|
||||
StorageRead *
|
||||
#define FUNCTION_LOG_STORAGE_READ_FORMAT(value, buffer, bufferSize) \
|
||||
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, storageReadToLog, buffer, bufferSize)
|
||||
|
||||
#endif
|
@ -1,28 +1,28 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Read Interface Internal
|
||||
Storage Read Interface Internal
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_FILEREAD_INTERN_H
|
||||
#define STORAGE_FILEREAD_INTERN_H
|
||||
#ifndef STORAGE_READ_INTERN_H
|
||||
#define STORAGE_READ_INTERN_H
|
||||
|
||||
#include "common/io/read.intern.h"
|
||||
#include "storage/fileRead.h"
|
||||
#include "storage/read.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileReadInterface
|
||||
typedef struct StorageReadInterface
|
||||
{
|
||||
const String * type;
|
||||
const String * name;
|
||||
bool ignoreMissing;
|
||||
IoReadInterface ioInterface;
|
||||
} StorageFileReadInterface;
|
||||
} StorageReadInterface;
|
||||
|
||||
StorageFileRead *storageFileReadNew(void *driver, const StorageFileReadInterface *interface);
|
||||
StorageRead *storageReadNew(void *driver, const StorageReadInterface *interface);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
void *storageFileReadDriver(const StorageFileRead *this);
|
||||
void *storageRead(const StorageRead *this);
|
||||
|
||||
#endif
|
@ -8,7 +8,7 @@ Remote Storage Protocol Handler
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/regExp.h"
|
||||
#include "storage/driver/remote/protocol.h"
|
||||
#include "storage/remote/protocol.h"
|
||||
#include "storage/helper.h"
|
||||
#include "storage/storage.intern.h"
|
||||
|
||||
@ -32,13 +32,13 @@ static struct
|
||||
{
|
||||
MemContext *memContext; // Mem context
|
||||
RegExp *blockRegExp; // Regular expression to check block messages
|
||||
} storageDriverRemoteProtocolLocal;
|
||||
} storageRemoteProtocolLocal;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Process storage protocol requests
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageDriverRemoteProtocol(const String *command, const VariantList *paramList, ProtocolServer *server)
|
||||
storageRemoteProtocol(const String *command, const VariantList *paramList, ProtocolServer *server)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STRING, command);
|
||||
@ -76,7 +76,7 @@ storageDriverRemoteProtocol(const String *command, const VariantList *paramList,
|
||||
else if (strEq(command, PROTOCOL_COMMAND_STORAGE_OPEN_READ_STR))
|
||||
{
|
||||
// Create the read object
|
||||
IoRead *fileRead = storageFileReadIo(
|
||||
IoRead *fileRead = storageReadIo(
|
||||
interface.newRead(
|
||||
driver, storagePathNP(storage, varStr(varLstGet(paramList, 0))), varBool(varLstGet(paramList, 1))));
|
||||
|
||||
@ -113,7 +113,7 @@ storageDriverRemoteProtocol(const String *command, const VariantList *paramList,
|
||||
else if (strEq(command, PROTOCOL_COMMAND_STORAGE_OPEN_WRITE_STR))
|
||||
{
|
||||
// Create the write object
|
||||
IoWrite *fileWrite = storageFileWriteIo(
|
||||
IoWrite *fileWrite = storageWriteIo(
|
||||
interface.newWrite(
|
||||
driver, storagePathNP(storage, varStr(varLstGet(paramList, 0))), varUIntForce(varLstGet(paramList, 1)),
|
||||
varUIntForce(varLstGet(paramList, 2)), varStr(varLstGet(paramList, 3)), varStr(varLstGet(paramList, 4)),
|
||||
@ -131,7 +131,7 @@ storageDriverRemoteProtocol(const String *command, const VariantList *paramList,
|
||||
do
|
||||
{
|
||||
// How much data is remaining to write?
|
||||
remaining = storageDriverRemoteProtocolBlockSize(ioReadLine(protocolServerIoRead(server)));
|
||||
remaining = storageRemoteProtocolBlockSize(ioReadLine(protocolServerIoRead(server)));
|
||||
|
||||
// Write data
|
||||
if (remaining > 0)
|
||||
@ -176,7 +176,7 @@ storageDriverRemoteProtocol(const String *command, const VariantList *paramList,
|
||||
Get size of the next transfer block
|
||||
***********************************************************************************************************************************/
|
||||
ssize_t
|
||||
storageDriverRemoteProtocolBlockSize(const String *message)
|
||||
storageRemoteProtocolBlockSize(const String *message)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STRING, message);
|
||||
@ -185,14 +185,14 @@ storageDriverRemoteProtocolBlockSize(const String *message)
|
||||
ASSERT(message != NULL);
|
||||
|
||||
// Create block regular expression if it has not been created yet
|
||||
if (storageDriverRemoteProtocolLocal.memContext == NULL)
|
||||
if (storageRemoteProtocolLocal.memContext == NULL)
|
||||
{
|
||||
MEM_CONTEXT_BEGIN(memContextTop())
|
||||
{
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageDriverRemoteFileReadLocal")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageRemoteFileReadLocal")
|
||||
{
|
||||
storageDriverRemoteProtocolLocal.memContext = memContextCurrent();
|
||||
storageDriverRemoteProtocolLocal.blockRegExp = regExpNew(BLOCK_REG_EXP_STR);
|
||||
storageRemoteProtocolLocal.memContext = memContextCurrent();
|
||||
storageRemoteProtocolLocal.blockRegExp = regExpNew(BLOCK_REG_EXP_STR);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
}
|
||||
@ -200,7 +200,7 @@ storageDriverRemoteProtocolBlockSize(const String *message)
|
||||
}
|
||||
|
||||
// Validate the header block size message
|
||||
if (!regExpMatch(storageDriverRemoteProtocolLocal.blockRegExp, message))
|
||||
if (!regExpMatch(storageRemoteProtocolLocal.blockRegExp, message))
|
||||
THROW_FMT(ProtocolError, "'%s' is not a valid block size message", strPtr(message));
|
||||
|
||||
FUNCTION_LOG_RETURN(SSIZE, (ssize_t)cvtZToInt(strPtr(message) + sizeof(PROTOCOL_BLOCK_HEADER) - 1));
|
@ -1,8 +1,8 @@
|
||||
/***********************************************************************************************************************************
|
||||
Remote Storage Protocol Handler
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_REMOTE_PROTOCOL_H
|
||||
#define STORAGE_DRIVER_REMOTE_PROTOCOL_H
|
||||
#ifndef STORAGE_REMOTE_PROTOCOL_H
|
||||
#define STORAGE_REMOTE_PROTOCOL_H
|
||||
|
||||
#include "common/type/string.h"
|
||||
#include "common/type/variantList.h"
|
||||
@ -25,7 +25,7 @@ Constants
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
ssize_t storageDriverRemoteProtocolBlockSize(const String *message);
|
||||
bool storageDriverRemoteProtocol(const String *command, const VariantList *paramList, ProtocolServer *server);
|
||||
ssize_t storageRemoteProtocolBlockSize(const String *message);
|
||||
bool storageRemoteProtocol(const String *command, const VariantList *paramList, ProtocolServer *server);
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Remote Storage File Read Driver
|
||||
Remote Storage Read
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -12,42 +12,42 @@ Remote Storage File Read Driver
|
||||
#include "common/memContext.h"
|
||||
#include "common/object.h"
|
||||
#include "common/type/convert.h"
|
||||
#include "storage/driver/remote/fileRead.h"
|
||||
#include "storage/driver/remote/protocol.h"
|
||||
#include "storage/fileRead.intern.h"
|
||||
#include "storage/remote/protocol.h"
|
||||
#include "storage/remote/read.h"
|
||||
#include "storage/read.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileReadDriverRemote
|
||||
typedef struct StorageReadRemote
|
||||
{
|
||||
MemContext *memContext; // Object mem context
|
||||
StorageFileReadInterface interface; // Driver interface
|
||||
StorageDriverRemote *storage; // Storage that created this object
|
||||
StorageReadInterface interface; // Interface
|
||||
StorageRemote *storage; // Storage that created this object
|
||||
|
||||
ProtocolClient *client; // Protocol client for requests
|
||||
size_t remaining; // Bytes remaining to be read in block
|
||||
bool eof; // Has the file reached eof?
|
||||
} StorageFileReadDriverRemote;
|
||||
} StorageReadRemote;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_DRIVER_REMOTE_TYPE \
|
||||
StorageFileReadDriverRemote *
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_DRIVER_REMOTE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageFileReadDriverRemote", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_READ_REMOTE_TYPE \
|
||||
StorageReadRemote *
|
||||
#define FUNCTION_LOG_STORAGE_READ_REMOTE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageReadRemote", buffer, bufferSize)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Open the file
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageFileReadDriverRemoteOpen(THIS_VOID)
|
||||
storageReadRemoteOpen(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileReadDriverRemote);
|
||||
THIS(StorageReadRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ_REMOTE, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -71,12 +71,12 @@ storageFileReadDriverRemoteOpen(THIS_VOID)
|
||||
Read from a file
|
||||
***********************************************************************************************************************************/
|
||||
static size_t
|
||||
storageFileReadDriverRemote(THIS_VOID, Buffer *buffer, bool block)
|
||||
storageReadRemote(THIS_VOID, Buffer *buffer, bool block)
|
||||
{
|
||||
THIS(StorageFileReadDriverRemote);
|
||||
THIS(StorageReadRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||
FUNCTION_LOG_PARAM(BOOL, block);
|
||||
FUNCTION_LOG_END();
|
||||
@ -96,7 +96,7 @@ storageFileReadDriverRemote(THIS_VOID, Buffer *buffer, bool block)
|
||||
{
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
this->remaining = (size_t)storageDriverRemoteProtocolBlockSize(ioReadLine(protocolClientIoRead(this->client)));
|
||||
this->remaining = (size_t)storageRemoteProtocolBlockSize(ioReadLine(protocolClientIoRead(this->client)));
|
||||
|
||||
if (this->remaining == 0)
|
||||
this->eof = true;
|
||||
@ -130,12 +130,12 @@ storageFileReadDriverRemote(THIS_VOID, Buffer *buffer, bool block)
|
||||
Has file reached EOF?
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageFileReadDriverRemoteEof(THIS_VOID)
|
||||
storageReadRemoteEof(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileReadDriverRemote);
|
||||
THIS(StorageReadRemote);
|
||||
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ_DRIVER_REMOTE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ_REMOTE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -146,11 +146,11 @@ storageFileReadDriverRemoteEof(THIS_VOID)
|
||||
/***********************************************************************************************************************************
|
||||
New object
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *
|
||||
storageFileReadDriverRemoteNew(StorageDriverRemote *storage, ProtocolClient *client, const String *name, bool ignoreMissing)
|
||||
StorageRead *
|
||||
storageReadRemoteNew(StorageRemote *storage, ProtocolClient *client, const String *name, bool ignoreMissing)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, storage);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, storage);
|
||||
FUNCTION_LOG_PARAM(PROTOCOL_CLIENT, client);
|
||||
FUNCTION_LOG_PARAM(STRING, name);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
@ -160,33 +160,33 @@ storageFileReadDriverRemoteNew(StorageDriverRemote *storage, ProtocolClient *cli
|
||||
ASSERT(client != NULL);
|
||||
ASSERT(name != NULL);
|
||||
|
||||
StorageFileRead *this = NULL;
|
||||
StorageRead *this = NULL;
|
||||
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageFileReadDriverRemote")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageReadRemote")
|
||||
{
|
||||
StorageFileReadDriverRemote *driver = memNew(sizeof(StorageFileReadDriverRemote));
|
||||
StorageReadRemote *driver = memNew(sizeof(StorageReadRemote));
|
||||
driver->memContext = MEM_CONTEXT_NEW();
|
||||
|
||||
driver->interface = (StorageFileReadInterface)
|
||||
driver->interface = (StorageReadInterface)
|
||||
{
|
||||
.type = STORAGE_DRIVER_REMOTE_TYPE_STR,
|
||||
.type = STORAGE_REMOTE_TYPE_STR,
|
||||
.name = strDup(name),
|
||||
.ignoreMissing = ignoreMissing,
|
||||
|
||||
.ioInterface = (IoReadInterface)
|
||||
{
|
||||
.eof = storageFileReadDriverRemoteEof,
|
||||
.open = storageFileReadDriverRemoteOpen,
|
||||
.read = storageFileReadDriverRemote,
|
||||
.eof = storageReadRemoteEof,
|
||||
.open = storageReadRemoteOpen,
|
||||
.read = storageReadRemote,
|
||||
},
|
||||
};
|
||||
|
||||
driver->storage = storage;
|
||||
driver->client = client;
|
||||
|
||||
this = storageFileReadNew(driver, &driver->interface);
|
||||
this = storageReadNew(driver, &driver->interface);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_READ, this);
|
||||
FUNCTION_LOG_RETURN(STORAGE_READ, this);
|
||||
}
|
@ -1,17 +1,16 @@
|
||||
/***********************************************************************************************************************************
|
||||
Remote Storage File Read Driver
|
||||
Remote Storage Read
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_REMOTE_FILEREAD_H
|
||||
#define STORAGE_DRIVER_REMOTE_FILEREAD_H
|
||||
#ifndef STORAGE_REMOTE_READ_H
|
||||
#define STORAGE_REMOTE_READ_H
|
||||
|
||||
#include "protocol/client.h"
|
||||
#include "storage/driver/remote/storage.intern.h"
|
||||
#include "storage/fileRead.h"
|
||||
#include "storage/remote/storage.intern.h"
|
||||
#include "storage/read.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *storageFileReadDriverRemoteNew(
|
||||
StorageDriverRemote *storage, ProtocolClient *client, const String *name, bool ignoreMissing);
|
||||
StorageRead *storageReadRemoteNew(StorageRemote *storage, ProtocolClient *client, const String *name, bool ignoreMissing);
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Remote Storage Driver
|
||||
Remote Storage
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -7,20 +7,20 @@ Remote Storage Driver
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/object.h"
|
||||
#include "storage/driver/remote/fileRead.h"
|
||||
#include "storage/driver/remote/fileWrite.h"
|
||||
#include "storage/driver/remote/protocol.h"
|
||||
#include "storage/driver/remote/storage.intern.h"
|
||||
#include "storage/remote/protocol.h"
|
||||
#include "storage/remote/read.h"
|
||||
#include "storage/remote/storage.intern.h"
|
||||
#include "storage/remote/write.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Driver type constant string
|
||||
Storage type
|
||||
***********************************************************************************************************************************/
|
||||
STRING_EXTERN(STORAGE_DRIVER_REMOTE_TYPE_STR, STORAGE_DRIVER_REMOTE_TYPE);
|
||||
STRING_EXTERN(STORAGE_REMOTE_TYPE_STR, STORAGE_REMOTE_TYPE);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
struct StorageDriverRemote
|
||||
struct StorageRemote
|
||||
{
|
||||
MemContext *memContext;
|
||||
ProtocolClient *client; // Protocol client
|
||||
@ -30,12 +30,12 @@ struct StorageDriverRemote
|
||||
Does a file exist? This function is only for files, not paths.
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageDriverRemoteExists(THIS_VOID, const String *path)
|
||||
storageRemoteExists(THIS_VOID, const String *path)
|
||||
{
|
||||
THIS(StorageDriverRemote);
|
||||
THIS(StorageRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
@ -60,12 +60,12 @@ storageDriverRemoteExists(THIS_VOID, const String *path)
|
||||
File/path info
|
||||
***********************************************************************************************************************************/
|
||||
static StorageInfo
|
||||
storageDriverRemoteInfo(THIS_VOID, const String *file, bool ignoreMissing, bool followLink)
|
||||
storageRemoteInfo(THIS_VOID, const String *file, bool ignoreMissing, bool followLink)
|
||||
{
|
||||
THIS(StorageDriverRemote);
|
||||
THIS(StorageRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_PARAM(BOOL, followLink);
|
||||
@ -83,12 +83,12 @@ storageDriverRemoteInfo(THIS_VOID, const String *file, bool ignoreMissing, bool
|
||||
Get a list of files from a directory
|
||||
***********************************************************************************************************************************/
|
||||
static StringList *
|
||||
storageDriverRemoteList(THIS_VOID, const String *path, bool errorOnMissing, const String *expression)
|
||||
storageRemoteList(THIS_VOID, const String *path, bool errorOnMissing, const String *expression)
|
||||
{
|
||||
THIS(StorageDriverRemote);
|
||||
THIS(StorageRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_PARAM(STRING, expression);
|
||||
@ -116,34 +116,34 @@ storageDriverRemoteList(THIS_VOID, const String *path, bool errorOnMissing, cons
|
||||
/***********************************************************************************************************************************
|
||||
New file read object
|
||||
***********************************************************************************************************************************/
|
||||
static StorageFileRead *
|
||||
storageDriverRemoteNewRead(THIS_VOID, const String *file, bool ignoreMissing)
|
||||
static StorageRead *
|
||||
storageRemoteNewRead(THIS_VOID, const String *file, bool ignoreMissing)
|
||||
{
|
||||
THIS(StorageDriverRemote);
|
||||
THIS(StorageRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_READ, storageFileReadDriverRemoteNew(this, this->client, file, ignoreMissing));
|
||||
FUNCTION_LOG_RETURN(STORAGE_READ, storageReadRemoteNew(this, this->client, file, ignoreMissing));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
New file write object
|
||||
***********************************************************************************************************************************/
|
||||
static StorageFileWrite *
|
||||
storageDriverRemoteNewWrite(
|
||||
THIS_VOID, const String *file, mode_t modeFile, mode_t modePath, const String *user, const String *group,
|
||||
time_t timeModified, bool createPath, bool syncFile, bool syncPath, bool atomic)
|
||||
static StorageWrite *
|
||||
storageRemoteNewWrite(
|
||||
THIS_VOID, const String *file, mode_t modeFile, mode_t modePath, const String *user, const String *group, time_t timeModified,
|
||||
bool createPath, bool syncFile, bool syncPath, bool atomic)
|
||||
{
|
||||
THIS(StorageDriverRemote);
|
||||
THIS(StorageRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(MODE, modeFile);
|
||||
FUNCTION_LOG_PARAM(MODE, modePath);
|
||||
@ -160,8 +160,8 @@ storageDriverRemoteNewWrite(
|
||||
ASSERT(file != NULL);
|
||||
|
||||
FUNCTION_LOG_RETURN(
|
||||
STORAGE_FILE_WRITE,
|
||||
storageFileWriteDriverRemoteNew(
|
||||
STORAGE_WRITE,
|
||||
storageWriteRemoteNew(
|
||||
this, this->client, file, modeFile, modePath, user, group, timeModified, createPath, syncFile, syncPath, atomic));
|
||||
}
|
||||
|
||||
@ -169,12 +169,12 @@ storageDriverRemoteNewWrite(
|
||||
Create a path. There are no physical paths on S3 so just return success.
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverRemotePathCreate(THIS_VOID, const String *path, bool errorOnExists, bool noParentCreate, mode_t mode)
|
||||
storageRemotePathCreate(THIS_VOID, const String *path, bool errorOnExists, bool noParentCreate, mode_t mode)
|
||||
{
|
||||
THIS(StorageDriverRemote);
|
||||
THIS(StorageRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnExists);
|
||||
FUNCTION_LOG_PARAM(BOOL, noParentCreate);
|
||||
@ -193,12 +193,12 @@ storageDriverRemotePathCreate(THIS_VOID, const String *path, bool errorOnExists,
|
||||
Remove a path
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverRemotePathRemove(THIS_VOID, const String *path, bool errorOnMissing, bool recurse)
|
||||
storageRemotePathRemove(THIS_VOID, const String *path, bool errorOnMissing, bool recurse)
|
||||
{
|
||||
THIS(StorageDriverRemote);
|
||||
THIS(StorageRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_PARAM(BOOL, recurse);
|
||||
@ -216,12 +216,12 @@ storageDriverRemotePathRemove(THIS_VOID, const String *path, bool errorOnMissing
|
||||
Sync a path. There's no need for this on S3 so just return success.
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverRemotePathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
storageRemotePathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
{
|
||||
THIS(StorageDriverRemote);
|
||||
THIS(StorageRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_END();
|
||||
@ -238,12 +238,12 @@ storageDriverRemotePathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
Remove a file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverRemoteRemove(THIS_VOID, const String *file, bool errorOnMissing)
|
||||
storageRemoteRemove(THIS_VOID, const String *file, bool errorOnMissing)
|
||||
{
|
||||
THIS(StorageDriverRemote);
|
||||
THIS(StorageRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_END();
|
||||
@ -260,7 +260,7 @@ storageDriverRemoteRemove(THIS_VOID, const String *file, bool errorOnMissing)
|
||||
New object
|
||||
***********************************************************************************************************************************/
|
||||
Storage *
|
||||
storageDriverRemoteNew(
|
||||
storageRemoteNew(
|
||||
mode_t modeFile, mode_t modePath, bool write, StoragePathExpressionCallback pathExpressionFunction, ProtocolClient *client)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
@ -277,18 +277,18 @@ storageDriverRemoteNew(
|
||||
|
||||
Storage *this = NULL;
|
||||
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageDriverRemote")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageRemote")
|
||||
{
|
||||
StorageDriverRemote *driver = memNew(sizeof(StorageDriverRemote));
|
||||
StorageRemote *driver = memNew(sizeof(StorageRemote));
|
||||
driver->memContext = MEM_CONTEXT_NEW();
|
||||
driver->client = client;
|
||||
|
||||
this = storageNewP(
|
||||
STORAGE_DRIVER_REMOTE_TYPE_STR, NULL, modeFile, modePath, write, pathExpressionFunction, driver,
|
||||
.exists = storageDriverRemoteExists, .info = storageDriverRemoteInfo, .list = storageDriverRemoteList,
|
||||
.newRead = storageDriverRemoteNewRead, .newWrite = storageDriverRemoteNewWrite,
|
||||
.pathCreate = storageDriverRemotePathCreate, .pathRemove = storageDriverRemotePathRemove,
|
||||
.pathSync = storageDriverRemotePathSync, .remove = storageDriverRemoteRemove);
|
||||
STORAGE_REMOTE_TYPE_STR, NULL, modeFile, modePath, write, pathExpressionFunction, driver,
|
||||
.exists = storageRemoteExists, .info = storageRemoteInfo, .list = storageRemoteList,
|
||||
.newRead = storageRemoteNewRead, .newWrite = storageRemoteNewWrite,
|
||||
.pathCreate = storageRemotePathCreate, .pathRemove = storageRemotePathRemove,
|
||||
.pathSync = storageRemotePathSync, .remove = storageRemoteRemove);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
@ -1,22 +1,22 @@
|
||||
/***********************************************************************************************************************************
|
||||
Remote Storage Driver
|
||||
Remote Storage
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_REMOTE_STORAGE_H
|
||||
#define STORAGE_DRIVER_REMOTE_STORAGE_H
|
||||
#ifndef STORAGE_REMOTE_STORAGE_H
|
||||
#define STORAGE_REMOTE_STORAGE_H
|
||||
|
||||
#include "protocol/client.h"
|
||||
#include "storage/storage.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Driver type constant
|
||||
Storage type
|
||||
***********************************************************************************************************************************/
|
||||
#define STORAGE_DRIVER_REMOTE_TYPE "remote"
|
||||
STRING_DECLARE(STORAGE_DRIVER_REMOTE_TYPE_STR);
|
||||
#define STORAGE_REMOTE_TYPE "remote"
|
||||
STRING_DECLARE(STORAGE_REMOTE_TYPE_STR);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
Storage *storageDriverRemoteNew(
|
||||
Storage *storageRemoteNew(
|
||||
mode_t modeFile, mode_t modePath, bool write, StoragePathExpressionCallback pathExpressionFunction, ProtocolClient *client);
|
||||
|
||||
#endif
|
@ -1,22 +1,22 @@
|
||||
/***********************************************************************************************************************************
|
||||
Remote Storage Driver Internal
|
||||
Remote Storage Internal
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_REMOTE_STORAGE_INTERN_H
|
||||
#define STORAGE_DRIVER_REMOTE_STORAGE_INTERN_H
|
||||
#ifndef STORAGE_REMOTE_STORAGE_INTERN_H
|
||||
#define STORAGE_REMOTE_STORAGE_INTERN_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageDriverRemote StorageDriverRemote;
|
||||
typedef struct StorageRemote StorageRemote;
|
||||
|
||||
#include "storage/driver/remote/storage.h"
|
||||
#include "storage/remote/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_DRIVER_REMOTE_TYPE \
|
||||
StorageDriverRemote *
|
||||
#define FUNCTION_LOG_STORAGE_DRIVER_REMOTE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageDriverRemote", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_REMOTE_TYPE \
|
||||
StorageRemote *
|
||||
#define FUNCTION_LOG_STORAGE_REMOTE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageRemote", buffer, bufferSize)
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Remote Storage File Write Driver
|
||||
Remote Storage File write
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -8,39 +8,39 @@ Remote Storage File Write Driver
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/object.h"
|
||||
#include "storage/driver/remote/fileWrite.h"
|
||||
#include "storage/driver/remote/protocol.h"
|
||||
#include "storage/fileWrite.intern.h"
|
||||
#include "storage/remote/protocol.h"
|
||||
#include "storage/remote/write.h"
|
||||
#include "storage/write.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileWriteDriverRemote
|
||||
typedef struct StorageWriteRemote
|
||||
{
|
||||
MemContext *memContext; // Object mem context
|
||||
StorageFileWriteInterface interface; // Driver interface
|
||||
StorageDriverRemote *storage; // Storage that created this object
|
||||
StorageWriteInterface interface; // Interface
|
||||
StorageRemote *storage; // Storage that created this object
|
||||
ProtocolClient *client; // Protocol client to make requests with
|
||||
} StorageFileWriteDriverRemote;
|
||||
} StorageWriteRemote;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_DRIVER_REMOTE_TYPE \
|
||||
StorageFileWriteDriverRemote *
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_DRIVER_REMOTE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageFileWriteDriverRemote", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_REMOTE_TYPE \
|
||||
StorageWriteRemote *
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_REMOTE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageWriteRemote", buffer, bufferSize)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Close the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverRemoteClose(THIS_VOID)
|
||||
storageWriteRemoteClose(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileWriteDriverRemote);
|
||||
THIS(StorageWriteRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_REMOTE, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -62,10 +62,10 @@ storageFileWriteDriverRemoteClose(THIS_VOID)
|
||||
Free the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverRemoteFree(StorageFileWriteDriverRemote *this)
|
||||
storageWriteRemoteFree(StorageWriteRemote *this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_REMOTE, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
if (this != NULL)
|
||||
@ -92,12 +92,12 @@ storageFileWriteDriverRemoteFree(StorageFileWriteDriverRemote *this)
|
||||
Open the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverRemoteOpen(THIS_VOID)
|
||||
storageWriteRemoteOpen(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileWriteDriverRemote);
|
||||
THIS(StorageWriteRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_REMOTE, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -119,7 +119,7 @@ storageFileWriteDriverRemoteOpen(THIS_VOID)
|
||||
protocolClientExecute(this->client, command, false);
|
||||
|
||||
// Set free callback to ensure remote file is freed
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageFileWriteDriverRemoteFree, this);
|
||||
memContextCallback(this->memContext, (MemContextCallback)storageWriteRemoteFree, this);
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
@ -130,12 +130,12 @@ storageFileWriteDriverRemoteOpen(THIS_VOID)
|
||||
Write to the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverRemote(THIS_VOID, const Buffer *buffer)
|
||||
storageWriteRemote(THIS_VOID, const Buffer *buffer)
|
||||
{
|
||||
THIS(StorageFileWriteDriverRemote);
|
||||
THIS(StorageWriteRemote);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_REMOTE, this);
|
||||
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
@ -152,13 +152,13 @@ storageFileWriteDriverRemote(THIS_VOID, const Buffer *buffer)
|
||||
/***********************************************************************************************************************************
|
||||
Create a new file
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *
|
||||
storageFileWriteDriverRemoteNew(
|
||||
StorageDriverRemote *storage, ProtocolClient *client, const String *name, mode_t modeFile, mode_t modePath, const String *user,
|
||||
StorageWrite *
|
||||
storageWriteRemoteNew(
|
||||
StorageRemote *storage, ProtocolClient *client, const String *name, mode_t modeFile, mode_t modePath, const String *user,
|
||||
const String *group, time_t timeModified, bool createPath, bool syncFile, bool syncPath, bool atomic)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_REMOTE, storage);
|
||||
FUNCTION_LOG_PARAM(STORAGE_REMOTE, storage);
|
||||
FUNCTION_LOG_PARAM(STRING, name);
|
||||
FUNCTION_LOG_PARAM(MODE, modeFile);
|
||||
FUNCTION_LOG_PARAM(MODE, modePath);
|
||||
@ -177,16 +177,16 @@ storageFileWriteDriverRemoteNew(
|
||||
ASSERT(modeFile != 0);
|
||||
ASSERT(modePath != 0);
|
||||
|
||||
StorageFileWrite *this = NULL;
|
||||
StorageWrite *this = NULL;
|
||||
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageFileWriteDriverRemote")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageWriteRemote")
|
||||
{
|
||||
StorageFileWriteDriverRemote *driver = memNew(sizeof(StorageFileWriteDriverRemote));
|
||||
StorageWriteRemote *driver = memNew(sizeof(StorageWriteRemote));
|
||||
driver->memContext = MEM_CONTEXT_NEW();
|
||||
|
||||
driver->interface = (StorageFileWriteInterface)
|
||||
driver->interface = (StorageWriteInterface)
|
||||
{
|
||||
.type = STORAGE_DRIVER_REMOTE_TYPE_STR,
|
||||
.type = STORAGE_REMOTE_TYPE_STR,
|
||||
.name = strDup(name),
|
||||
.atomic = atomic,
|
||||
.createPath = createPath,
|
||||
@ -200,18 +200,18 @@ storageFileWriteDriverRemoteNew(
|
||||
|
||||
.ioInterface = (IoWriteInterface)
|
||||
{
|
||||
.close = storageFileWriteDriverRemoteClose,
|
||||
.open = storageFileWriteDriverRemoteOpen,
|
||||
.write = storageFileWriteDriverRemote,
|
||||
.close = storageWriteRemoteClose,
|
||||
.open = storageWriteRemoteOpen,
|
||||
.write = storageWriteRemote,
|
||||
},
|
||||
};
|
||||
|
||||
driver->storage = storage;
|
||||
driver->client = client;
|
||||
|
||||
this = storageFileWriteNew(driver, &driver->interface);
|
||||
this = storageWriteNew(driver, &driver->interface);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_LOG_RETURN(STORAGE_WRITE, this);
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
/***********************************************************************************************************************************
|
||||
Remote Storage File Write Driver
|
||||
Remote Storage File write
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_REMOTE_FILEWRITE_H
|
||||
#define STORAGE_DRIVER_REMOTE_FILEWRITE_H
|
||||
#ifndef STORAGE_REMOTE_WRITE_H
|
||||
#define STORAGE_REMOTE_WRITE_H
|
||||
|
||||
#include "protocol/client.h"
|
||||
#include "storage/driver/remote/storage.intern.h"
|
||||
#include "storage/fileWrite.h"
|
||||
#include "storage/remote/storage.intern.h"
|
||||
#include "storage/write.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *storageFileWriteDriverRemoteNew(
|
||||
StorageDriverRemote *storage, ProtocolClient *client, const String *name, mode_t modeFile, mode_t modePath, const String *user,
|
||||
StorageWrite *storageWriteRemoteNew(
|
||||
StorageRemote *storage, ProtocolClient *client, const String *name, mode_t modeFile, mode_t modePath, const String *user,
|
||||
const String *group, time_t timeModified, bool createPath, bool syncFile, bool syncPath, bool atomic);
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
S3 Storage File Read Driver
|
||||
S3 Storage Read
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -12,39 +12,39 @@ S3 Storage File Read Driver
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/object.h"
|
||||
#include "storage/driver/s3/fileRead.h"
|
||||
#include "storage/fileRead.intern.h"
|
||||
#include "storage/s3/read.h"
|
||||
#include "storage/read.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileReadDriverS3
|
||||
typedef struct StorageReadS3
|
||||
{
|
||||
MemContext *memContext; // Object mem context
|
||||
StorageFileReadInterface interface; // Driver interface
|
||||
StorageDriverS3 *storage; // Storage that created this object
|
||||
StorageReadInterface interface; // Interface
|
||||
StorageS3 *storage; // Storage that created this object
|
||||
|
||||
HttpClient *httpClient; // Http client for requests
|
||||
} StorageFileReadDriverS3;
|
||||
} StorageReadS3;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_DRIVER_S3_TYPE \
|
||||
StorageFileReadDriverS3 *
|
||||
#define FUNCTION_LOG_STORAGE_FILE_READ_DRIVER_S3_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageFileReadDriverS3", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_READ_S3_TYPE \
|
||||
StorageReadS3 *
|
||||
#define FUNCTION_LOG_STORAGE_READ_S3_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageReadS3", buffer, bufferSize)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Open the file
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageFileReadDriverS3Open(THIS_VOID)
|
||||
storageReadS3Open(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileReadDriverS3);
|
||||
THIS(StorageReadS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ_S3, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -53,10 +53,10 @@ storageFileReadDriverS3Open(THIS_VOID)
|
||||
bool result = false;
|
||||
|
||||
// Request the file
|
||||
storageDriverS3Request(this->storage, HTTP_VERB_GET_STR, this->interface.name, NULL, NULL, false, true);
|
||||
storageS3Request(this->storage, HTTP_VERB_GET_STR, this->interface.name, NULL, NULL, false, true);
|
||||
|
||||
// On success
|
||||
this->httpClient = storageDriverS3HttpClient(this->storage);
|
||||
this->httpClient = storageS3HttpClient(this->storage);
|
||||
|
||||
if (httpClientResponseCode(this->httpClient) == HTTP_RESPONSE_CODE_OK)
|
||||
result = true;
|
||||
@ -72,12 +72,12 @@ storageFileReadDriverS3Open(THIS_VOID)
|
||||
Read from a file
|
||||
***********************************************************************************************************************************/
|
||||
static size_t
|
||||
storageFileReadDriverS3(THIS_VOID, Buffer *buffer, bool block)
|
||||
storageReadS3(THIS_VOID, Buffer *buffer, bool block)
|
||||
{
|
||||
THIS(StorageFileReadDriverS3);
|
||||
THIS(StorageReadS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ_S3, this);
|
||||
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||
FUNCTION_LOG_PARAM(BOOL, block);
|
||||
FUNCTION_LOG_END();
|
||||
@ -92,12 +92,12 @@ storageFileReadDriverS3(THIS_VOID, Buffer *buffer, bool block)
|
||||
Has file reached EOF?
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageFileReadDriverS3Eof(THIS_VOID)
|
||||
storageReadS3Eof(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileReadDriverS3);
|
||||
THIS(StorageReadS3);
|
||||
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_READ_DRIVER_S3, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_READ_S3, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL && this->httpClient != NULL);
|
||||
@ -108,11 +108,11 @@ storageFileReadDriverS3Eof(THIS_VOID)
|
||||
/***********************************************************************************************************************************
|
||||
Create a new file
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *
|
||||
storageFileReadDriverS3New(StorageDriverS3 *storage, const String *name, bool ignoreMissing)
|
||||
StorageRead *
|
||||
storageReadS3New(StorageS3 *storage, const String *name, bool ignoreMissing)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, storage);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, storage);
|
||||
FUNCTION_LOG_PARAM(STRING, name);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_END();
|
||||
@ -120,32 +120,32 @@ storageFileReadDriverS3New(StorageDriverS3 *storage, const String *name, bool ig
|
||||
ASSERT(storage != NULL);
|
||||
ASSERT(name != NULL);
|
||||
|
||||
StorageFileRead *this = NULL;
|
||||
StorageRead *this = NULL;
|
||||
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageFileReadDriverS3")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageReadS3")
|
||||
{
|
||||
StorageFileReadDriverS3 *driver = memNew(sizeof(StorageFileReadDriverS3));
|
||||
StorageReadS3 *driver = memNew(sizeof(StorageReadS3));
|
||||
driver->memContext = MEM_CONTEXT_NEW();
|
||||
|
||||
driver->interface = (StorageFileReadInterface)
|
||||
driver->interface = (StorageReadInterface)
|
||||
{
|
||||
.type = STORAGE_DRIVER_S3_TYPE_STR,
|
||||
.type = STORAGE_S3_TYPE_STR,
|
||||
.name = strDup(name),
|
||||
.ignoreMissing = ignoreMissing,
|
||||
|
||||
.ioInterface = (IoReadInterface)
|
||||
{
|
||||
.eof = storageFileReadDriverS3Eof,
|
||||
.open = storageFileReadDriverS3Open,
|
||||
.read = storageFileReadDriverS3,
|
||||
.eof = storageReadS3Eof,
|
||||
.open = storageReadS3Open,
|
||||
.read = storageReadS3,
|
||||
},
|
||||
};
|
||||
|
||||
driver->storage = storage;
|
||||
|
||||
this = storageFileReadNew(driver, &driver->interface);
|
||||
this = storageReadNew(driver, &driver->interface);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_READ, this);
|
||||
FUNCTION_LOG_RETURN(STORAGE_READ, this);
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
/***********************************************************************************************************************************
|
||||
S3 Storage File Write Driver
|
||||
S3 Storage Read
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_S3_FILEWRITE_H
|
||||
#define STORAGE_DRIVER_S3_FILEWRITE_H
|
||||
#ifndef STORAGE_S3_READ_H
|
||||
#define STORAGE_S3_READ_H
|
||||
|
||||
#include "storage/fileWrite.h"
|
||||
#include "storage/driver/s3/storage.intern.h"
|
||||
#include "storage/s3/storage.intern.h"
|
||||
#include "storage/read.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *storageFileWriteDriverS3New(StorageDriverS3 *storage, const String *name, size_t partSize);
|
||||
StorageRead *storageReadS3New(StorageS3 *storage, const String *name, bool ignoreMissing);
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
S3 Storage Driver
|
||||
S3 Storage
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -15,14 +15,14 @@ S3 Storage Driver
|
||||
#include "common/object.h"
|
||||
#include "common/regExp.h"
|
||||
#include "common/type/xml.h"
|
||||
#include "storage/driver/s3/fileRead.h"
|
||||
#include "storage/driver/s3/fileWrite.h"
|
||||
#include "storage/driver/s3/storage.intern.h"
|
||||
#include "storage/s3/read.h"
|
||||
#include "storage/s3/storage.intern.h"
|
||||
#include "storage/s3/write.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Driver type constant string
|
||||
Storage type
|
||||
***********************************************************************************************************************************/
|
||||
STRING_EXTERN(STORAGE_DRIVER_S3_TYPE_STR, STORAGE_DRIVER_S3_TYPE);
|
||||
STRING_EXTERN(STORAGE_S3_TYPE_STR, STORAGE_S3_TYPE);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
S3 http headers
|
||||
@ -70,7 +70,7 @@ STRING_STATIC(YYYYMMDD_STR, "YYYYMMDD");
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
struct StorageDriverS3
|
||||
struct StorageS3
|
||||
{
|
||||
MemContext *memContext;
|
||||
HttpClient *httpClient; // Http client to service requests
|
||||
@ -99,7 +99,7 @@ Expected ISO-8601 data/time size
|
||||
Format ISO-8601 date/time for authentication
|
||||
***********************************************************************************************************************************/
|
||||
static String *
|
||||
storageDriverS3DateTime(time_t authTime)
|
||||
storageS3DateTime(time_t authTime)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(INT64, authTime);
|
||||
@ -120,12 +120,12 @@ Generate authorization header and add it to the supplied header list
|
||||
Based on the excellent documentation at http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html.
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverS3Auth(
|
||||
StorageDriverS3 *this, const String *verb, const String *uri, const HttpQuery *query, const String *dateTime,
|
||||
storageS3Auth(
|
||||
StorageS3 *this, const String *verb, const String *uri, const HttpQuery *query, const String *dateTime,
|
||||
HttpHeader *httpHeader, const String *payloadHash)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_TEST_PARAM(STRING, verb);
|
||||
FUNCTION_TEST_PARAM(STRING, uri);
|
||||
FUNCTION_TEST_PARAM(HTTP_QUERY, query);
|
||||
@ -219,13 +219,13 @@ storageDriverS3Auth(
|
||||
/***********************************************************************************************************************************
|
||||
Process S3 request
|
||||
***********************************************************************************************************************************/
|
||||
StorageDriverS3RequestResult
|
||||
storageDriverS3Request(
|
||||
StorageDriverS3 *this, const String *verb, const String *uri, const HttpQuery *query, const Buffer *body, bool returnContent,
|
||||
StorageS3RequestResult
|
||||
storageS3Request(
|
||||
StorageS3 *this, const String *verb, const String *uri, const HttpQuery *query, const Buffer *body, bool returnContent,
|
||||
bool allowMissing)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, verb);
|
||||
FUNCTION_LOG_PARAM(STRING, uri);
|
||||
FUNCTION_LOG_PARAM(HTTP_QUERY, query);
|
||||
@ -238,7 +238,7 @@ storageDriverS3Request(
|
||||
ASSERT(verb != NULL);
|
||||
ASSERT(uri != NULL);
|
||||
|
||||
StorageDriverS3RequestResult result = {0};
|
||||
StorageS3RequestResult result = {0};
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
@ -260,8 +260,8 @@ storageDriverS3Request(
|
||||
}
|
||||
|
||||
// Generate authorization header
|
||||
storageDriverS3Auth(
|
||||
this, verb, httpUriEncode(uri, true), query, storageDriverS3DateTime(time(NULL)), requestHeader,
|
||||
storageS3Auth(
|
||||
this, verb, httpUriEncode(uri, true), query, storageS3DateTime(time(NULL)), requestHeader,
|
||||
body == NULL || bufUsed(body) == 0 ?
|
||||
STRDEF("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") :
|
||||
bufHex(cryptoHashOne(HASH_TYPE_SHA256_STR, body)));
|
||||
@ -329,19 +329,19 @@ storageDriverS3Request(
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_DRIVER_S3_REQUEST_RESULT, result);
|
||||
FUNCTION_LOG_RETURN(STORAGE_S3_REQUEST_RESULT, result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Does a file exist? This function is only for files, not paths.
|
||||
***********************************************************************************************************************************/
|
||||
static bool
|
||||
storageDriverS3Exists(THIS_VOID, const String *path)
|
||||
storageS3Exists(THIS_VOID, const String *path)
|
||||
{
|
||||
THIS(StorageDriverS3);
|
||||
THIS(StorageS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
@ -362,7 +362,7 @@ storageDriverS3Exists(THIS_VOID, const String *path)
|
||||
httpQueryAdd(query, S3_QUERY_LIST_TYPE_STR, S3_QUERY_VALUE_LIST_TYPE_2_STR);
|
||||
|
||||
XmlNode *xmlRoot = xmlDocumentRoot(
|
||||
xmlDocumentNewBuf(storageDriverS3Request(this, HTTP_VERB_GET_STR, FSLASH_STR, query, NULL, true, false).response));
|
||||
xmlDocumentNewBuf(storageS3Request(this, HTTP_VERB_GET_STR, FSLASH_STR, query, NULL, true, false).response));
|
||||
|
||||
// Check if the prefix exists. If not then the file definitely does not exist, but if it does we'll need to check the
|
||||
// exact name to be sure we are not looking at a different file with the same prefix
|
||||
@ -387,12 +387,12 @@ storageDriverS3Exists(THIS_VOID, const String *path)
|
||||
File/path info
|
||||
***********************************************************************************************************************************/
|
||||
static StorageInfo
|
||||
storageDriverS3Info(THIS_VOID, const String *file, bool ignoreMissing, bool followLink)
|
||||
storageS3Info(THIS_VOID, const String *file, bool ignoreMissing, bool followLink)
|
||||
{
|
||||
THIS(StorageDriverS3);
|
||||
THIS(StorageS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_PARAM(BOOL, followLink);
|
||||
@ -411,12 +411,12 @@ storageDriverS3Info(THIS_VOID, const String *file, bool ignoreMissing, bool foll
|
||||
Get a list of files from a directory
|
||||
***********************************************************************************************************************************/
|
||||
static StringList *
|
||||
storageDriverS3List(THIS_VOID, const String *path, bool errorOnMissing, const String *expression)
|
||||
storageS3List(THIS_VOID, const String *path, bool errorOnMissing, const String *expression)
|
||||
{
|
||||
THIS(StorageDriverS3);
|
||||
THIS(StorageS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_PARAM(STRING, expression);
|
||||
@ -485,7 +485,7 @@ storageDriverS3List(THIS_VOID, const String *path, bool errorOnMissing, const St
|
||||
|
||||
XmlNode *xmlRoot = xmlDocumentRoot(
|
||||
xmlDocumentNewBuf(
|
||||
storageDriverS3Request(this, HTTP_VERB_GET_STR, FSLASH_STR, query, NULL, true, false).response));
|
||||
storageS3Request(this, HTTP_VERB_GET_STR, FSLASH_STR, query, NULL, true, false).response));
|
||||
|
||||
// Get subpath list
|
||||
XmlNodeList *subPathList = xmlNodeChildList(xmlRoot, S3_XML_TAG_COMMON_PREFIXES_STR);
|
||||
@ -539,13 +539,13 @@ storageDriverS3List(THIS_VOID, const String *path, bool errorOnMissing, const St
|
||||
/***********************************************************************************************************************************
|
||||
New file read object
|
||||
***********************************************************************************************************************************/
|
||||
static StorageFileRead *
|
||||
storageDriverS3NewRead(THIS_VOID, const String *file, bool ignoreMissing)
|
||||
static StorageRead *
|
||||
storageS3NewRead(THIS_VOID, const String *file, bool ignoreMissing)
|
||||
{
|
||||
THIS(StorageDriverS3);
|
||||
THIS(StorageS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_END();
|
||||
@ -553,21 +553,21 @@ storageDriverS3NewRead(THIS_VOID, const String *file, bool ignoreMissing)
|
||||
ASSERT(this != NULL);
|
||||
ASSERT(file != NULL);
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_READ, storageFileReadDriverS3New(this, file, ignoreMissing));
|
||||
FUNCTION_LOG_RETURN(STORAGE_READ, storageReadS3New(this, file, ignoreMissing));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
New file write object
|
||||
***********************************************************************************************************************************/
|
||||
static StorageFileWrite *
|
||||
storageDriverS3NewWrite(
|
||||
THIS_VOID, const String *file, mode_t modeFile, mode_t modePath, const String *user, const String *group,
|
||||
time_t timeModified, bool createPath, bool syncFile, bool syncPath, bool atomic)
|
||||
static StorageWrite *
|
||||
storageS3NewWrite(
|
||||
THIS_VOID, const String *file, mode_t modeFile, mode_t modePath, const String *user, const String *group, time_t timeModified,
|
||||
bool createPath, bool syncFile, bool syncPath, bool atomic)
|
||||
{
|
||||
THIS(StorageDriverS3);
|
||||
THIS(StorageS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(MODE, modeFile);
|
||||
FUNCTION_LOG_PARAM(MODE, modePath);
|
||||
@ -587,7 +587,7 @@ storageDriverS3NewWrite(
|
||||
ASSERT(group == NULL);
|
||||
ASSERT(timeModified == 0);
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_WRITE, storageFileWriteDriverS3New(this, file, this->partSize));
|
||||
FUNCTION_LOG_RETURN(STORAGE_WRITE, storageWriteS3New(this, file, this->partSize));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -596,12 +596,12 @@ Create a path
|
||||
There are no physical paths on S3 so just return success.
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverS3PathCreate(THIS_VOID, const String *path, bool errorOnExists, bool noParentCreate, mode_t mode)
|
||||
storageS3PathCreate(THIS_VOID, const String *path, bool errorOnExists, bool noParentCreate, mode_t mode)
|
||||
{
|
||||
THIS(StorageDriverS3);
|
||||
THIS(StorageS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnExists);
|
||||
FUNCTION_LOG_PARAM(BOOL, noParentCreate);
|
||||
@ -619,12 +619,12 @@ storageDriverS3PathCreate(THIS_VOID, const String *path, bool errorOnExists, boo
|
||||
Remove a path
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverS3PathRemove(THIS_VOID, const String *path, bool errorOnMissing, bool recurse)
|
||||
storageS3PathRemove(THIS_VOID, const String *path, bool errorOnMissing, bool recurse)
|
||||
{
|
||||
THIS(StorageDriverS3);
|
||||
THIS(StorageS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_PARAM(BOOL, recurse);
|
||||
@ -644,12 +644,12 @@ Sync a path
|
||||
There's no need for this on S3 so just return success.
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverS3PathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
storageS3PathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
{
|
||||
THIS(StorageDriverS3);
|
||||
THIS(StorageS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, path);
|
||||
FUNCTION_LOG_PARAM(BOOL, ignoreMissing);
|
||||
FUNCTION_LOG_END();
|
||||
@ -664,12 +664,12 @@ storageDriverS3PathSync(THIS_VOID, const String *path, bool ignoreMissing)
|
||||
Remove a file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageDriverS3Remove(THIS_VOID, const String *file, bool errorOnMissing)
|
||||
storageS3Remove(THIS_VOID, const String *file, bool errorOnMissing)
|
||||
{
|
||||
THIS(StorageDriverS3);
|
||||
THIS(StorageS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_LOG_PARAM(STRING, file);
|
||||
FUNCTION_LOG_PARAM(BOOL, errorOnMissing);
|
||||
FUNCTION_LOG_END();
|
||||
@ -686,10 +686,10 @@ storageDriverS3Remove(THIS_VOID, const String *file, bool errorOnMissing)
|
||||
Get http client
|
||||
***********************************************************************************************************************************/
|
||||
HttpClient *
|
||||
storageDriverS3HttpClient(const StorageDriverS3 *this)
|
||||
storageS3HttpClient(const StorageS3 *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -701,7 +701,7 @@ storageDriverS3HttpClient(const StorageDriverS3 *this)
|
||||
New object
|
||||
***********************************************************************************************************************************/
|
||||
Storage *
|
||||
storageDriverS3New(
|
||||
storageS3New(
|
||||
const String *path, bool write, StoragePathExpressionCallback pathExpressionFunction, const String *bucket,
|
||||
const String *endPoint, const String *region, const String *accessKey, const String *secretAccessKey,
|
||||
const String *securityToken, size_t partSize, const String *host, unsigned int port, TimeMSec timeout, bool verifyPeer,
|
||||
@ -735,9 +735,9 @@ storageDriverS3New(
|
||||
|
||||
Storage *this = NULL;
|
||||
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageDriverS3")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageS3")
|
||||
{
|
||||
StorageDriverS3 *driver = memNew(sizeof(StorageDriverS3));
|
||||
StorageS3 *driver = memNew(sizeof(StorageS3));
|
||||
driver->memContext = MEM_CONTEXT_NEW();
|
||||
|
||||
driver->bucket = strDup(bucket);
|
||||
@ -757,10 +757,10 @@ storageDriverS3New(
|
||||
driver->headerRedactList = strLstAdd(strLstNew(), S3_HEADER_AUTHORIZATION_STR);
|
||||
|
||||
this = storageNewP(
|
||||
STORAGE_DRIVER_S3_TYPE_STR, path, 0, 0, write, pathExpressionFunction, driver,
|
||||
.exists = storageDriverS3Exists, .info = storageDriverS3Info, .list = storageDriverS3List,
|
||||
.newRead = storageDriverS3NewRead, .newWrite = storageDriverS3NewWrite, .pathCreate = storageDriverS3PathCreate,
|
||||
.pathRemove = storageDriverS3PathRemove, .pathSync = storageDriverS3PathSync, .remove = storageDriverS3Remove);
|
||||
STORAGE_S3_TYPE_STR, path, 0, 0, write, pathExpressionFunction, driver,
|
||||
.exists = storageS3Exists, .info = storageS3Info, .list = storageS3List,
|
||||
.newRead = storageS3NewRead, .newWrite = storageS3NewWrite, .pathCreate = storageS3PathCreate,
|
||||
.pathRemove = storageS3PathRemove, .pathSync = storageS3PathSync, .remove = storageS3Remove);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
@ -1,28 +1,28 @@
|
||||
/***********************************************************************************************************************************
|
||||
S3 Storage Driver
|
||||
S3 Storage
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_S3_STORAGE_H
|
||||
#define STORAGE_DRIVER_S3_STORAGE_H
|
||||
#ifndef STORAGE_S3_STORAGE_H
|
||||
#define STORAGE_S3_STORAGE_H
|
||||
|
||||
#include "storage/storage.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Driver type constant
|
||||
Storage type
|
||||
***********************************************************************************************************************************/
|
||||
#define STORAGE_DRIVER_S3_TYPE "s3"
|
||||
STRING_DECLARE(STORAGE_DRIVER_S3_TYPE_STR);
|
||||
#define STORAGE_S3_TYPE "s3"
|
||||
STRING_DECLARE(STORAGE_S3_TYPE_STR);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Defaults
|
||||
***********************************************************************************************************************************/
|
||||
#define STORAGE_DRIVER_S3_PORT_DEFAULT 443
|
||||
#define STORAGE_DRIVER_S3_TIMEOUT_DEFAULT 60000
|
||||
#define STORAGE_DRIVER_S3_PARTSIZE_MIN ((size_t)5 * 1024 * 1024)
|
||||
#define STORAGE_S3_PORT_DEFAULT 443
|
||||
#define STORAGE_S3_TIMEOUT_DEFAULT 60000
|
||||
#define STORAGE_S3_PARTSIZE_MIN ((size_t)5 * 1024 * 1024)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
Storage *storageDriverS3New(
|
||||
Storage *storageS3New(
|
||||
const String *path, bool write, StoragePathExpressionCallback pathExpressionFunction, const String *bucket,
|
||||
const String *endPoint, const String *region, const String *accessKey, const String *secretAccessKey,
|
||||
const String *securityToken, size_t partSize, const String *host, unsigned int port, TimeMSec timeout, bool verifyPeer,
|
@ -1,46 +1,46 @@
|
||||
/***********************************************************************************************************************************
|
||||
S3 Storage Driver Internal
|
||||
S3 Storage Internal
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_S3_STORAGE_INTERN_H
|
||||
#define STORAGE_DRIVER_S3_STORAGE_INTERN_H
|
||||
#ifndef STORAGE_S3_STORAGE_INTERN_H
|
||||
#define STORAGE_S3_STORAGE_INTERN_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageDriverS3 StorageDriverS3;
|
||||
typedef struct StorageS3 StorageS3;
|
||||
|
||||
#include "common/io/http/client.h"
|
||||
#include "storage/driver/s3/storage.h"
|
||||
#include "storage/s3/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Perform an S3 Request
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_DRIVER_S3_REQUEST_RESULT_TYPE \
|
||||
StorageDriverS3RequestResult
|
||||
#define FUNCTION_LOG_STORAGE_DRIVER_S3_REQUEST_RESULT_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(&value, "StorageDriverS3RequestResult", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_S3_REQUEST_RESULT_TYPE \
|
||||
StorageS3RequestResult
|
||||
#define FUNCTION_LOG_STORAGE_S3_REQUEST_RESULT_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(&value, "StorageS3RequestResult", buffer, bufferSize)
|
||||
|
||||
typedef struct StorageDriverS3RequestResult
|
||||
typedef struct StorageS3RequestResult
|
||||
{
|
||||
HttpHeader *responseHeader;
|
||||
Buffer *response;
|
||||
} StorageDriverS3RequestResult;
|
||||
} StorageS3RequestResult;
|
||||
|
||||
StorageDriverS3RequestResult storageDriverS3Request(
|
||||
StorageDriverS3 *this, const String *verb, const String *uri, const HttpQuery *query, const Buffer *body, bool returnContent,
|
||||
StorageS3RequestResult storageS3Request(
|
||||
StorageS3 *this, const String *verb, const String *uri, const HttpQuery *query, const Buffer *body, bool returnContent,
|
||||
bool allowMissing);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Getters
|
||||
***********************************************************************************************************************************/
|
||||
HttpClient *storageDriverS3HttpClient(const StorageDriverS3 *this);
|
||||
HttpClient *storageS3HttpClient(const StorageS3 *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_DRIVER_S3_TYPE \
|
||||
StorageDriverS3 *
|
||||
#define FUNCTION_LOG_STORAGE_DRIVER_S3_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageDriverS3", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_S3_TYPE \
|
||||
StorageS3 *
|
||||
#define FUNCTION_LOG_STORAGE_S3_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageS3", buffer, bufferSize)
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
S3 Storage File Write Driver
|
||||
S3 Storage File write
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
@ -9,8 +9,8 @@ S3 Storage File Write Driver
|
||||
#include "common/memContext.h"
|
||||
#include "common/object.h"
|
||||
#include "common/type/xml.h"
|
||||
#include "storage/driver/s3/fileWrite.h"
|
||||
#include "storage/fileWrite.intern.h"
|
||||
#include "storage/s3/write.h"
|
||||
#include "storage/write.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
S3 query tokens
|
||||
@ -31,36 +31,36 @@ STRING_STATIC(S3_XML_TAG_PART_NUMBER_STR, "PartNumber"
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileWriteDriverS3
|
||||
typedef struct StorageWriteS3
|
||||
{
|
||||
MemContext *memContext; // Object mem context
|
||||
StorageFileWriteInterface interface; // Driver interface
|
||||
StorageDriverS3 *storage; // Storage that created this object
|
||||
StorageWriteInterface interface; // Interface
|
||||
StorageS3 *storage; // Storage that created this object
|
||||
|
||||
size_t partSize;
|
||||
Buffer *partBuffer;
|
||||
const String *uploadId;
|
||||
StringList *uploadPartList;
|
||||
} StorageFileWriteDriverS3;
|
||||
} StorageWriteS3;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_DRIVER_S3_TYPE \
|
||||
StorageFileWriteDriverS3 *
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_DRIVER_S3_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageFileWriteDriverS3", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_S3_TYPE \
|
||||
StorageWriteS3 *
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_S3_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(value, "StorageWriteS3", buffer, bufferSize)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Open the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverS3Open(THIS_VOID)
|
||||
storageWriteS3Open(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileWriteDriverS3);
|
||||
THIS(StorageWriteS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_S3, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -80,10 +80,10 @@ storageFileWriteDriverS3Open(THIS_VOID)
|
||||
Flush bytes to upload part
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverS3Part(StorageFileWriteDriverS3 *this)
|
||||
storageWriteS3Part(StorageWriteS3 *this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_S3, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -98,7 +98,7 @@ storageFileWriteDriverS3Part(StorageFileWriteDriverS3 *this)
|
||||
// Initiate mult-part upload
|
||||
XmlNode *xmlRoot = xmlDocumentRoot(
|
||||
xmlDocumentNewBuf(
|
||||
storageDriverS3Request(
|
||||
storageS3Request(
|
||||
this->storage, HTTP_VERB_POST_STR, this->interface.name,
|
||||
httpQueryAdd(httpQueryNew(), S3_QUERY_UPLOADS_STR, EMPTY_STR), NULL, true, false).response));
|
||||
|
||||
@ -119,7 +119,7 @@ storageFileWriteDriverS3Part(StorageFileWriteDriverS3 *this)
|
||||
strLstAdd(
|
||||
this->uploadPartList,
|
||||
httpHeaderGet(
|
||||
storageDriverS3Request(
|
||||
storageS3Request(
|
||||
this->storage, HTTP_VERB_PUT_STR, this->interface.name, query, this->partBuffer, true, false).responseHeader,
|
||||
HTTP_HEADER_ETAG_STR));
|
||||
|
||||
@ -134,12 +134,12 @@ storageFileWriteDriverS3Part(StorageFileWriteDriverS3 *this)
|
||||
Write to internal buffer
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverS3(THIS_VOID, const Buffer *buffer)
|
||||
storageWriteS3(THIS_VOID, const Buffer *buffer)
|
||||
{
|
||||
THIS(StorageFileWriteDriverS3);
|
||||
THIS(StorageWriteS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_S3, this);
|
||||
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
@ -160,7 +160,7 @@ storageFileWriteDriverS3(THIS_VOID, const Buffer *buffer)
|
||||
// If the part buffer is full then write it
|
||||
if (bufRemains(this->partBuffer) == 0)
|
||||
{
|
||||
storageFileWriteDriverS3Part(this);
|
||||
storageWriteS3Part(this);
|
||||
bufUsedZero(this->partBuffer);
|
||||
}
|
||||
}
|
||||
@ -173,12 +173,12 @@ storageFileWriteDriverS3(THIS_VOID, const Buffer *buffer)
|
||||
Close the file
|
||||
***********************************************************************************************************************************/
|
||||
static void
|
||||
storageFileWriteDriverS3Close(THIS_VOID)
|
||||
storageWriteS3Close(THIS_VOID)
|
||||
{
|
||||
THIS(StorageFileWriteDriverS3);
|
||||
THIS(StorageWriteS3);
|
||||
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE_DRIVER_S3, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE_S3, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -193,7 +193,7 @@ storageFileWriteDriverS3Close(THIS_VOID)
|
||||
{
|
||||
// If there is anything left in the part buffer then write it
|
||||
if (bufUsed(this->partBuffer) > 0)
|
||||
storageFileWriteDriverS3Part(this);
|
||||
storageWriteS3Part(this);
|
||||
|
||||
// Generate the xml part list
|
||||
XmlDocument *partList = xmlDocumentNew(S3_XML_TAG_COMPLETE_MULTIPART_UPLOAD_STR);
|
||||
@ -206,14 +206,14 @@ storageFileWriteDriverS3Close(THIS_VOID)
|
||||
}
|
||||
|
||||
// Finalize the multi-part upload
|
||||
storageDriverS3Request(
|
||||
storageS3Request(
|
||||
this->storage, HTTP_VERB_POST_STR, this->interface.name,
|
||||
httpQueryAdd(httpQueryNew(), S3_QUERY_UPLOAD_ID_STR, this->uploadId), xmlDocumentBuf(partList), false, false);
|
||||
}
|
||||
// Else upload all the data in a single put
|
||||
else
|
||||
{
|
||||
storageDriverS3Request(
|
||||
storageS3Request(
|
||||
this->storage, HTTP_VERB_PUT_STR, this->interface.name, NULL, this->partBuffer, false, false);
|
||||
}
|
||||
|
||||
@ -229,27 +229,27 @@ storageFileWriteDriverS3Close(THIS_VOID)
|
||||
/***********************************************************************************************************************************
|
||||
New object
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *
|
||||
storageFileWriteDriverS3New(StorageDriverS3 *storage, const String *name, size_t partSize)
|
||||
StorageWrite *
|
||||
storageWriteS3New(StorageS3 *storage, const String *name, size_t partSize)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_DRIVER_S3, storage);
|
||||
FUNCTION_LOG_PARAM(STORAGE_S3, storage);
|
||||
FUNCTION_LOG_PARAM(STRING, name);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(storage != NULL);
|
||||
ASSERT(name != NULL);
|
||||
|
||||
StorageFileWrite *this = NULL;
|
||||
StorageWrite *this = NULL;
|
||||
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageFileWriteDriverS3")
|
||||
MEM_CONTEXT_NEW_BEGIN("StorageWriteS3")
|
||||
{
|
||||
StorageFileWriteDriverS3 *driver = memNew(sizeof(StorageFileWriteDriverS3));
|
||||
StorageWriteS3 *driver = memNew(sizeof(StorageWriteS3));
|
||||
driver->memContext = MEM_CONTEXT_NEW();
|
||||
|
||||
driver->interface = (StorageFileWriteInterface)
|
||||
driver->interface = (StorageWriteInterface)
|
||||
{
|
||||
.type = STORAGE_DRIVER_S3_TYPE_STR,
|
||||
.type = STORAGE_S3_TYPE_STR,
|
||||
.name = strDup(name),
|
||||
.atomic = true,
|
||||
.createPath = true,
|
||||
@ -258,18 +258,18 @@ storageFileWriteDriverS3New(StorageDriverS3 *storage, const String *name, size_t
|
||||
|
||||
.ioInterface = (IoWriteInterface)
|
||||
{
|
||||
.close = storageFileWriteDriverS3Close,
|
||||
.open = storageFileWriteDriverS3Open,
|
||||
.write = storageFileWriteDriverS3,
|
||||
.close = storageWriteS3Close,
|
||||
.open = storageWriteS3Open,
|
||||
.write = storageWriteS3,
|
||||
},
|
||||
};
|
||||
|
||||
driver->storage = storage;
|
||||
driver->partSize = partSize;
|
||||
|
||||
this = storageFileWriteNew(driver, &driver->interface);
|
||||
this = storageWriteNew(driver, &driver->interface);
|
||||
}
|
||||
MEM_CONTEXT_NEW_END();
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_LOG_RETURN(STORAGE_WRITE, this);
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
/***********************************************************************************************************************************
|
||||
Posix Storage File Read Driver
|
||||
S3 Storage File write
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_DRIVER_POSIX_FILEREAD_H
|
||||
#define STORAGE_DRIVER_POSIX_FILEREAD_H
|
||||
#ifndef STORAGE_S3_WRITE_H
|
||||
#define STORAGE_S3_WRITE_H
|
||||
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/fileRead.h"
|
||||
#include "storage/s3/storage.intern.h"
|
||||
#include "storage/write.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *storageFileReadDriverPosixNew(StorageDriverPosix *storage, const String *name, bool ignoreMissing);
|
||||
StorageWrite *storageWriteS3New(StorageS3 *storage, const String *name, size_t partSize);
|
||||
|
||||
#endif
|
@ -83,11 +83,11 @@ storageNew(
|
||||
Copy a file
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageCopy(StorageFileRead *source, StorageFileWrite *destination)
|
||||
storageCopy(StorageRead *source, StorageWrite *destination)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ, source);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE, destination);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ, source);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE, destination);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(source != NULL);
|
||||
@ -98,25 +98,25 @@ storageCopy(StorageFileRead *source, StorageFileWrite *destination)
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Open source file
|
||||
if (ioReadOpen(storageFileReadIo(source)))
|
||||
if (ioReadOpen(storageReadIo(source)))
|
||||
{
|
||||
// Open the destination file now that we know the source file exists and is readable
|
||||
ioWriteOpen(storageFileWriteIo(destination));
|
||||
ioWriteOpen(storageWriteIo(destination));
|
||||
|
||||
// Copy data from source to destination
|
||||
Buffer *read = bufNew(ioBufferSize());
|
||||
|
||||
do
|
||||
{
|
||||
ioRead(storageFileReadIo(source), read);
|
||||
ioWrite(storageFileWriteIo(destination), read);
|
||||
ioRead(storageReadIo(source), read);
|
||||
ioWrite(storageWriteIo(destination), read);
|
||||
bufUsedZero(read);
|
||||
}
|
||||
while (!ioReadEof(storageFileReadIo(source)));
|
||||
while (!ioReadEof(storageReadIo(source)));
|
||||
|
||||
// Close the source and destination files
|
||||
ioReadClose(storageFileReadIo(source));
|
||||
ioWriteClose(storageFileWriteIo(destination));
|
||||
ioReadClose(storageReadIo(source));
|
||||
ioWriteClose(storageWriteIo(destination));
|
||||
|
||||
// Set result to indicate that the file was copied
|
||||
result = true;
|
||||
@ -168,10 +168,10 @@ storageExists(const Storage *this, const String *pathExp, StorageExistsParam par
|
||||
Read from storage into a buffer
|
||||
***********************************************************************************************************************************/
|
||||
Buffer *
|
||||
storageGet(StorageFileRead *file, StorageGetParam param)
|
||||
storageGet(StorageRead *file, StorageGetParam param)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ, file);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ, file);
|
||||
FUNCTION_LOG_PARAM(SIZE, param.exactSize);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
@ -180,7 +180,7 @@ storageGet(StorageFileRead *file, StorageGetParam param)
|
||||
Buffer *result = NULL;
|
||||
|
||||
// If the file exists
|
||||
if (ioReadOpen(storageFileReadIo(file)))
|
||||
if (ioReadOpen(storageReadIo(file)))
|
||||
{
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
@ -188,13 +188,13 @@ storageGet(StorageFileRead *file, StorageGetParam param)
|
||||
if (param.exactSize > 0)
|
||||
{
|
||||
result = bufNew(param.exactSize);
|
||||
ioRead(storageFileReadIo(file), result);
|
||||
ioRead(storageReadIo(file), result);
|
||||
|
||||
// If an exact read make sure the size is as expected
|
||||
if (bufUsed(result) != param.exactSize)
|
||||
{
|
||||
THROW_FMT(
|
||||
FileReadError, "unable to read %zu byte(s) from '%s'", param.exactSize, strPtr(storageFileReadName(file)));
|
||||
FileReadError, "unable to read %zu byte(s) from '%s'", param.exactSize, strPtr(storageReadName(file)));
|
||||
}
|
||||
}
|
||||
// Else read entire file
|
||||
@ -206,13 +206,13 @@ storageGet(StorageFileRead *file, StorageGetParam param)
|
||||
do
|
||||
{
|
||||
// Read data
|
||||
ioRead(storageFileReadIo(file), read);
|
||||
ioRead(storageReadIo(file), read);
|
||||
|
||||
// Add to result and free read buffer
|
||||
bufCat(result, read);
|
||||
bufUsedZero(read);
|
||||
}
|
||||
while (!ioReadEof(storageFileReadIo(file)));
|
||||
while (!ioReadEof(storageReadIo(file)));
|
||||
}
|
||||
|
||||
// Move buffer to parent context on success
|
||||
@ -220,7 +220,7 @@ storageGet(StorageFileRead *file, StorageGetParam param)
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
ioReadClose(storageFileReadIo(file));
|
||||
ioReadClose(storageReadIo(file));
|
||||
}
|
||||
|
||||
FUNCTION_LOG_RETURN(BUFFER, result);
|
||||
@ -331,19 +331,19 @@ storageList(const Storage *this, const String *pathExp, StorageListParam param)
|
||||
Move a file
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageMove(const Storage *this, StorageFileRead *source, StorageFileWrite *destination)
|
||||
storageMove(const Storage *this, StorageRead *source, StorageWrite *destination)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_READ, source);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE, destination);
|
||||
FUNCTION_LOG_PARAM(STORAGE_READ, source);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE, destination);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(this->interface.move != NULL);
|
||||
ASSERT(source != NULL);
|
||||
ASSERT(destination != NULL);
|
||||
ASSERT(!storageFileReadIgnoreMissing(source));
|
||||
ASSERT(strEq(this->type, storageFileReadType(source)));
|
||||
ASSERT(strEq(storageFileReadType(source), storageFileWriteType(destination)));
|
||||
ASSERT(!storageReadIgnoreMissing(source));
|
||||
ASSERT(strEq(this->type, storageReadType(source)));
|
||||
ASSERT(strEq(storageReadType(source), storageWriteType(destination)));
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
@ -354,13 +354,13 @@ storageMove(const Storage *this, StorageFileRead *source, StorageFileWrite *dest
|
||||
storageCopyNP(source, destination);
|
||||
|
||||
// Remove the source file
|
||||
this->interface.remove(this->driver, storageFileReadName(source), false);
|
||||
this->interface.remove(this->driver, storageReadName(source), false);
|
||||
|
||||
// Sync source path if the destination path was synced. We know the source and destination paths are different because
|
||||
// the move did not succeed. This will need updating when drivers other than Posix/CIFS are implemented becaue there's
|
||||
// no way to get coverage on it now.
|
||||
if (storageFileWriteSyncPath(destination))
|
||||
this->interface.pathSync(this->driver, strPath(storageFileReadName(source)), false);
|
||||
if (storageWriteSyncPath(destination))
|
||||
this->interface.pathSync(this->driver, strPath(storageReadName(source)), false);
|
||||
}
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
@ -371,7 +371,7 @@ storageMove(const Storage *this, StorageFileRead *source, StorageFileWrite *dest
|
||||
/***********************************************************************************************************************************
|
||||
Open a file for reading
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileRead *
|
||||
StorageRead *
|
||||
storageNewRead(const Storage *this, const String *fileExp, StorageNewReadParam param)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
@ -383,26 +383,26 @@ storageNewRead(const Storage *this, const String *fileExp, StorageNewReadParam p
|
||||
|
||||
ASSERT(this != NULL);
|
||||
|
||||
StorageFileRead *result = NULL;
|
||||
StorageRead *result = NULL;
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
result = this->interface.newRead(this->driver, storagePathNP(this, fileExp), param.ignoreMissing);
|
||||
|
||||
if (param.filterGroup != NULL)
|
||||
ioReadFilterGroupSet(storageFileReadIo(result), param.filterGroup);
|
||||
ioReadFilterGroupSet(storageReadIo(result), param.filterGroup);
|
||||
|
||||
storageFileReadMove(result, MEM_CONTEXT_OLD());
|
||||
storageReadMove(result, MEM_CONTEXT_OLD());
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_READ, result);
|
||||
FUNCTION_LOG_RETURN(STORAGE_READ, result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Open a file for writing
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *
|
||||
StorageWrite *
|
||||
storageNewWrite(const Storage *this, const String *fileExp, StorageNewWriteParam param)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
@ -423,7 +423,7 @@ storageNewWrite(const Storage *this, const String *fileExp, StorageNewWriteParam
|
||||
ASSERT(this != NULL);
|
||||
ASSERT(this->write);
|
||||
|
||||
StorageFileWrite *result = NULL;
|
||||
StorageWrite *result = NULL;
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
@ -433,13 +433,13 @@ storageNewWrite(const Storage *this, const String *fileExp, StorageNewWriteParam
|
||||
!param.noSyncFile, !param.noSyncPath, !param.noAtomic);
|
||||
|
||||
if (param.filterGroup != NULL)
|
||||
ioWriteFilterGroupSet(storageFileWriteIo(result), param.filterGroup);
|
||||
ioWriteFilterGroupSet(storageWriteIo(result), param.filterGroup);
|
||||
|
||||
storageFileWriteMove(result, MEM_CONTEXT_OLD());
|
||||
storageWriteMove(result, MEM_CONTEXT_OLD());
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_WRITE, result);
|
||||
FUNCTION_LOG_RETURN(STORAGE_WRITE, result);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -640,18 +640,18 @@ void storagePathSync(const Storage *this, const String *pathExp, StoragePathSync
|
||||
Write a buffer to storage
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storagePut(StorageFileWrite *file, const Buffer *buffer)
|
||||
storagePut(StorageWrite *file, const Buffer *buffer)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE, file);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE, file);
|
||||
FUNCTION_LOG_PARAM(BUFFER, buffer);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(file != NULL);
|
||||
|
||||
ioWriteOpen(storageFileWriteIo(file));
|
||||
ioWrite(storageFileWriteIo(file), buffer);
|
||||
ioWriteClose(storageFileWriteIo(file));
|
||||
ioWriteOpen(storageWriteIo(file));
|
||||
ioWrite(storageWriteIo(file), buffer);
|
||||
ioWriteClose(storageWriteIo(file));
|
||||
|
||||
FUNCTION_LOG_RETURN_VOID();
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ typedef struct Storage Storage;
|
||||
#include "common/type/stringList.h"
|
||||
#include "common/io/filter/group.h"
|
||||
#include "common/time.h"
|
||||
#include "storage/fileRead.h"
|
||||
#include "storage/fileWrite.h"
|
||||
#include "storage/info.h"
|
||||
#include "storage/read.h"
|
||||
#include "storage/write.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
storageCopy
|
||||
@ -25,7 +25,7 @@ storageCopy
|
||||
#define storageCopyNP(source, destination) \
|
||||
storageCopy(source, destination)
|
||||
|
||||
bool storageCopy(StorageFileRead *source, StorageFileWrite *destination);
|
||||
bool storageCopy(StorageRead *source, StorageWrite *destination);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
storageExists
|
||||
@ -55,7 +55,7 @@ typedef struct StorageGetParam
|
||||
#define storageGetNP(file) \
|
||||
storageGet(file, (StorageGetParam){0})
|
||||
|
||||
Buffer *storageGet(StorageFileRead *file, StorageGetParam param);
|
||||
Buffer *storageGet(StorageRead *file, StorageGetParam param);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
storageInfo
|
||||
@ -113,7 +113,7 @@ storageMove
|
||||
#define storageMoveNP(this, source, destination) \
|
||||
storageMove(this, source, destination)
|
||||
|
||||
void storageMove(const Storage *this, StorageFileRead *source, StorageFileWrite *destination);
|
||||
void storageMove(const Storage *this, StorageRead *source, StorageWrite *destination);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
storageNewRead
|
||||
@ -129,7 +129,7 @@ typedef struct StorageNewReadParam
|
||||
#define storageNewReadNP(this, pathExp) \
|
||||
storageNewRead(this, pathExp, (StorageNewReadParam){0})
|
||||
|
||||
StorageFileRead *storageNewRead(const Storage *this, const String *fileExp, StorageNewReadParam param);
|
||||
StorageRead *storageNewRead(const Storage *this, const String *fileExp, StorageNewReadParam param);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
storageNewWrite
|
||||
@ -153,7 +153,7 @@ typedef struct StorageNewWriteParam
|
||||
#define storageNewWriteNP(this, pathExp) \
|
||||
storageNewWrite(this, pathExp, (StorageNewWriteParam){0})
|
||||
|
||||
StorageFileWrite *storageNewWrite(const Storage *this, const String *fileExp, StorageNewWriteParam param);
|
||||
StorageWrite *storageNewWrite(const Storage *this, const String *fileExp, StorageNewWriteParam param);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
storagePath
|
||||
@ -217,7 +217,7 @@ storagePut
|
||||
#define storagePutNP(file, buffer) \
|
||||
storagePut(file, buffer)
|
||||
|
||||
void storagePut(StorageFileWrite *file, const Buffer *buffer);
|
||||
void storagePut(StorageWrite *file, const Buffer *buffer);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
storageRemove
|
||||
|
@ -4,9 +4,9 @@ Storage Interface Internal
|
||||
#ifndef STORAGE_STORAGE_INTERN_H
|
||||
#define STORAGE_STORAGE_INTERN_H
|
||||
|
||||
#include "storage/fileRead.intern.h"
|
||||
#include "storage/fileWrite.intern.h"
|
||||
#include "storage/read.intern.h"
|
||||
#include "storage/storage.h"
|
||||
#include "storage/write.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Default file and path modes
|
||||
@ -28,9 +28,9 @@ typedef struct StorageInterface
|
||||
StorageInfo (*info)(void *driver, const String *path, bool ignoreMissing, bool followLink);
|
||||
bool (*infoList)(void *driver, const String *file, bool ignoreMissing, StorageInfoListCallback callback, void *callbackData);
|
||||
StringList *(*list)(void *driver, const String *path, bool errorOnMissing, const String *expression);
|
||||
bool (*move)(void *driver, StorageFileRead *source, StorageFileWrite *destination);
|
||||
StorageFileRead *(*newRead)(void *driver, const String *file, bool ignoreMissing);
|
||||
StorageFileWrite *(*newWrite)(
|
||||
bool (*move)(void *driver, StorageRead *source, StorageWrite *destination);
|
||||
StorageRead *(*newRead)(void *driver, const String *file, bool ignoreMissing);
|
||||
StorageWrite *(*newWrite)(
|
||||
void *driver, const String *file, mode_t modeFile, mode_t modePath, const String *user, const String *group,
|
||||
time_t timeModified, bool createPath, bool syncFile, bool syncPath, bool atomic);
|
||||
void (*pathCreate)(void *driver, const String *path, bool errorOnExists, bool noParentCreate, mode_t mode);
|
||||
|
@ -1,31 +1,31 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Write Interface
|
||||
Storage Write Interface
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "storage/fileWrite.intern.h"
|
||||
#include "storage/write.intern.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
struct StorageFileWrite
|
||||
struct StorageWrite
|
||||
{
|
||||
MemContext *memContext; // Object mem context
|
||||
void *driver;
|
||||
const StorageFileWriteInterface *interface;
|
||||
const StorageWriteInterface *interface;
|
||||
IoWrite *io;
|
||||
};
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_INTERFACE_TYPE \
|
||||
StorageFileWriteInterface
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(&value, "StorageFileWriteInterface", buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_INTERFACE_TYPE \
|
||||
StorageWriteInterface
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_INTERFACE_FORMAT(value, buffer, bufferSize) \
|
||||
objToLog(&value, "StorageWriteInterface", buffer, bufferSize)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Create a new storage file
|
||||
@ -33,18 +33,18 @@ Create a new storage file
|
||||
This object expects its context to be created in advance. This is so the calling function can add whatever data it wants without
|
||||
required multiple functions and contexts to make it safe.
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *
|
||||
storageFileWriteNew(void *driver, const StorageFileWriteInterface *interface)
|
||||
StorageWrite *
|
||||
storageWriteNew(void *driver, const StorageWriteInterface *interface)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM_P(VOID, driver);
|
||||
FUNCTION_LOG_PARAM_P(STORAGE_FILE_WRITE_INTERFACE, interface);
|
||||
FUNCTION_LOG_PARAM_P(STORAGE_WRITE_INTERFACE, interface);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(driver != NULL);
|
||||
ASSERT(interface != NULL);
|
||||
|
||||
StorageFileWrite *this = memNew(sizeof(StorageFileWrite));
|
||||
StorageWrite *this = memNew(sizeof(StorageWrite));
|
||||
this->memContext = memContextCurrent();
|
||||
|
||||
this->driver = driver;
|
||||
@ -52,17 +52,17 @@ storageFileWriteNew(void *driver, const StorageFileWriteInterface *interface)
|
||||
|
||||
this->io = ioWriteNew(driver, interface->ioInterface);
|
||||
|
||||
FUNCTION_LOG_RETURN(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_LOG_RETURN(STORAGE_WRITE, this);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Move the file object to a new context
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *
|
||||
storageFileWriteMove(StorageFileWrite *this, MemContext *parentNew)
|
||||
StorageWrite *
|
||||
storageWriteMove(StorageWrite *this, MemContext *parentNew)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(MEM_CONTEXT, parentNew);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
@ -80,10 +80,10 @@ Will the file be written atomically?
|
||||
Atomic writes means the file will be complete or be missing. Filesystems have different ways to accomplish this.
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileWriteAtomic(const StorageFileWrite *this)
|
||||
storageWriteAtomic(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -95,10 +95,10 @@ storageFileWriteAtomic(const StorageFileWrite *this)
|
||||
Will the path be created if required?
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileWriteCreatePath(const StorageFileWrite *this)
|
||||
storageWriteCreatePath(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -110,10 +110,10 @@ storageFileWriteCreatePath(const StorageFileWrite *this)
|
||||
Get file driver
|
||||
***********************************************************************************************************************************/
|
||||
void *
|
||||
storageFileWriteFileDriver(const StorageFileWrite *this)
|
||||
storageWriteDriver(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -125,10 +125,10 @@ storageFileWriteFileDriver(const StorageFileWrite *this)
|
||||
Get the IO object
|
||||
***********************************************************************************************************************************/
|
||||
IoWrite *
|
||||
storageFileWriteIo(const StorageFileWrite *this)
|
||||
storageWriteIo(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -140,10 +140,10 @@ storageFileWriteIo(const StorageFileWrite *this)
|
||||
Get file mode
|
||||
***********************************************************************************************************************************/
|
||||
mode_t
|
||||
storageFileWriteModeFile(const StorageFileWrite *this)
|
||||
storageWriteModeFile(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -155,10 +155,10 @@ storageFileWriteModeFile(const StorageFileWrite *this)
|
||||
Get path mode
|
||||
***********************************************************************************************************************************/
|
||||
mode_t
|
||||
storageFileWriteModePath(const StorageFileWrite *this)
|
||||
storageWriteModePath(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -170,10 +170,10 @@ storageFileWriteModePath(const StorageFileWrite *this)
|
||||
Get file name
|
||||
***********************************************************************************************************************************/
|
||||
const String *
|
||||
storageFileWriteName(const StorageFileWrite *this)
|
||||
storageWriteName(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -185,10 +185,10 @@ storageFileWriteName(const StorageFileWrite *this)
|
||||
Will the file be synced after it is closed?
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileWriteSyncFile(const StorageFileWrite *this)
|
||||
storageWriteSyncFile(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -200,10 +200,10 @@ storageFileWriteSyncFile(const StorageFileWrite *this)
|
||||
Will the path be synced after the file is closed?
|
||||
***********************************************************************************************************************************/
|
||||
bool
|
||||
storageFileWriteSyncPath(const StorageFileWrite *this)
|
||||
storageWriteSyncPath(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -215,10 +215,10 @@ storageFileWriteSyncPath(const StorageFileWrite *this)
|
||||
Get file type
|
||||
***********************************************************************************************************************************/
|
||||
const String *
|
||||
storageFileWriteType(const StorageFileWrite *this)
|
||||
storageWriteType(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_TEST_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(this != NULL);
|
||||
@ -230,24 +230,23 @@ storageFileWriteType(const StorageFileWrite *this)
|
||||
Render as string for logging
|
||||
***********************************************************************************************************************************/
|
||||
String *
|
||||
storageFileWriteToLog(const StorageFileWrite *this)
|
||||
storageWriteToLog(const StorageWrite *this)
|
||||
{
|
||||
return strNewFmt(
|
||||
"{type: %s, name: %s, modeFile: %04o, modePath: %04o, createPath: %s, syncFile: %s, syncPath: %s, atomic: %s}",
|
||||
strPtr(storageFileWriteType(this)), strPtr(strToLog(storageFileWriteName(this))), storageFileWriteModeFile(this),
|
||||
storageFileWriteModePath(this), cvtBoolToConstZ(storageFileWriteCreatePath(this)),
|
||||
cvtBoolToConstZ(storageFileWriteSyncFile(this)), cvtBoolToConstZ(storageFileWriteSyncPath(this)),
|
||||
cvtBoolToConstZ(storageFileWriteAtomic(this)));
|
||||
strPtr(storageWriteType(this)), strPtr(strToLog(storageWriteName(this))), storageWriteModeFile(this),
|
||||
storageWriteModePath(this), cvtBoolToConstZ(storageWriteCreatePath(this)), cvtBoolToConstZ(storageWriteSyncFile(this)),
|
||||
cvtBoolToConstZ(storageWriteSyncPath(this)), cvtBoolToConstZ(storageWriteAtomic(this)));
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Free the file
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
storageFileWriteFree(const StorageFileWrite *this)
|
||||
storageWriteFree(const StorageWrite *this)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(STORAGE_FILE_WRITE, this);
|
||||
FUNCTION_LOG_PARAM(STORAGE_WRITE, this);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
if (this != NULL)
|
@ -1,13 +1,13 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Write Interface
|
||||
Storage Write Interface
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_FILEWRITE_H
|
||||
#define STORAGE_FILEWRITE_H
|
||||
#ifndef STORAGE_WRITE_H
|
||||
#define STORAGE_WRITE_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Object types
|
||||
Object type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileWrite StorageFileWrite;
|
||||
typedef struct StorageWrite StorageWrite;
|
||||
|
||||
#include "common/io/write.h"
|
||||
#include "common/type/buffer.h"
|
||||
@ -16,34 +16,34 @@ typedef struct StorageFileWrite StorageFileWrite;
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
StorageFileWrite *storageFileWriteMove(StorageFileWrite *this, MemContext *parentNew);
|
||||
StorageWrite *storageWriteMove(StorageWrite *this, MemContext *parentNew);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Getters
|
||||
***********************************************************************************************************************************/
|
||||
bool storageFileWriteAtomic(const StorageFileWrite *this);
|
||||
bool storageFileWriteCreatePath(const StorageFileWrite *this);
|
||||
IoWrite *storageFileWriteIo(const StorageFileWrite *this);
|
||||
mode_t storageFileWriteModeFile(const StorageFileWrite *this);
|
||||
mode_t storageFileWriteModePath(const StorageFileWrite *this);
|
||||
const String *storageFileWriteName(const StorageFileWrite *this);
|
||||
bool storageFileWriteSyncFile(const StorageFileWrite *this);
|
||||
bool storageFileWriteSyncPath(const StorageFileWrite *this);
|
||||
const String *storageFileWriteType(const StorageFileWrite *this);
|
||||
bool storageWriteAtomic(const StorageWrite *this);
|
||||
bool storageWriteCreatePath(const StorageWrite *this);
|
||||
IoWrite *storageWriteIo(const StorageWrite *this);
|
||||
mode_t storageWriteModeFile(const StorageWrite *this);
|
||||
mode_t storageWriteModePath(const StorageWrite *this);
|
||||
const String *storageWriteName(const StorageWrite *this);
|
||||
bool storageWriteSyncFile(const StorageWrite *this);
|
||||
bool storageWriteSyncPath(const StorageWrite *this);
|
||||
const String *storageWriteType(const StorageWrite *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Destructor
|
||||
***********************************************************************************************************************************/
|
||||
void storageFileWriteFree(const StorageFileWrite *this);
|
||||
void storageWriteFree(const StorageWrite *this);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Macros for function logging
|
||||
***********************************************************************************************************************************/
|
||||
String *storageFileWriteToLog(const StorageFileWrite *this);
|
||||
String *storageWriteToLog(const StorageWrite *this);
|
||||
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_TYPE \
|
||||
StorageFileWrite *
|
||||
#define FUNCTION_LOG_STORAGE_FILE_WRITE_FORMAT(value, buffer, bufferSize) \
|
||||
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, storageFileWriteToLog, buffer, bufferSize)
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_TYPE \
|
||||
StorageWrite *
|
||||
#define FUNCTION_LOG_STORAGE_WRITE_FORMAT(value, buffer, bufferSize) \
|
||||
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, storageWriteToLog, buffer, bufferSize)
|
||||
|
||||
#endif
|
@ -1,11 +1,11 @@
|
||||
/***********************************************************************************************************************************
|
||||
Storage File Write Internal
|
||||
Storage Write Interface Internal
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef STORAGE_FILEWRITE_INTERN_H
|
||||
#define STORAGE_FILEWRITE_INTERN_H
|
||||
#ifndef STORAGE_WRITE_INTERN_H
|
||||
#define STORAGE_WRITE_INTERN_H
|
||||
|
||||
#include "common/io/write.intern.h"
|
||||
#include "storage/fileWrite.h"
|
||||
#include "storage/write.h"
|
||||
#include "version.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -16,7 +16,7 @@ Temporary file extension
|
||||
/***********************************************************************************************************************************
|
||||
Constructor
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFileWriteInterface
|
||||
typedef struct StorageWriteInterface
|
||||
{
|
||||
const String *type;
|
||||
const String *name;
|
||||
@ -32,13 +32,13 @@ typedef struct StorageFileWriteInterface
|
||||
const String *user; // User that owns the file
|
||||
|
||||
IoWriteInterface ioInterface;
|
||||
} StorageFileWriteInterface;
|
||||
} StorageWriteInterface;
|
||||
|
||||
StorageFileWrite *storageFileWriteNew(void *driver, const StorageFileWriteInterface *interface);
|
||||
StorageWrite *storageWriteNew(void *driver, const StorageWriteInterface *interface);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
void *storageFileWriteFileDriver(const StorageFileWrite *this);
|
||||
void *storageWriteDriver(const StorageWrite *this);
|
||||
|
||||
#endif
|
@ -899,6 +899,10 @@ src/common/memContext.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/common/object.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/common/regExp.c:
|
||||
class: core
|
||||
type: c
|
||||
@ -1279,123 +1283,11 @@ src/protocol/server.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/cifs/storage.c:
|
||||
src/storage/cifs/storage.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/cifs/storage.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/posix/common.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/posix/common.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/posix/fileRead.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/posix/fileRead.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/posix/fileWrite.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/posix/fileWrite.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/posix/storage.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/posix/storage.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/remote/fileRead.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/remote/fileRead.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/remote/fileWrite.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/remote/fileWrite.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/remote/protocol.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/remote/protocol.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/remote/storage.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/remote/storage.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/s3/fileRead.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/s3/fileRead.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/s3/fileWrite.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/s3/fileWrite.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/driver/s3/storage.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/driver/s3/storage.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/fileRead.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/fileRead.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/fileRead.intern.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/fileWrite.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/fileWrite.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/fileWrite.intern.h:
|
||||
src/storage/cifs/storage.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
@ -1411,6 +1303,118 @@ src/storage/info.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/posix/common.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/posix/common.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/posix/read.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/posix/read.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/posix/storage.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/posix/storage.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/posix/storage.intern.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/posix/write.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/posix/write.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/read.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/read.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/read.intern.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/remote/protocol.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/remote/protocol.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/remote/read.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/remote/read.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/remote/storage.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/remote/storage.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/remote/storage.intern.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/remote/write.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/remote/write.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/s3/read.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/s3/read.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/s3/storage.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/s3/storage.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/s3/storage.intern.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/s3/write.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/s3/write.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/storage.c:
|
||||
class: core
|
||||
type: c
|
||||
@ -1423,6 +1427,18 @@ src/storage/storage.intern.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/write.c:
|
||||
class: core
|
||||
type: c
|
||||
|
||||
src/storage/write.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/storage/write.intern.h:
|
||||
class: core
|
||||
type: c/h
|
||||
|
||||
src/version.h:
|
||||
class: core
|
||||
type: c/h
|
||||
@ -1691,6 +1707,14 @@ test/src/common/harnessFork.h:
|
||||
class: test/harness
|
||||
type: c/h
|
||||
|
||||
test/src/common/harnessInfo.c:
|
||||
class: test/harness
|
||||
type: c
|
||||
|
||||
test/src/common/harnessInfo.h:
|
||||
class: test/harness
|
||||
type: c/h
|
||||
|
||||
test/src/common/harnessLog.c:
|
||||
class: test/harness
|
||||
type: c
|
||||
|
@ -497,8 +497,8 @@ unit:
|
||||
total: 1
|
||||
|
||||
coverage:
|
||||
storage/driver/cifs/storage: full
|
||||
storage/driver/posix/storage: full
|
||||
storage/cifs/storage: full
|
||||
storage/posix/storage: full
|
||||
storage/helper: full
|
||||
storage/storage: full
|
||||
|
||||
@ -507,14 +507,14 @@ unit:
|
||||
total: 21
|
||||
|
||||
coverage:
|
||||
storage/driver/posix/common: full
|
||||
storage/driver/posix/fileRead: full
|
||||
storage/driver/posix/fileWrite: full
|
||||
storage/driver/posix/storage: full
|
||||
storage/fileRead: full
|
||||
storage/fileWrite: full
|
||||
storage/posix/common: full
|
||||
storage/posix/read: full
|
||||
storage/posix/storage: full
|
||||
storage/posix/write: full
|
||||
storage/helper: full
|
||||
storage/read: full
|
||||
storage/storage: full
|
||||
storage/write: full
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------------
|
||||
- name: remote
|
||||
@ -522,10 +522,10 @@ unit:
|
||||
perlReq: true
|
||||
|
||||
coverage:
|
||||
storage/driver/remote/fileRead: full
|
||||
storage/driver/remote/fileWrite: full
|
||||
storage/driver/remote/protocol: full
|
||||
storage/driver/remote/storage: full
|
||||
storage/remote/read: full
|
||||
storage/remote/protocol: full
|
||||
storage/remote/storage: full
|
||||
storage/remote/write: full
|
||||
storage/helper: full
|
||||
storage/storage: full
|
||||
|
||||
@ -534,9 +534,9 @@ unit:
|
||||
total: 3
|
||||
|
||||
coverage:
|
||||
storage/driver/s3/fileRead: full
|
||||
storage/driver/s3/fileWrite: full
|
||||
storage/driver/s3/storage: full
|
||||
storage/s3/read: full
|
||||
storage/s3/storage: full
|
||||
storage/s3/write: full
|
||||
storage/helper: full
|
||||
storage/storage: full
|
||||
|
||||
|
@ -4,7 +4,7 @@ Test Archive Common
|
||||
#include <unistd.h>
|
||||
|
||||
#include "storage/helper.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
#include "common/harnessConfig.h"
|
||||
|
||||
@ -17,7 +17,7 @@ testRun(void)
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
// Create default storage object for testing
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
|
@ -8,7 +8,7 @@ Test Archive Get Command
|
||||
#include "common/io/bufferWrite.h"
|
||||
#include "postgres/interface.h"
|
||||
#include "postgres/version.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
#include "common/harnessInfo.h"
|
||||
|
||||
@ -20,7 +20,7 @@ testRun(void)
|
||||
{
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// Start a protocol server to test the protocol directly
|
||||
@ -184,10 +184,10 @@ testRun(void)
|
||||
|
||||
// Create a compressed WAL segment to copy
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
StorageFileWrite *infoWrite = storageNewWriteNP(storageTest, strNew("repo/archive/test1/archive.info"));
|
||||
StorageWrite *infoWrite = storageNewWriteNP(storageTest, strNew("repo/archive/test1/archive.info"));
|
||||
|
||||
ioWriteFilterGroupSet(
|
||||
storageFileWriteIo(infoWrite),
|
||||
storageWriteIo(infoWrite),
|
||||
ioFilterGroupAdd(
|
||||
ioFilterGroupNew(), cipherBlockNew(cipherModeEncrypt, cipherTypeAes256Cbc, BUFSTRDEF("12345678"), NULL)));
|
||||
|
||||
@ -203,7 +203,7 @@ testRun(void)
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":18072658121562454734,\"db-version\":\"10\"}"));
|
||||
|
||||
StorageFileWrite *destination = storageNewWriteNP(
|
||||
StorageWrite *destination = storageNewWriteNP(
|
||||
storageTest,
|
||||
strNew(
|
||||
"repo/archive/test1/10-1/01ABCDEF01ABCDEF/01ABCDEF01ABCDEF01ABCDEF-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.gz"));
|
||||
@ -212,7 +212,7 @@ testRun(void)
|
||||
ioFilterGroupAdd(filterGroup, gzipCompressNew(3, false));
|
||||
ioFilterGroupAdd(
|
||||
filterGroup, cipherBlockNew(cipherModeEncrypt, cipherTypeAes256Cbc, BUFSTRDEF("worstpassphraseever"), NULL));
|
||||
ioWriteFilterGroupSet(storageFileWriteIo(destination), filterGroup);
|
||||
ioWriteFilterGroupSet(storageWriteIo(destination), filterGroup);
|
||||
storagePutNP(destination, buffer);
|
||||
|
||||
TEST_RESULT_INT(
|
||||
|
@ -7,7 +7,7 @@ Test Archive Push Command
|
||||
#include "common/io/handleWrite.h"
|
||||
#include "common/time.h"
|
||||
#include "postgres/version.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
#include "common/harnessConfig.h"
|
||||
#include "common/harnessFork.h"
|
||||
@ -22,7 +22,7 @@ testRun(void)
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
// Create default storage object for testing
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// Start a protocol server to test the protocol directly
|
||||
@ -371,10 +371,10 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
storagePathRemoveP(storageTest, strNew("repo"), .errorOnMissing = true, .recurse = true);
|
||||
|
||||
StorageFileWrite *infoWrite = storageNewWriteNP(storageTest, strNew("repo/archive/test/archive.info"));
|
||||
StorageWrite *infoWrite = storageNewWriteNP(storageTest, strNew("repo/archive/test/archive.info"));
|
||||
|
||||
ioWriteFilterGroupSet(
|
||||
storageFileWriteIo(infoWrite),
|
||||
storageWriteIo(infoWrite),
|
||||
ioFilterGroupAdd(
|
||||
ioFilterGroupNew(), cipherBlockNew(cipherModeEncrypt, cipherTypeAes256Cbc, BUFSTRDEF("badpassphrase"), NULL)));
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
Test Common Functions and Definitions for Backup and Expire Commands
|
||||
***********************************************************************************************************************************/
|
||||
#include "common/harnessConfig.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
#include <common/regExp.h>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
Test Command Control
|
||||
***********************************************************************************************************************************/
|
||||
#include "common/harnessConfig.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Test Run
|
||||
@ -13,7 +13,7 @@ testRun(void)
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
// Create default storage object for testing
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
|
@ -2,7 +2,7 @@
|
||||
Test Help Command
|
||||
***********************************************************************************************************************************/
|
||||
#include "config/parse.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
#include "storage/storage.h"
|
||||
#include "version.h"
|
||||
|
||||
@ -386,7 +386,7 @@ testRun(void)
|
||||
// Restore normal stdout
|
||||
dup2(stdoutSave, STDOUT_FILENO);
|
||||
|
||||
Storage *storage = storageDriverPosixNew(
|
||||
Storage *storage = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL);
|
||||
TEST_RESULT_STR(strPtr(strNewBuf(storageGetNP(storageNewReadNP(storage, stdoutFile)))), generalHelp, " check text");
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/***********************************************************************************************************************************
|
||||
Test Info Command
|
||||
***********************************************************************************************************************************/
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
#include "common/harnessConfig.h"
|
||||
#include "common/harnessInfo.h"
|
||||
@ -824,7 +824,7 @@ testRun(void)
|
||||
// Restore normal stdout
|
||||
dup2(stdoutSave, STDOUT_FILENO);
|
||||
|
||||
Storage *storage = storageDriverPosixNew(
|
||||
Storage *storage = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, false, NULL);
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strNewBuf(storageGetNP(storageNewReadNP(storage, stdoutFile)))), "No stanzas exist in the repository.\n",
|
||||
|
@ -5,7 +5,7 @@ Test Remote Command
|
||||
#include "common/io/handleWrite.h"
|
||||
#include "protocol/client.h"
|
||||
#include "protocol/server.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
#include "common/harnessConfig.h"
|
||||
#include "common/harnessFork.h"
|
||||
@ -22,7 +22,7 @@ testRun(void)
|
||||
if (testBegin("cmdRemote()"))
|
||||
{
|
||||
// Create default storage object for testing
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// No remote lock required
|
||||
|
@ -1,7 +1,7 @@
|
||||
/***********************************************************************************************************************************
|
||||
Test Ini
|
||||
***********************************************************************************************************************************/
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Test Run
|
||||
@ -11,7 +11,7 @@ testRun(void)
|
||||
{
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
@ -109,8 +109,8 @@ testRun(void)
|
||||
iniSet(ini, strNew("section1"), strNew("key2"), strNew("value2"));
|
||||
iniSet(ini, strNew("section1"), strNew("key1"), strNew("value1"));
|
||||
|
||||
StorageFileWrite *write = storageNewWriteNP(storageTest, strNew("test.ini"));
|
||||
TEST_RESULT_VOID(iniSave(ini, storageFileWriteIo(write)), "save ini");
|
||||
StorageWrite *write = storageNewWriteNP(storageTest, strNew("test.ini"));
|
||||
TEST_RESULT_VOID(iniSave(ini, storageWriteIo(write)), "save ini");
|
||||
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strNewBuf(storageGetNP(storageNewReadNP(storageTest, strNew("test.ini"))))),
|
||||
|
@ -2,7 +2,7 @@
|
||||
Test Lock Handler
|
||||
***********************************************************************************************************************************/
|
||||
#include "common/time.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
#include "common/harnessFork.h"
|
||||
|
||||
@ -15,7 +15,7 @@ testRun(void)
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
// Create default storage object for testing
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/***********************************************************************************************************************************
|
||||
Test Info Handler
|
||||
***********************************************************************************************************************************/
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Test Run
|
||||
@ -10,7 +10,7 @@ void
|
||||
testRun(void)
|
||||
{
|
||||
// Create default storage object for testing
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
@ -61,10 +61,10 @@ testRun(void)
|
||||
|
||||
// Remove the copy and store only the main info file and encrypt it. One is required.
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
StorageFileWrite *infoWrite = storageNewWriteNP(storageLocalWrite(), fileName);
|
||||
StorageWrite *infoWrite = storageNewWriteNP(storageLocalWrite(), fileName);
|
||||
|
||||
ioWriteFilterGroupSet(
|
||||
storageFileWriteIo(infoWrite),
|
||||
storageWriteIo(infoWrite),
|
||||
ioFilterGroupAdd(
|
||||
ioFilterGroupNew(), cipherBlockNew(cipherModeEncrypt, cipherTypeAes256Cbc, BUFSTRDEF("12345678"), NULL)));
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/***********************************************************************************************************************************
|
||||
Test PostgreSQL Interface
|
||||
***********************************************************************************************************************************/
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Test Run
|
||||
@ -11,7 +11,7 @@ testRun(void)
|
||||
{
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
|
@ -7,7 +7,7 @@ Test Protocol
|
||||
#include "common/io/bufferWrite.h"
|
||||
#include "common/regExp.h"
|
||||
#include "storage/storage.h"
|
||||
#include "storage/driver/posix/storage.h"
|
||||
#include "storage/posix/storage.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "common/harnessConfig.h"
|
||||
@ -62,7 +62,7 @@ testRun(void)
|
||||
{
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Test CIFS Storage Driver
|
||||
Test CIFS Storage
|
||||
***********************************************************************************************************************************/
|
||||
#include "common/harnessConfig.h"
|
||||
|
||||
@ -29,10 +29,10 @@ testRun(void)
|
||||
|
||||
// Create a FileWrite object with path sync enabled and ensure that path sync is false in the write object
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
StorageFileWrite *file = NULL;
|
||||
StorageWrite *file = NULL;
|
||||
TEST_ASSIGN(file, storageNewWriteP(storage, strNew("somefile"), .noSyncPath = false), "new file write");
|
||||
|
||||
TEST_RESULT_BOOL(storageFileWriteSyncPath(file), false, "path sync is disabled");
|
||||
TEST_RESULT_BOOL(storageWriteSyncPath(file), false, "path sync is disabled");
|
||||
|
||||
// Test the path sync function -- pass a bogus path to ensure that this is a noop
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1,13 +1,13 @@
|
||||
/***********************************************************************************************************************************
|
||||
Test Posix Storage Driver
|
||||
Test Posix Storage
|
||||
***********************************************************************************************************************************/
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "common/time.h"
|
||||
#include "storage/fileRead.h"
|
||||
#include "storage/fileWrite.h"
|
||||
#include "storage/read.h"
|
||||
#include "storage/write.h"
|
||||
|
||||
#include "common/harnessConfig.h"
|
||||
#include "common/harnessFork.h"
|
||||
@ -65,9 +65,9 @@ testRun(void)
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
// Create default storage object for testing
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
Storage *storageTmp = storageDriverPosixNew(
|
||||
Storage *storageTmp = storagePosixNew(
|
||||
strNew("/tmp"), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
ioBufferSizeSet(2);
|
||||
|
||||
@ -79,45 +79,45 @@ testRun(void)
|
||||
String *writeFile = strNewFmt("%s/writefile", testPath());
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("storageDriverPosixFile*()"))
|
||||
if (testBegin("storagePosixFile*()"))
|
||||
{
|
||||
TEST_CREATE_NOPERM();
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageDriverPosixFileOpen(pathNoPerm, O_RDONLY, 0, false, false, "test"), PathOpenError,
|
||||
storagePosixFileOpen(pathNoPerm, O_RDONLY, 0, false, false, "test"), PathOpenError,
|
||||
"unable to open '%s' for test: [13] Permission denied", strPtr(pathNoPerm));
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
String *fileName = strNewFmt("%s/test.file", testPath());
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageDriverPosixFileOpen(fileName, O_RDONLY, 0, false, true, "read"), FileMissingError,
|
||||
storagePosixFileOpen(fileName, O_RDONLY, 0, false, true, "read"), FileMissingError,
|
||||
"unable to open '%s' for read: [2] No such file or directory", strPtr(fileName));
|
||||
|
||||
TEST_RESULT_INT(storageDriverPosixFileOpen(fileName, O_RDONLY, 0, true, true, "read"), -1, "missing file ignored");
|
||||
TEST_RESULT_INT(storagePosixFileOpen(fileName, O_RDONLY, 0, true, true, "read"), -1, "missing file ignored");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
int handle = -1;
|
||||
|
||||
TEST_RESULT_INT(system(strPtr(strNewFmt("touch %s", strPtr(fileName)))), 0, "create read file");
|
||||
TEST_ASSIGN(handle, storageDriverPosixFileOpen(fileName, O_RDONLY, 0, false, true, "read"), "open read file");
|
||||
TEST_ASSIGN(handle, storagePosixFileOpen(fileName, O_RDONLY, 0, false, true, "read"), "open read file");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ERROR_FMT(
|
||||
storageDriverPosixFileSync(-99, fileName, false, false), PathSyncError,
|
||||
storagePosixFileSync(-99, fileName, false, false), PathSyncError,
|
||||
"unable to sync '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
TEST_ERROR_FMT(
|
||||
storageDriverPosixFileSync(-99, fileName, true, true), FileSyncError,
|
||||
storagePosixFileSync(-99, fileName, true, true), FileSyncError,
|
||||
"unable to sync '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
TEST_RESULT_VOID(storageDriverPosixFileSync(handle, fileName, true, false), "sync file");
|
||||
TEST_RESULT_VOID(storagePosixFileSync(handle, fileName, true, false), "sync file");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ERROR_FMT(
|
||||
storageDriverPosixFileClose(-99, fileName, true), FileCloseError,
|
||||
storagePosixFileClose(-99, fileName, true), FileCloseError,
|
||||
"unable to close '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
TEST_RESULT_VOID(storageDriverPosixFileClose(handle, fileName, true), "close file");
|
||||
TEST_RESULT_VOID(storagePosixFileClose(handle, fileName, true), "close file");
|
||||
|
||||
TEST_RESULT_INT(system(strPtr(strNewFmt("rm %s", strPtr(fileName)))), 0, "remove read file");
|
||||
}
|
||||
@ -126,7 +126,7 @@ testRun(void)
|
||||
if (testBegin("storageNew() and storageFree()"))
|
||||
{
|
||||
Storage *storageTest = NULL;
|
||||
TEST_ASSIGN(storageTest, storageDriverPosixNew(strNew("/"), 0640, 0750, false, NULL), "new storage (defaults)");
|
||||
TEST_ASSIGN(storageTest, storagePosixNew(strNew("/"), 0640, 0750, false, NULL), "new storage (defaults)");
|
||||
TEST_RESULT_STR(strPtr(storageTest->path), "/", " check path");
|
||||
TEST_RESULT_INT(storageTest->modeFile, 0640, " check file mode");
|
||||
TEST_RESULT_INT(storageTest->modePath, 0750, " check path mode");
|
||||
@ -134,7 +134,7 @@ testRun(void)
|
||||
TEST_RESULT_BOOL(storageTest->pathExpressionFunction == NULL, true, " check expression function is not set");
|
||||
|
||||
TEST_ASSIGN(
|
||||
storageTest, storageDriverPosixNew(strNew("/path/to"), 0600, 0700, true, storageTestPathExpression),
|
||||
storageTest, storagePosixNew(strNew("/path/to"), 0600, 0700, true, storageTestPathExpression),
|
||||
"new storage (non-default)");
|
||||
TEST_RESULT_STR(strPtr(storageTest->path), "/path/to", " check path");
|
||||
TEST_RESULT_INT(storageTest->modeFile, 0600, " check file mode");
|
||||
@ -309,7 +309,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
testStorageInfoListSize = 0;
|
||||
TEST_RESULT_VOID(
|
||||
storageDriverPosixInfoListEntry((StorageDriverPosix *)storageDriver(storageTest), strNew("pg"), strNew("missing"),
|
||||
storagePosixInfoListEntry((StoragePosix *)storageDriver(storageTest), strNew("pg"), strNew("missing"),
|
||||
testStorageInfoListCallback, (void *)memContextCurrent()),
|
||||
"missing file");
|
||||
TEST_RESULT_UINT(testStorageInfoListSize, 0, " no file found");
|
||||
@ -365,8 +365,8 @@ testRun(void)
|
||||
String *sourceFile = strNewFmt("%s/source.txt", testPath());
|
||||
String *destinationFile = strNewFmt("%s/destination.txt", testPath());
|
||||
|
||||
StorageFileRead *source = storageNewReadNP(storageTest, sourceFile);
|
||||
StorageFileWrite *destination = storageNewWriteNP(storageTest, destinationFile);
|
||||
StorageRead *source = storageNewReadNP(storageTest, sourceFile);
|
||||
StorageWrite *destination = storageNewWriteNP(storageTest, destinationFile);
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageCopyNP(source, destination), FileMissingError,
|
||||
@ -398,8 +398,8 @@ testRun(void)
|
||||
String *sourceFile = strNewFmt("%s/source.txt", testPath());
|
||||
String *destinationFile = strNewFmt("%s/sub/destination.txt", testPath());
|
||||
|
||||
StorageFileRead *source = storageNewReadNP(storageTest, sourceFile);
|
||||
StorageFileWrite *destination = storageNewWriteNP(storageTest, destinationFile);
|
||||
StorageRead *source = storageNewReadNP(storageTest, sourceFile);
|
||||
StorageWrite *destination = storageNewWriteNP(storageTest, destinationFile);
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageMoveNP(storageTest, source, destination), FileMissingError,
|
||||
@ -480,7 +480,7 @@ testRun(void)
|
||||
{
|
||||
Storage *storageTest = NULL;
|
||||
|
||||
TEST_ASSIGN(storageTest, storageDriverPosixNew(strNew("/"), 0640, 0750, false, NULL), "new storage /");
|
||||
TEST_ASSIGN(storageTest, storagePosixNew(strNew("/"), 0640, 0750, false, NULL), "new storage /");
|
||||
TEST_RESULT_STR(strPtr(storagePathNP(storageTest, NULL)), "/", " root dir");
|
||||
TEST_RESULT_STR(strPtr(storagePathNP(storageTest, strNew("/"))), "/", " same as root dir");
|
||||
TEST_RESULT_STR(strPtr(storagePathNP(storageTest, strNew("subdir"))), "/subdir", " simple subdir");
|
||||
@ -490,7 +490,7 @@ testRun(void)
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ASSIGN(
|
||||
storageTest, storageDriverPosixNew(strNew("/path/to"), 0640, 0750, false, storageTestPathExpression),
|
||||
storageTest, storagePosixNew(strNew("/path/to"), 0640, 0750, false, storageTestPathExpression),
|
||||
"new storage /path/to with expression");
|
||||
TEST_RESULT_STR(strPtr(storagePathNP(storageTest, NULL)), "/path/to", " root dir");
|
||||
TEST_RESULT_STR(strPtr(storagePathNP(storageTest, strNew("/path/to"))), "/path/to", " absolute root dir");
|
||||
@ -625,26 +625,26 @@ testRun(void)
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("storageNewRead()"))
|
||||
{
|
||||
StorageFileRead *file = NULL;
|
||||
StorageRead *file = NULL;
|
||||
String *fileName = strNewFmt("%s/readtest.txt", testPath());
|
||||
|
||||
TEST_ASSIGN(file, storageNewReadNP(storageTest, fileName), "new read file (defaults)");
|
||||
TEST_ERROR_FMT(
|
||||
ioReadOpen(storageFileReadIo(file)), FileMissingError,
|
||||
ioReadOpen(storageReadIo(file)), FileMissingError,
|
||||
"unable to open '%s' for read: [2] No such file or directory", strPtr(fileName));
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_RESULT_INT(system(strPtr(strNewFmt("touch %s", strPtr(fileName)))), 0, "create read file");
|
||||
|
||||
TEST_RESULT_BOOL(ioReadOpen(storageFileReadIo(file)), true, " open file");
|
||||
TEST_RESULT_BOOL(ioReadOpen(storageReadIo(file)), true, " open file");
|
||||
TEST_RESULT_INT(
|
||||
ioReadHandle(storageFileReadIo(file)), ((StorageFileReadDriverPosix *)file->driver)->handle, "check read handle");
|
||||
TEST_RESULT_VOID(ioReadClose(storageFileReadIo(file)), " close file");
|
||||
ioReadHandle(storageReadIo(file)), ((StorageReadPosix *)file->driver)->handle, "check read handle");
|
||||
TEST_RESULT_VOID(ioReadClose(storageReadIo(file)), " close file");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
IoFilterGroup *filterGroup = ioFilterGroupNew();
|
||||
TEST_ASSIGN(file, storageNewReadP(storageTest, fileName, .filterGroup = filterGroup), "new read file with filters");
|
||||
TEST_RESULT_PTR(ioReadFilterGroup(storageFileReadIo(file)), filterGroup, " check filter group is set");
|
||||
TEST_RESULT_PTR(ioReadFilterGroup(storageReadIo(file)), filterGroup, " check filter group is set");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
@ -653,18 +653,18 @@ testRun(void)
|
||||
String *fileName = strNewFmt("%s/sub1/testfile", testPath());
|
||||
|
||||
TEST_CREATE_NOPERM();
|
||||
StorageFileWrite *file = NULL;
|
||||
StorageWrite *file = NULL;
|
||||
|
||||
TEST_ASSIGN(file, storageNewWriteP(storageTest, fileNoPerm, .noAtomic = true), "new write file (defaults)");
|
||||
TEST_ERROR_FMT(
|
||||
ioWriteOpen(storageFileWriteIo(file)), FileOpenError,
|
||||
ioWriteOpen(storageWriteIo(file)), FileOpenError,
|
||||
"unable to open '%s' for write: [13] Permission denied", strPtr(fileNoPerm));
|
||||
|
||||
TEST_ASSIGN(file, storageNewWriteP(storageTest, fileName, .user = strNew("bogus")), "new write file (bogus user)");
|
||||
TEST_ERROR(ioWriteOpen(storageFileWriteIo(file)), UserMissingError, "unable to find user 'bogus'");
|
||||
TEST_ERROR(ioWriteOpen(storageWriteIo(file)), UserMissingError, "unable to find user 'bogus'");
|
||||
|
||||
TEST_ASSIGN(file, storageNewWriteP(storageTest, fileName, .group = strNew("bogus")), "new write file (bogus group)");
|
||||
TEST_ERROR(ioWriteOpen(storageFileWriteIo(file)), GroupMissingError, "unable to find group 'bogus'");
|
||||
TEST_ERROR(ioWriteOpen(storageWriteIo(file)), GroupMissingError, "unable to find group 'bogus'");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ASSIGN(
|
||||
@ -673,10 +673,10 @@ testRun(void)
|
||||
storageTest, fileName, .user = strNew(getpwuid(getuid())->pw_name), .group = strNew(getgrgid(getgid())->gr_name),
|
||||
.timeModified = 1),
|
||||
"new write file (defaults)");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageFileWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(file)), " open file");
|
||||
TEST_RESULT_INT(
|
||||
ioWriteHandle(storageFileWriteIo(file)), ((StorageFileWriteDriverPosix *)file->driver)->handle, "check write handle");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageFileWriteIo(file)), " close file");
|
||||
ioWriteHandle(storageWriteIo(file)), ((StorageWritePosix *)file->driver)->handle, "check write handle");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageWriteIo(file)), " close file");
|
||||
TEST_RESULT_INT(storageInfoNP(storageTest, strPath(fileName)).mode, 0750, " check path mode");
|
||||
TEST_RESULT_INT(storageInfoNP(storageTest, fileName).mode, 0640, " check file mode");
|
||||
TEST_RESULT_INT(storageInfoNP(storageTest, fileName).timeModified, 1, " check file modified times");
|
||||
@ -689,10 +689,10 @@ testRun(void)
|
||||
TEST_ASSIGN(
|
||||
file, storageNewWriteP(storageTest, fileName, .user = strNew(getpwuid(getuid())->pw_name)),
|
||||
"new write file (defaults)");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageFileWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWrite(storageFileWriteIo(file), BUFSTRDEF("TESTDATA")), "write data");
|
||||
TEST_RESULT_VOID(ioWriteFlush(storageFileWriteIo(file)), "flush data");
|
||||
TEST_RESULT_VOID(ioWriteFree(storageFileWriteIo(file)), " free file");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWrite(storageWriteIo(file), BUFSTRDEF("TESTDATA")), "write data");
|
||||
TEST_RESULT_VOID(ioWriteFlush(storageWriteIo(file)), "flush data");
|
||||
TEST_RESULT_VOID(ioWriteFree(storageWriteIo(file)), " free file");
|
||||
|
||||
TEST_RESULT_BOOL(storageExistsNP(storageTest, fileName), false, "destination file does not exist");
|
||||
TEST_RESULT_BOOL(storageExistsNP(storageTest, fileNameTmp), true, "destination tmp file exists");
|
||||
@ -703,24 +703,24 @@ testRun(void)
|
||||
|
||||
TEST_ASSIGN(
|
||||
file, storageNewWriteP(storageTest, fileName, .modePath = 0700, .modeFile = 0600), "new write file (set mode)");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageFileWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageFileWriteIo(file)), " close file");
|
||||
TEST_RESULT_VOID(storageFileWriteDriverPosixClose(storageFileWriteFileDriver(file)), " close file again");
|
||||
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_INT(storageInfoNP(storageTest, strPath(fileName)).mode, 0700, " check path mode");
|
||||
TEST_RESULT_INT(storageInfoNP(storageTest, fileName).mode, 0600, " check file mode");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
IoFilterGroup *filterGroup = ioFilterGroupNew();
|
||||
TEST_ASSIGN(file, storageNewWriteP(storageTest, fileName, .filterGroup = filterGroup), "new write file with filters");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageFileWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageFileWriteIo(file)), " close file");
|
||||
TEST_RESULT_PTR(ioWriteFilterGroup(storageFileWriteIo(file)), filterGroup, " check filter group is set");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageWriteIo(file)), " close file");
|
||||
TEST_RESULT_PTR(ioWriteFilterGroup(storageWriteIo(file)), filterGroup, " check filter group is set");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("storagePut() and storageGet()"))
|
||||
{
|
||||
Storage *storageTest = storageDriverPosixNew(strNew("/"), 0640, 0750, true, NULL);
|
||||
Storage *storageTest = storagePosixNew(strNew("/"), 0640, 0750, true, NULL);
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageGetNP(storageNewReadNP(storageTest, strNew(testPath()))), FileReadError,
|
||||
@ -793,20 +793,20 @@ testRun(void)
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("StorageFileRead"))
|
||||
if (testBegin("StorageRead"))
|
||||
{
|
||||
TEST_CREATE_NOPERM();
|
||||
StorageFileRead *file = NULL;
|
||||
StorageRead *file = NULL;
|
||||
|
||||
TEST_ASSIGN(file, storageNewReadP(storageTest, fileNoPerm, .ignoreMissing = true), "new read file");
|
||||
TEST_RESULT_PTR(storageFileReadDriver(file), file->driver, " check driver");
|
||||
TEST_RESULT_BOOL(storageFileReadIgnoreMissing(file), true, " check ignore missing");
|
||||
TEST_RESULT_STR(strPtr(storageFileReadName(file)), strPtr(fileNoPerm), " check name");
|
||||
TEST_RESULT_PTR(storageRead(file), file->driver, " check driver");
|
||||
TEST_RESULT_BOOL(storageReadIgnoreMissing(file), true, " check ignore missing");
|
||||
TEST_RESULT_STR(strPtr(storageReadName(file)), strPtr(fileNoPerm), " check name");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ASSIGN(file, storageNewReadNP(storageTest, fileNoPerm), "new no perm read file");
|
||||
TEST_ERROR_FMT(
|
||||
ioReadOpen(storageFileReadIo(file)), FileOpenError,
|
||||
ioReadOpen(storageReadIo(file)), FileOpenError,
|
||||
"unable to open '%s' for read: [13] Permission denied", strPtr(fileNoPerm));
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -814,12 +814,12 @@ testRun(void)
|
||||
|
||||
TEST_ASSIGN(file, storageNewReadNP(storageTest, fileName), "new missing read file");
|
||||
TEST_ERROR_FMT(
|
||||
ioReadOpen(storageFileReadIo(file)), FileMissingError,
|
||||
ioReadOpen(storageReadIo(file)), FileMissingError,
|
||||
"unable to open '%s' for read: [2] No such file or directory", strPtr(fileName));
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ASSIGN(file, storageNewReadP(storageTest, fileName, .ignoreMissing = true), "new missing read file");
|
||||
TEST_RESULT_BOOL(ioReadOpen(storageFileReadIo(file)), false, " missing file ignored");
|
||||
TEST_RESULT_BOOL(ioReadOpen(storageReadIo(file)), false, " missing file ignored");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
Buffer *outBuffer = bufNew(2);
|
||||
@ -827,76 +827,76 @@ testRun(void)
|
||||
TEST_RESULT_VOID(storagePutNP(storageNewWriteNP(storageTest, fileName), expectedBuffer), "write test file");
|
||||
|
||||
TEST_ASSIGN(file, storageNewReadNP(storageTest, fileName), "new read file");
|
||||
TEST_RESULT_BOOL(ioReadOpen(storageFileReadIo(file)), true, " open file");
|
||||
TEST_RESULT_BOOL(ioReadOpen(storageReadIo(file)), true, " open file");
|
||||
|
||||
// Close the file handle so operations will fail
|
||||
close(((StorageFileReadDriverPosix *)file->driver)->handle);
|
||||
close(((StorageReadPosix *)file->driver)->handle);
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
ioRead(storageFileReadIo(file), outBuffer), FileReadError,
|
||||
ioRead(storageReadIo(file), outBuffer), FileReadError,
|
||||
"unable to read '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
// Set file handle to -1 so the close on free will not fail
|
||||
((StorageFileReadDriverPosix *)file->driver)->handle = -1;
|
||||
((StorageReadPosix *)file->driver)->handle = -1;
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
Buffer *buffer = bufNew(0);
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
TEST_ASSIGN(file, storageFileReadMove(storageNewReadNP(storageTest, fileName), MEM_CONTEXT_OLD()), "new read file");
|
||||
TEST_ASSIGN(file, storageReadMove(storageNewReadNP(storageTest, fileName), MEM_CONTEXT_OLD()), "new read file");
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
TEST_RESULT_BOOL(ioReadOpen(storageFileReadIo(file)), true, " open file");
|
||||
TEST_RESULT_STR(strPtr(storageFileReadName(file)), strPtr(fileName), " check file name");
|
||||
TEST_RESULT_STR(strPtr(storageFileReadType(file)), "posix", " check file type");
|
||||
TEST_RESULT_BOOL(ioReadOpen(storageReadIo(file)), true, " open file");
|
||||
TEST_RESULT_STR(strPtr(storageReadName(file)), strPtr(fileName), " check file name");
|
||||
TEST_RESULT_STR(strPtr(storageReadType(file)), "posix", " check file type");
|
||||
|
||||
TEST_RESULT_VOID(ioRead(storageFileReadIo(file), outBuffer), " load data");
|
||||
TEST_RESULT_VOID(ioRead(storageReadIo(file), outBuffer), " load data");
|
||||
bufCat(buffer, outBuffer);
|
||||
bufUsedZero(outBuffer);
|
||||
TEST_RESULT_VOID(ioRead(storageFileReadIo(file), outBuffer), " load data");
|
||||
TEST_RESULT_VOID(ioRead(storageReadIo(file), outBuffer), " load data");
|
||||
bufCat(buffer, outBuffer);
|
||||
bufUsedZero(outBuffer);
|
||||
TEST_RESULT_VOID(ioRead(storageFileReadIo(file), outBuffer), " load data");
|
||||
TEST_RESULT_VOID(ioRead(storageReadIo(file), outBuffer), " load data");
|
||||
bufCat(buffer, outBuffer);
|
||||
bufUsedZero(outBuffer);
|
||||
TEST_RESULT_VOID(ioRead(storageFileReadIo(file), outBuffer), " load data");
|
||||
TEST_RESULT_VOID(ioRead(storageReadIo(file), outBuffer), " load data");
|
||||
bufCat(buffer, outBuffer);
|
||||
bufUsedZero(outBuffer);
|
||||
TEST_RESULT_BOOL(bufEq(buffer, expectedBuffer), false, " check file contents (not all loaded yet)");
|
||||
|
||||
TEST_RESULT_VOID(ioRead(storageFileReadIo(file), outBuffer), " load data");
|
||||
TEST_RESULT_VOID(ioRead(storageReadIo(file), outBuffer), " load data");
|
||||
bufCat(buffer, outBuffer);
|
||||
bufUsedZero(outBuffer);
|
||||
|
||||
TEST_RESULT_VOID(ioRead(storageFileReadIo(file), outBuffer), " no data to load");
|
||||
TEST_RESULT_VOID(ioRead(storageReadIo(file), outBuffer), " no data to load");
|
||||
TEST_RESULT_INT(bufUsed(outBuffer), 0, " buffer is empty");
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
storageFileReadDriverPosix(storageFileReadDriver(file), outBuffer, true),
|
||||
storageReadPosix(storageRead(file), outBuffer, true),
|
||||
" no data to load from driver either");
|
||||
TEST_RESULT_INT(bufUsed(outBuffer), 0, " buffer is empty");
|
||||
|
||||
TEST_RESULT_BOOL(bufEq(buffer, expectedBuffer), true, " check file contents (all loaded)");
|
||||
|
||||
TEST_RESULT_BOOL(ioReadEof(storageFileReadIo(file)), true, " eof");
|
||||
TEST_RESULT_BOOL(ioReadEof(storageFileReadIo(file)), true, " still eof");
|
||||
TEST_RESULT_BOOL(ioReadEof(storageReadIo(file)), true, " eof");
|
||||
TEST_RESULT_BOOL(ioReadEof(storageReadIo(file)), true, " still eof");
|
||||
|
||||
TEST_RESULT_VOID(ioReadClose(storageFileReadIo(file)), " close file");
|
||||
TEST_RESULT_VOID(ioReadClose(storageReadIo(file)), " close file");
|
||||
|
||||
TEST_RESULT_VOID(storageFileReadFree(storageNewReadNP(storageTest, fileName)), " free file");
|
||||
TEST_RESULT_VOID(storageFileReadFree(NULL), " free null file");
|
||||
TEST_RESULT_VOID(storageFileReadDriverPosixFree(NULL), " free null posix file");
|
||||
TEST_RESULT_VOID(storageReadFree(storageNewReadNP(storageTest, fileName)), " free file");
|
||||
TEST_RESULT_VOID(storageReadFree(NULL), " free null file");
|
||||
TEST_RESULT_VOID(storageReadPosixFree(NULL), " free null posix file");
|
||||
|
||||
TEST_RESULT_VOID(storageFileReadMove(NULL, memContextTop()), " move null file");
|
||||
TEST_RESULT_VOID(storageReadMove(NULL, memContextTop()), " move null file");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("StorageFileWrite"))
|
||||
if (testBegin("StorageWrite"))
|
||||
{
|
||||
TEST_CREATE_NOPERM();
|
||||
StorageFileWrite *file = NULL;
|
||||
StorageWrite *file = NULL;
|
||||
|
||||
TEST_ASSIGN(
|
||||
file,
|
||||
@ -905,19 +905,19 @@ testRun(void)
|
||||
.noSyncPath = true, .noAtomic = true),
|
||||
"new write file");
|
||||
|
||||
TEST_RESULT_BOOL(storageFileWriteAtomic(file), false, " check atomic");
|
||||
TEST_RESULT_BOOL(storageFileWriteCreatePath(file), false, " check create path");
|
||||
TEST_RESULT_PTR(storageFileWriteFileDriver(file), file->driver, " check file driver");
|
||||
TEST_RESULT_INT(storageFileWriteModeFile(file), 0444, " check mode file");
|
||||
TEST_RESULT_INT(storageFileWriteModePath(file), 0555, " check mode path");
|
||||
TEST_RESULT_STR(strPtr(storageFileWriteName(file)), strPtr(fileNoPerm), " check name");
|
||||
TEST_RESULT_BOOL(storageFileWriteSyncPath(file), false, " check sync path");
|
||||
TEST_RESULT_BOOL(storageFileWriteSyncFile(file), false, " check sync file");
|
||||
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(strPtr(storageWriteName(file)), strPtr(fileNoPerm), " check name");
|
||||
TEST_RESULT_BOOL(storageWriteSyncPath(file), false, " check sync path");
|
||||
TEST_RESULT_BOOL(storageWriteSyncFile(file), false, " check sync file");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ASSIGN(file, storageNewWriteP(storageTest, fileNoPerm, .noAtomic = true), "new write file");
|
||||
TEST_ERROR_FMT(
|
||||
ioWriteOpen(storageFileWriteIo(file)), FileOpenError,
|
||||
ioWriteOpen(storageWriteIo(file)), FileOpenError,
|
||||
"unable to open '%s' for write: [13] Permission denied", strPtr(fileNoPerm));
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -925,7 +925,7 @@ testRun(void)
|
||||
|
||||
TEST_ASSIGN(file, storageNewWriteP(storageTest, fileName, .noCreatePath = true, .noAtomic = true), "new write file");
|
||||
TEST_ERROR_FMT(
|
||||
ioWriteOpen(storageFileWriteIo(file)), FileMissingError,
|
||||
ioWriteOpen(storageWriteIo(file)), FileMissingError,
|
||||
"unable to open '%s' for write: [2] No such file or directory", strPtr(fileName));
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -934,63 +934,63 @@ testRun(void)
|
||||
const Buffer *buffer = BUFSTRDEF("TESTFILE\n");
|
||||
|
||||
TEST_ASSIGN(file, storageNewWriteNP(storageTest, fileName), "new write file");
|
||||
TEST_RESULT_STR(strPtr(storageFileWriteName(file)), strPtr(fileName), " check file name");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageFileWriteIo(file)), " open file");
|
||||
TEST_RESULT_STR(strPtr(storageWriteName(file)), strPtr(fileName), " check file name");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(file)), " open file");
|
||||
|
||||
// Close the file handle so operations will fail
|
||||
close(((StorageFileWriteDriverPosix *)file->driver)->handle);
|
||||
close(((StorageWritePosix *)file->driver)->handle);
|
||||
storageRemoveP(storageTest, fileTmp, .errorOnMissing = true);
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageFileWriteDriverPosix(storageFileWriteFileDriver(file), buffer), FileWriteError,
|
||||
storageWritePosix(storageWriteDriver(file), buffer), FileWriteError,
|
||||
"unable to write '%s.pgbackrest.tmp': [9] Bad file descriptor", strPtr(fileName));
|
||||
TEST_ERROR_FMT(
|
||||
storageFileWriteDriverPosixClose(storageFileWriteFileDriver(file)), FileSyncError,
|
||||
storageWritePosixClose(storageWriteDriver(file)), FileSyncError,
|
||||
"unable to sync '%s.pgbackrest.tmp': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
// Disable file sync so close() can be reached
|
||||
((StorageFileWriteDriverPosix *)file->driver)->interface.syncFile = false;
|
||||
((StorageWritePosix *)file->driver)->interface.syncFile = false;
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageFileWriteDriverPosixClose(storageFileWriteFileDriver(file)), FileCloseError,
|
||||
storageWritePosixClose(storageWriteDriver(file)), FileCloseError,
|
||||
"unable to close '%s.pgbackrest.tmp': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
// Set file handle to -1 so the close on free with not fail
|
||||
((StorageFileWriteDriverPosix *)file->driver)->handle = -1;
|
||||
((StorageWritePosix *)file->driver)->handle = -1;
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ASSIGN(file, storageNewWriteNP(storageTest, fileName), "new write file");
|
||||
TEST_RESULT_STR(strPtr(storageFileWriteName(file)), strPtr(fileName), " check file name");
|
||||
TEST_RESULT_STR(strPtr(storageFileWriteType(file)), "posix", " check file type");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageFileWriteIo(file)), " open file");
|
||||
TEST_RESULT_STR(strPtr(storageWriteName(file)), strPtr(fileName), " check file name");
|
||||
TEST_RESULT_STR(strPtr(storageWriteType(file)), "posix", " check file type");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(file)), " open file");
|
||||
|
||||
// Rename the file back to original name from tmp -- this will cause the rename in close to fail
|
||||
TEST_RESULT_INT(rename(strPtr(fileTmp), strPtr(fileName)), 0, " rename tmp file");
|
||||
TEST_ERROR_FMT(
|
||||
ioWriteClose(storageFileWriteIo(file)), FileMoveError,
|
||||
ioWriteClose(storageWriteIo(file)), FileMoveError,
|
||||
"unable to move '%s' to '%s': [2] No such file or directory", strPtr(fileTmp), strPtr(fileName));
|
||||
|
||||
// Set file handle to -1 so the close on free with not fail
|
||||
((StorageFileWriteDriverPosix *)file->driver)->handle = -1;
|
||||
((StorageWritePosix *)file->driver)->handle = -1;
|
||||
|
||||
storageRemoveP(storageTest, fileName, .errorOnMissing = true);
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
TEST_ASSIGN(file, storageFileWriteMove(storageNewWriteNP(storageTest, fileName), MEM_CONTEXT_OLD()), "new write file");
|
||||
TEST_ASSIGN(file, storageWriteMove(storageNewWriteNP(storageTest, fileName), MEM_CONTEXT_OLD()), "new write file");
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageFileWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWrite(storageFileWriteIo(file), NULL), " write null buffer to file");
|
||||
TEST_RESULT_VOID(ioWrite(storageFileWriteIo(file), bufNew(0)), " write zero buffer to file");
|
||||
TEST_RESULT_VOID(ioWrite(storageFileWriteIo(file), buffer), " write to file");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageFileWriteIo(file)), " close file");
|
||||
TEST_RESULT_VOID(storageFileWriteFree(storageNewWriteNP(storageTest, fileName)), " free file");
|
||||
TEST_RESULT_VOID(storageFileWriteFree(NULL), " free null file");
|
||||
TEST_RESULT_VOID(storageFileWriteDriverPosixFree(NULL), " free null posix file");
|
||||
TEST_RESULT_VOID(storageFileWriteMove(NULL, memContextTop()), " move null file");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWrite(storageWriteIo(file), NULL), " write null buffer to file");
|
||||
TEST_RESULT_VOID(ioWrite(storageWriteIo(file), bufNew(0)), " write zero buffer to file");
|
||||
TEST_RESULT_VOID(ioWrite(storageWriteIo(file), buffer), " write to file");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageWriteIo(file)), " close file");
|
||||
TEST_RESULT_VOID(storageWriteFree(storageNewWriteNP(storageTest, fileName)), " free file");
|
||||
TEST_RESULT_VOID(storageWriteFree(NULL), " free null file");
|
||||
TEST_RESULT_VOID(storageWritePosixFree(NULL), " free null posix file");
|
||||
TEST_RESULT_VOID(storageWriteMove(NULL, memContextTop()), " move null file");
|
||||
|
||||
Buffer *expectedBuffer = storageGetNP(storageNewReadNP(storageTest, fileName));
|
||||
TEST_RESULT_BOOL(bufEq(buffer, expectedBuffer), true, " check file contents");
|
||||
@ -1008,9 +1008,9 @@ testRun(void)
|
||||
storageTest, fileName, .modePath = 0700, .modeFile = 0600, .noSyncPath = true, .noSyncFile = true,
|
||||
.noAtomic = true),
|
||||
"new write file");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageFileWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWrite(storageFileWriteIo(file), buffer), " write to file");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageFileWriteIo(file)), " close file");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(file)), " open file");
|
||||
TEST_RESULT_VOID(ioWrite(storageWriteIo(file), buffer), " write to file");
|
||||
TEST_RESULT_VOID(ioWriteClose(storageWriteIo(file)), " close file");
|
||||
|
||||
expectedBuffer = storageGetNP(storageNewReadNP(storageTest, fileName));
|
||||
TEST_RESULT_BOOL(bufEq(buffer, expectedBuffer), true, " check file contents");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Test Remote Storage Driver
|
||||
Test Remote Storage
|
||||
***********************************************************************************************************************************/
|
||||
#include "common/io/bufferRead.h"
|
||||
#include "common/io/bufferWrite.h"
|
||||
@ -15,7 +15,7 @@ testRun(void)
|
||||
FUNCTION_HARNESS_VOID();
|
||||
|
||||
// Test storage
|
||||
Storage *storageTest = storageDriverPosixNew(
|
||||
Storage *storageTest = storagePosixNew(
|
||||
strNew(testPath()), STORAGE_MODE_FILE_DEFAULT, STORAGE_MODE_PATH_DEFAULT, true, NULL);
|
||||
|
||||
// Load configuration to set repo-path and stanza
|
||||
@ -59,7 +59,7 @@ testRun(void)
|
||||
varLstAdd(paramList, varNewStr(strNew("test.txt")));
|
||||
|
||||
TEST_RESULT_BOOL(
|
||||
storageDriverRemoteProtocol(PROTOCOL_COMMAND_STORAGE_EXISTS_STR, paramList, server), true, "protocol exists");
|
||||
storageRemoteProtocol(PROTOCOL_COMMAND_STORAGE_EXISTS_STR, paramList, server), true, "protocol exists");
|
||||
TEST_RESULT_STR(strPtr(strNewBuf(serverWrite)), "{\"out\":true}\n", "check result");
|
||||
|
||||
bufUsedSet(serverWrite, 0);
|
||||
@ -91,14 +91,14 @@ testRun(void)
|
||||
varLstAdd(paramList, varNewBool(false));
|
||||
varLstAdd(paramList, varNewStr(strNew("^testy$")));
|
||||
|
||||
TEST_RESULT_BOOL(storageDriverRemoteProtocol(PROTOCOL_COMMAND_STORAGE_LIST_STR, paramList, server), true, "protocol list");
|
||||
TEST_RESULT_BOOL(storageRemoteProtocol(PROTOCOL_COMMAND_STORAGE_LIST_STR, paramList, server), true, "protocol list");
|
||||
TEST_RESULT_STR(strPtr(strNewBuf(serverWrite)), "{\"out\":[\"testy\"]}\n", "check result");
|
||||
|
||||
bufUsedSet(serverWrite, 0);
|
||||
|
||||
// Check invalid protocol function
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_RESULT_BOOL(storageDriverRemoteProtocol(strNew(BOGUS_STR), paramList, server), false, "invalid function");
|
||||
TEST_RESULT_BOOL(storageRemoteProtocol(strNew(BOGUS_STR), paramList, server), false, "invalid function");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
@ -125,22 +125,22 @@ testRun(void)
|
||||
|
||||
storagePutNP(storageNewWriteNP(storageTest, strNew("repo/test.txt")), contentBuf);
|
||||
|
||||
StorageFileRead *fileRead = NULL;
|
||||
StorageRead *fileRead = NULL;
|
||||
|
||||
ioBufferSizeSet(8193);
|
||||
TEST_ASSIGN(fileRead, storageNewReadNP(storageRemote, strNew("test.txt")), "new file");
|
||||
TEST_RESULT_BOOL(bufEq(storageGetNP(fileRead), contentBuf), true, "get file");
|
||||
TEST_RESULT_BOOL(storageFileReadIgnoreMissing(fileRead), false, "check ignore missing");
|
||||
TEST_RESULT_STR(strPtr(storageFileReadName(fileRead)), "test.txt", "check name");
|
||||
TEST_RESULT_BOOL(storageReadIgnoreMissing(fileRead), false, "check ignore missing");
|
||||
TEST_RESULT_STR(strPtr(storageReadName(fileRead)), "test.txt", "check name");
|
||||
TEST_RESULT_SIZE(
|
||||
storageFileReadDriverRemote(storageFileReadDriver(fileRead), bufNew(32), false), 0,
|
||||
storageReadRemote(storageRead(fileRead), bufNew(32), false), 0,
|
||||
"nothing more to read");
|
||||
|
||||
TEST_RESULT_BOOL(
|
||||
bufEq(storageGetNP(storageNewReadNP(storageRemote, strNew("test.txt"))), contentBuf), true, "get file again");
|
||||
|
||||
TEST_ERROR(
|
||||
storageDriverRemoteProtocolBlockSize(strNew("bogus")), ProtocolError, "'bogus' is not a valid block size message");
|
||||
storageRemoteProtocolBlockSize(strNew("bogus")), ProtocolError, "'bogus' is not a valid block size message");
|
||||
|
||||
// Check protocol function directly (file missing)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -149,7 +149,7 @@ testRun(void)
|
||||
varLstAdd(paramList, varNewBool(true));
|
||||
|
||||
TEST_RESULT_BOOL(
|
||||
storageDriverRemoteProtocol(PROTOCOL_COMMAND_STORAGE_OPEN_READ_STR, paramList, server), true,
|
||||
storageRemoteProtocol(PROTOCOL_COMMAND_STORAGE_OPEN_READ_STR, paramList, server), true,
|
||||
"protocol open read (missing)");
|
||||
TEST_RESULT_STR(strPtr(strNewBuf(serverWrite)), "{\"out\":false}\n", "check result");
|
||||
|
||||
@ -165,7 +165,7 @@ testRun(void)
|
||||
varLstAdd(paramList, varNewBool(false));
|
||||
|
||||
TEST_RESULT_BOOL(
|
||||
storageDriverRemoteProtocol(PROTOCOL_COMMAND_STORAGE_OPEN_READ_STR, paramList, server), true, "protocol open read");
|
||||
storageRemoteProtocol(PROTOCOL_COMMAND_STORAGE_OPEN_READ_STR, paramList, server), true, "protocol open read");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strNewBuf(serverWrite)),
|
||||
"{\"out\":true}\n"
|
||||
@ -199,23 +199,23 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
ioBufferSizeSet(9999);
|
||||
|
||||
StorageFileWrite *write = NULL;
|
||||
StorageWrite *write = NULL;
|
||||
TEST_ASSIGN(write, storageNewWriteNP(storageRemote, strNew("test.txt")), "new write file");
|
||||
|
||||
TEST_RESULT_BOOL(storageFileWriteAtomic(write), true, "write is atomic");
|
||||
TEST_RESULT_BOOL(storageFileWriteCreatePath(write), true, "path will be created");
|
||||
TEST_RESULT_UINT(storageFileWriteModeFile(write), STORAGE_MODE_FILE_DEFAULT, "file mode is default");
|
||||
TEST_RESULT_UINT(storageFileWriteModePath(write), STORAGE_MODE_PATH_DEFAULT, "path mode is default");
|
||||
TEST_RESULT_STR(strPtr(storageFileWriteName(write)), "test.txt", "check file name");
|
||||
TEST_RESULT_BOOL(storageFileWriteSyncFile(write), true, "file is synced");
|
||||
TEST_RESULT_BOOL(storageFileWriteSyncPath(write), true, "path is synced");
|
||||
TEST_RESULT_BOOL(storageWriteAtomic(write), true, "write is atomic");
|
||||
TEST_RESULT_BOOL(storageWriteCreatePath(write), true, "path will be created");
|
||||
TEST_RESULT_UINT(storageWriteModeFile(write), STORAGE_MODE_FILE_DEFAULT, "file mode is default");
|
||||
TEST_RESULT_UINT(storageWriteModePath(write), STORAGE_MODE_PATH_DEFAULT, "path mode is default");
|
||||
TEST_RESULT_STR(strPtr(storageWriteName(write)), "test.txt", "check file name");
|
||||
TEST_RESULT_BOOL(storageWriteSyncFile(write), true, "file is synced");
|
||||
TEST_RESULT_BOOL(storageWriteSyncPath(write), true, "path is synced");
|
||||
|
||||
TEST_RESULT_VOID(storagePutNP(write, contentBuf), "write file");
|
||||
TEST_RESULT_VOID(
|
||||
storageFileWriteDriverRemoteClose((StorageFileWriteDriverRemote *)storageFileWriteFileDriver(write)),
|
||||
storageWriteRemoteClose((StorageWriteRemote *)storageWriteDriver(write)),
|
||||
"close file again");
|
||||
TEST_RESULT_VOID(
|
||||
storageFileWriteDriverRemoteFree((StorageFileWriteDriverRemote *)storageFileWriteFileDriver(write)),
|
||||
storageWriteRemoteFree((StorageWriteRemote *)storageWriteDriver(write)),
|
||||
"free file");
|
||||
|
||||
// Make sure the file was written correctly
|
||||
@ -226,13 +226,13 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_ASSIGN(write, storageNewWriteNP(storageRemote, strNew("test2.txt")), "new write file");
|
||||
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageFileWriteIo(write)), "open file");
|
||||
TEST_RESULT_VOID(ioWrite(storageFileWriteIo(write), contentBuf), "write bytes");
|
||||
TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(write)), "open file");
|
||||
TEST_RESULT_VOID(ioWrite(storageWriteIo(write), contentBuf), "write bytes");
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
storageFileWriteDriverRemoteFree((StorageFileWriteDriverRemote *)storageFileWriteFileDriver(write)),
|
||||
storageWriteRemoteFree((StorageWriteRemote *)storageWriteDriver(write)),
|
||||
"free file");
|
||||
TEST_RESULT_VOID(storageFileWriteDriverRemoteFree(NULL), "free null file");
|
||||
TEST_RESULT_VOID(storageWriteRemoteFree(NULL), "free null file");
|
||||
|
||||
TEST_RESULT_UINT(
|
||||
storageInfoNP(storageTest, strNew("repo/test2.txt.pgbackrest.tmp")).size, 16384, "file exists and is partial");
|
||||
@ -264,7 +264,7 @@ testRun(void)
|
||||
"ABCBRBLOCK-1\n"));
|
||||
|
||||
TEST_RESULT_BOOL(
|
||||
storageDriverRemoteProtocol(PROTOCOL_COMMAND_STORAGE_OPEN_WRITE_STR, paramList, server), true, "protocol open write");
|
||||
storageRemoteProtocol(PROTOCOL_COMMAND_STORAGE_OPEN_WRITE_STR, paramList, server), true, "protocol open write");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strNewBuf(serverWrite)),
|
||||
"{}\n"
|
||||
@ -294,7 +294,7 @@ testRun(void)
|
||||
varLstAdd(paramList, varNewBool(true));
|
||||
|
||||
TEST_RESULT_BOOL(
|
||||
storageDriverRemoteProtocol(PROTOCOL_COMMAND_STORAGE_OPEN_WRITE_STR, paramList, server), true, "protocol open write");
|
||||
storageRemoteProtocol(PROTOCOL_COMMAND_STORAGE_OPEN_WRITE_STR, paramList, server), true, "protocol open write");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(strNewBuf(serverWrite)),
|
||||
"{}\n"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***********************************************************************************************************************************
|
||||
Test S3 Storage Driver
|
||||
Test S3 Storage
|
||||
***********************************************************************************************************************************/
|
||||
#include <unistd.h>
|
||||
|
||||
@ -86,7 +86,7 @@ testS3Server(void)
|
||||
harnessTlsServerInit(TLS_TEST_PORT, TLS_CERT_TEST_CERT, TLS_CERT_TEST_KEY);
|
||||
harnessTlsServerAccept();
|
||||
|
||||
// storageDriverS3NewRead() and StorageDriverS3FileRead
|
||||
// storageS3NewRead() and StorageS3FileRead
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
// Ignore missing file
|
||||
harnessTlsServerExpect(testS3ServerRequest(HTTP_VERB_GET, "/fi%26le.txt", NULL));
|
||||
@ -104,7 +104,7 @@ testS3Server(void)
|
||||
harnessTlsServerExpect(testS3ServerRequest(HTTP_VERB_GET, "/file.txt", NULL));
|
||||
harnessTlsServerReply(testS3ServerResponse(303, "Some bad status", NULL, "CONTENT"));
|
||||
|
||||
// storageDriverS3NewWrite() and StorageFileWriteDriverS3
|
||||
// storageS3NewWrite() and StorageWriteS3
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
// File is written all at once
|
||||
harnessTlsServerExpect(testS3ServerRequest(HTTP_VERB_PUT, "/file.txt", "ABCD"));
|
||||
@ -331,7 +331,7 @@ testRun(void)
|
||||
"qr7ZD0u0iPPkUL64lIZbqBAz+scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==");
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("storageDriverS3New() and storageRepoGet()"))
|
||||
if (testBegin("storageS3New() and storageRepoGet()"))
|
||||
{
|
||||
// Only required options
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -351,15 +351,15 @@ testRun(void)
|
||||
Storage *storage = NULL;
|
||||
TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_S3), false), "get S3 repo storage");
|
||||
TEST_RESULT_STR(strPtr(storage->path), strPtr(path), " check path");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->bucket), strPtr(bucket), " check bucket");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->region), strPtr(region), " check region");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->bucket), strPtr(bucket), " check bucket");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->region), strPtr(region), " check region");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(((StorageDriverS3 *)storage->driver)->host), strPtr(strNewFmt("%s.%s", strPtr(bucket), strPtr(endPoint))),
|
||||
strPtr(((StorageS3 *)storage->driver)->host), strPtr(strNewFmt("%s.%s", strPtr(bucket), strPtr(endPoint))),
|
||||
" check host");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->accessKey), strPtr(accessKey), " check access key");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->accessKey), strPtr(accessKey), " check access key");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(((StorageDriverS3 *)storage->driver)->secretAccessKey), strPtr(secretAccessKey), " check secret access key");
|
||||
TEST_RESULT_PTR(((StorageDriverS3 *)storage->driver)->securityToken, NULL, " check security token");
|
||||
strPtr(((StorageS3 *)storage->driver)->secretAccessKey), strPtr(secretAccessKey), " check secret access key");
|
||||
TEST_RESULT_PTR(((StorageS3 *)storage->driver)->securityToken, NULL, " check security token");
|
||||
|
||||
// Add default options
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -381,15 +381,15 @@ testRun(void)
|
||||
harnessCfgLoad(strLstSize(argList), strLstPtr(argList));
|
||||
|
||||
TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_S3), false), "get S3 repo storage with options");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->bucket), strPtr(bucket), " check bucket");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->region), strPtr(region), " check region");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->host), strPtr(host), " check host");
|
||||
TEST_RESULT_UINT(((StorageDriverS3 *)storage->driver)->port, 443, " check port");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->accessKey), strPtr(accessKey), " check access key");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->bucket), strPtr(bucket), " check bucket");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->region), strPtr(region), " check region");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->host), strPtr(host), " check host");
|
||||
TEST_RESULT_UINT(((StorageS3 *)storage->driver)->port, 443, " check port");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->accessKey), strPtr(accessKey), " check access key");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(((StorageDriverS3 *)storage->driver)->secretAccessKey), strPtr(secretAccessKey), " check secret access key");
|
||||
strPtr(((StorageS3 *)storage->driver)->secretAccessKey), strPtr(secretAccessKey), " check secret access key");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(((StorageDriverS3 *)storage->driver)->securityToken), strPtr(securityToken), " check security token");
|
||||
strPtr(((StorageS3 *)storage->driver)->securityToken), strPtr(securityToken), " check security token");
|
||||
|
||||
// Add a port to the endpoint
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -410,15 +410,15 @@ testRun(void)
|
||||
harnessCfgLoad(strLstSize(argList), strLstPtr(argList));
|
||||
|
||||
TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_S3), false), "get S3 repo storage with options");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->bucket), strPtr(bucket), " check bucket");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->region), strPtr(region), " check region");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->host), strPtr(strNewFmt("%s.%s", strPtr(bucket), strPtr(endPoint))), " check host");
|
||||
TEST_RESULT_UINT(((StorageDriverS3 *)storage->driver)->port, 999, " check port");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->accessKey), strPtr(accessKey), " check access key");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->bucket), strPtr(bucket), " check bucket");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->region), strPtr(region), " check region");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->host), strPtr(strNewFmt("%s.%s", strPtr(bucket), strPtr(endPoint))), " check host");
|
||||
TEST_RESULT_UINT(((StorageS3 *)storage->driver)->port, 999, " check port");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->accessKey), strPtr(accessKey), " check access key");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(((StorageDriverS3 *)storage->driver)->secretAccessKey), strPtr(secretAccessKey), " check secret access key");
|
||||
strPtr(((StorageS3 *)storage->driver)->secretAccessKey), strPtr(secretAccessKey), " check secret access key");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(((StorageDriverS3 *)storage->driver)->securityToken), strPtr(securityToken), " check security token");
|
||||
strPtr(((StorageS3 *)storage->driver)->securityToken), strPtr(securityToken), " check security token");
|
||||
|
||||
// Also add port to the host
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -440,25 +440,25 @@ testRun(void)
|
||||
harnessCfgLoad(strLstSize(argList), strLstPtr(argList));
|
||||
|
||||
TEST_ASSIGN(storage, storageRepoGet(strNew(STORAGE_TYPE_S3), false), "get S3 repo storage with options");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->bucket), strPtr(bucket), " check bucket");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->region), strPtr(region), " check region");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->host), strPtr(host), " check host");
|
||||
TEST_RESULT_UINT(((StorageDriverS3 *)storage->driver)->port, 7777, " check port");
|
||||
TEST_RESULT_STR(strPtr(((StorageDriverS3 *)storage->driver)->accessKey), strPtr(accessKey), " check access key");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->bucket), strPtr(bucket), " check bucket");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->region), strPtr(region), " check region");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->host), strPtr(host), " check host");
|
||||
TEST_RESULT_UINT(((StorageS3 *)storage->driver)->port, 7777, " check port");
|
||||
TEST_RESULT_STR(strPtr(((StorageS3 *)storage->driver)->accessKey), strPtr(accessKey), " check access key");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(((StorageDriverS3 *)storage->driver)->secretAccessKey), strPtr(secretAccessKey), " check secret access key");
|
||||
strPtr(((StorageS3 *)storage->driver)->secretAccessKey), strPtr(secretAccessKey), " check secret access key");
|
||||
TEST_RESULT_STR(
|
||||
strPtr(((StorageDriverS3 *)storage->driver)->securityToken), strPtr(securityToken), " check security token");
|
||||
strPtr(((StorageS3 *)storage->driver)->securityToken), strPtr(securityToken), " check security token");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("storageDriverS3DateTime() and storageDriverS3Auth()"))
|
||||
if (testBegin("storageS3DateTime() and storageS3Auth()"))
|
||||
{
|
||||
TEST_RESULT_STR(strPtr(storageDriverS3DateTime(1491267845)), "20170404T010405Z", "static date");
|
||||
TEST_RESULT_STR(strPtr(storageS3DateTime(1491267845)), "20170404T010405Z", "static date");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
StorageDriverS3 *driver = (StorageDriverS3 *)storageDriver(
|
||||
storageDriverS3New(
|
||||
StorageS3 *driver = (StorageS3 *)storageDriver(
|
||||
storageS3New(
|
||||
path, true, NULL, bucket, endPoint, region, accessKey, secretAccessKey, NULL, 16, NULL, 0, 0, true, NULL, NULL));
|
||||
|
||||
HttpHeader *header = httpHeaderNew(NULL);
|
||||
@ -467,7 +467,7 @@ testRun(void)
|
||||
httpQueryAdd(query, strNew("list-type"), strNew("2"));
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
storageDriverS3Auth(
|
||||
storageS3Auth(
|
||||
driver, strNew("GET"), strNew("/"), query, strNew("20170606T121212Z"), header,
|
||||
strNew("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")),
|
||||
"generate authorization");
|
||||
@ -482,7 +482,7 @@ testRun(void)
|
||||
const Buffer *lastSigningKey = driver->signingKey;
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
storageDriverS3Auth(
|
||||
storageS3Auth(
|
||||
driver, strNew("GET"), strNew("/"), query, strNew("20170606T121212Z"), header,
|
||||
strNew("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")),
|
||||
"generate authorization");
|
||||
@ -496,7 +496,7 @@ testRun(void)
|
||||
|
||||
// Change the date to generate a new signing key
|
||||
TEST_RESULT_VOID(
|
||||
storageDriverS3Auth(
|
||||
storageS3Auth(
|
||||
driver, strNew("GET"), strNew("/"), query, strNew("20180814T080808Z"), header,
|
||||
strNew("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")),
|
||||
" generate authorization");
|
||||
@ -510,13 +510,13 @@ testRun(void)
|
||||
|
||||
// Test with security token
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
driver = (StorageDriverS3 *)storageDriver(
|
||||
storageDriverS3New(
|
||||
driver = (StorageS3 *)storageDriver(
|
||||
storageS3New(
|
||||
path, true, NULL, bucket, endPoint, region, accessKey, secretAccessKey, securityToken, 16, NULL, 0, 0, true, NULL,
|
||||
NULL));
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
storageDriverS3Auth(
|
||||
storageS3Auth(
|
||||
driver, strNew("GET"), strNew("/"), query, strNew("20170606T121212Z"), header,
|
||||
strNew("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")),
|
||||
"generate authorization");
|
||||
@ -529,11 +529,11 @@ testRun(void)
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("storageDriverS3*(), StorageDriverS3FileRead, and StorageFileWriteDriverS3"))
|
||||
if (testBegin("storageS3*(), StorageS3FileRead, and StorageWriteS3"))
|
||||
{
|
||||
testS3Server();
|
||||
|
||||
Storage *s3 = storageDriverS3New(
|
||||
Storage *s3 = storageS3New(
|
||||
path, true, NULL, bucket, endPoint, region, accessKey, secretAccessKey, NULL, 16, host, port, 1000, true, NULL, NULL);
|
||||
|
||||
// Coverage for noop functions
|
||||
@ -541,7 +541,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(storagePathCreateNP(s3, strNew("path")), "path create is a noop");
|
||||
TEST_RESULT_VOID(storagePathSyncNP(s3, strNew("path")), "path sync is a noop");
|
||||
|
||||
// storageDriverS3NewRead() and StorageDriverS3FileRead
|
||||
// storageS3NewRead() and StorageS3FileRead
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_RESULT_PTR(
|
||||
storageGetNP(storageNewReadP(s3, strNew("fi&le.txt"), .ignoreMissing = true)), NULL, "ignore missing file");
|
||||
@ -552,13 +552,13 @@ testRun(void)
|
||||
strPtr(strNewBuf(storageGetNP(storageNewReadNP(s3, strNew("file.txt"))))), "this is a sample file",
|
||||
"get file");
|
||||
|
||||
StorageFileRead *read = NULL;
|
||||
StorageRead *read = NULL;
|
||||
TEST_ASSIGN(read, storageNewReadP(s3, strNew("file.txt"), .ignoreMissing = true), "new read file");
|
||||
TEST_RESULT_BOOL(storageFileReadIgnoreMissing(read), true, " check ignore missing");
|
||||
TEST_RESULT_STR(strPtr(storageFileReadName(read)), "/file.txt", " check name");
|
||||
TEST_RESULT_BOOL(storageReadIgnoreMissing(read), true, " check ignore missing");
|
||||
TEST_RESULT_STR(strPtr(storageReadName(read)), "/file.txt", " check name");
|
||||
|
||||
TEST_ERROR(
|
||||
ioReadOpen(storageFileReadIo(read)), ProtocolError,
|
||||
ioReadOpen(storageReadIo(read)), ProtocolError,
|
||||
"S3 request failed with 303: Some bad status\n"
|
||||
"*** URI/Query ***:\n"
|
||||
"/file.txt\n"
|
||||
@ -573,23 +573,23 @@ testRun(void)
|
||||
"*** Response Content ***:\n"
|
||||
"CONTENT")
|
||||
|
||||
// storageDriverS3NewWrite() and StorageFileWriteDriverS3
|
||||
// storageS3NewWrite() and StorageWriteS3
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
// File is written all at once
|
||||
StorageFileWrite *write = NULL;
|
||||
StorageWrite *write = NULL;
|
||||
TEST_ASSIGN(write, storageNewWriteNP(s3, strNew("file.txt")), "new write file");
|
||||
TEST_RESULT_VOID(storagePutNP(write, BUFSTRDEF("ABCD")), "put file all at once");
|
||||
|
||||
TEST_RESULT_BOOL(storageFileWriteAtomic(write), true, "write is atomic");
|
||||
TEST_RESULT_BOOL(storageFileWriteCreatePath(write), true, "path will be created");
|
||||
TEST_RESULT_UINT(storageFileWriteModeFile(write), 0, "file mode is 0");
|
||||
TEST_RESULT_UINT(storageFileWriteModePath(write), 0, "path mode is 0");
|
||||
TEST_RESULT_STR(strPtr(storageFileWriteName(write)), "/file.txt", "check file name");
|
||||
TEST_RESULT_BOOL(storageFileWriteSyncFile(write), true, "file is synced");
|
||||
TEST_RESULT_BOOL(storageFileWriteSyncPath(write), true, "path is synced");
|
||||
TEST_RESULT_BOOL(storageWriteAtomic(write), true, "write is atomic");
|
||||
TEST_RESULT_BOOL(storageWriteCreatePath(write), true, "path will be created");
|
||||
TEST_RESULT_UINT(storageWriteModeFile(write), 0, "file mode is 0");
|
||||
TEST_RESULT_UINT(storageWriteModePath(write), 0, "path mode is 0");
|
||||
TEST_RESULT_STR(strPtr(storageWriteName(write)), "/file.txt", "check file name");
|
||||
TEST_RESULT_BOOL(storageWriteSyncFile(write), true, "file is synced");
|
||||
TEST_RESULT_BOOL(storageWriteSyncPath(write), true, "path is synced");
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
storageFileWriteDriverS3Close((StorageFileWriteDriverS3 *)storageFileWriteFileDriver(write)),
|
||||
storageWriteS3Close((StorageWriteS3 *)storageWriteDriver(write)),
|
||||
"close file again");
|
||||
|
||||
// Zero-length file
|
||||
|
Reference in New Issue
Block a user