1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Clarifications of what limit == NULL or UINT64_MAX means.

This commit is contained in:
David Steele 2020-03-19 12:34:27 -04:00
parent 73315268fd
commit e5bcc0c47e
6 changed files with 18 additions and 6 deletions

View File

@ -83,6 +83,14 @@
<p>Improve performance of <code>MEM_CONTEXT*()</code> macros.</p> <p>Improve performance of <code>MEM_CONTEXT*()</code> macros.</p>
</release-item> </release-item>
<release-item>
<release-item-contributor-list>
<release-item-reviewer id="cynthia.shang"/>
</release-item-contributor-list>
<p>Allow storage reads to be limited by bytes.</p>
</release-item>
</release-development-list> </release-development-list>
</release-core-list> </release-core-list>
</release> </release>

View File

@ -29,7 +29,7 @@ typedef struct StorageReadPosix
int handle; int handle;
uint64_t current; // Current bytes read from file uint64_t current; // Current bytes read from file
uint64_t limit; // Limit bytes to be read from file uint64_t limit; // Limit bytes to be read from file (UINT64_MAX for no limit)
bool eof; bool eof;
} StorageReadPosix; } StorageReadPosix;
@ -221,7 +221,9 @@ storageReadPosixNew(StoragePosix *storage, const String *name, bool ignoreMissin
.storage = storage, .storage = storage,
.handle = -1, .handle = -1,
// Rather than enable/disable limit checking just always use a limit // Rather than enable/disable limit checking just use a big number when there is no limit. We can feel pretty confident
// that no files will be > UINT64_MAX in size. This is a copy of the interface limit but it simplifies the code during
// read so it seems worthwhile.
.limit = limit == NULL ? UINT64_MAX : varUInt64(limit), .limit = limit == NULL ? UINT64_MAX : varUInt64(limit),
.interface = (StorageReadInterface) .interface = (StorageReadInterface)

View File

@ -24,7 +24,7 @@ Getters
***********************************************************************************************************************************/ ***********************************************************************************************************************************/
IoRead *storageReadIo(const StorageRead *this); IoRead *storageReadIo(const StorageRead *this);
// Is there a read limit? // Is there a read limit? NULL for no limit.
const Variant *storageReadLimit(const StorageRead *this); const Variant *storageReadLimit(const StorageRead *this);
bool storageReadIgnoreMissing(const StorageRead *this); bool storageReadIgnoreMissing(const StorageRead *this);

View File

@ -17,7 +17,7 @@ typedef struct StorageReadInterface
bool compressible; // Is this file compressible? bool compressible; // Is this file compressible?
unsigned int compressLevel; // Level to use for compression unsigned int compressLevel; // Level to use for compression
bool ignoreMissing; bool ignoreMissing;
const Variant *limit; // Limit how many bytes are read const Variant *limit; // Limit how many bytes are read (NULL for no limit)
IoReadInterface ioInterface; IoReadInterface ioInterface;
} StorageReadInterface; } StorageReadInterface;

View File

@ -156,7 +156,9 @@ typedef struct StorageNewReadParam
VAR_PARAM_HEADER; VAR_PARAM_HEADER;
bool ignoreMissing; bool ignoreMissing;
bool compressible; bool compressible;
const Variant *limit; // Limit bytes to read from the file (must be varTypeUInt64)
// Limit bytes to read from the file (must be varTypeUInt64). NULL for no limit.
const Variant *limit;
} StorageNewReadParam; } StorageNewReadParam;
#define storageNewReadP(this, pathExp, ...) \ #define storageNewReadP(this, pathExp, ...) \

View File

@ -105,7 +105,7 @@ typedef struct StorageInterfaceNewReadParam
// helpful. // helpful.
bool compressible; bool compressible;
// Limit bytes read from the file // Limit bytes read from the file. NULL for no limit.
const Variant *limit; const Variant *limit;
} StorageInterfaceNewReadParam; } StorageInterfaceNewReadParam;