diff options
| author | Dan Engelbrecht <[email protected]> | 2024-03-14 16:50:18 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-03-14 16:50:18 +0100 |
| commit | 0a935231009cb21680d364ef125f0296a5a5bed6 (patch) | |
| tree | 7e55a67ae60883b0eab71a0d636aeec23f307d14 /src/zenstore/include | |
| parent | clean up test linking (#4) (diff) | |
| download | zen-0a935231009cb21680d364ef125f0296a5a5bed6.tar.xz zen-0a935231009cb21680d364ef125f0296a5a5bed6.zip | |
special treatment large oplog attachments v2 (#5)
- Bugfix: Install Ctrl+C handler earlier when doing `zen oplog-export` and `zen oplog-export` to properly cancel jobs
- Improvement: Add ability to block a set of CAS entries from GC in project store
- Improvement: Large attachments and loose files are now split into smaller chunks and stored in blocks during oplog export
Diffstat (limited to 'src/zenstore/include')
| -rw-r--r-- | src/zenstore/include/zenstore/chunkedfile.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/zenstore/include/zenstore/chunkedfile.h b/src/zenstore/include/zenstore/chunkedfile.h new file mode 100644 index 000000000..c6330bdbd --- /dev/null +++ b/src/zenstore/include/zenstore/chunkedfile.h @@ -0,0 +1,54 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + +#include <zencore/iobuffer.h> +#include <zencore/iohash.h> +#include <zencore/zencore.h> + +#include <functional> +#include <vector> + +namespace zen { + +class BasicFile; + +struct ChunkedInfo +{ + uint64_t RawSize = 0; + IoHash RawHash; + std::vector<uint32_t> ChunkSequence; + std::vector<IoHash> ChunkHashes; +}; + +struct ChunkSource +{ + uint64_t Offset; // 8 + uint32_t Size; // 4 +}; + +struct ChunkedInfoWithSource +{ + ChunkedInfo Info; + std::vector<ChunkSource> ChunkSources; +}; + +struct ChunkedParams +{ + bool UseThreshold = true; + size_t MinSize = (2u * 1024u) - 128u; + size_t MaxSize = (16u * 1024u); + size_t AvgSize = (3u * 1024u); +}; + +static const ChunkedParams UShaderByteCodeParams = {.UseThreshold = true, .MinSize = 17280, .MaxSize = 139264, .AvgSize = 36340}; + +ChunkedInfoWithSource ChunkData(BasicFile& RawData, uint64_t Offset, uint64_t Size, ChunkedParams Params = {}); +void Reconstruct(const ChunkedInfo& Info, + const std::filesystem::path& TargetPath, + std::function<IoBuffer(const IoHash& ChunkHash)> GetChunk); +IoBuffer SerializeChunkedInfo(const ChunkedInfo& Info); +ChunkedInfo DeserializeChunkedInfo(IoBuffer& Buffer); + +void chunkedfile_forcelink(); +} // namespace zen |