aboutsummaryrefslogtreecommitdiff
path: root/zenstore/chunkbundler.h
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore/chunkbundler.h')
-rw-r--r--zenstore/chunkbundler.h105
1 files changed, 0 insertions, 105 deletions
diff --git a/zenstore/chunkbundler.h b/zenstore/chunkbundler.h
deleted file mode 100644
index d8913aec6..000000000
--- a/zenstore/chunkbundler.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include <zencore/zencore.h>
-
-#include <zenstore/basicfile.h>
-#include <zenstore/cas.h>
-#include <zenstore/caslog.h>
-#include <zenstore/gc.h>
-
-#include <atomic>
-#include <unordered_map>
-
-namespace spdlog {
-class logger;
-}
-
-namespace zen {
-
-class ChunkBundlerValidator
-{
-public:
- virtual bool ValidateChunk(IoBuffer Buffer, IoHash Key) = 0;
-};
-
-#pragma pack(push)
-#pragma pack(1)
-
-struct CompactDiskLocation
-{
- uint16_t BlockIndex;
- uint32_t Offset;
- uint32_t Size;
-};
-
-struct CompactDiskIndexEntry
-{
- static const uint8_t kTombstone = 0x01;
-
- IoHash Key;
- CompactDiskLocation Location;
- ZenContentType ContentType = ZenContentType::kUnknownContentType;
- uint8_t Flags = 0;
-};
-
-#pragma pack(pop)
-
-static_assert(sizeof(CompactDiskIndexEntry) == 32);
-
-class ChunkBundler final
-{
-public:
- ChunkBundler(std::filesystem::path RootDirectory, ChunkBundlerValidator* Validator);
- ~ChunkBundler();
-
- struct InsertResult
- {
- bool New = false;
- };
-
- void Initialize(const std::string_view ContainerBaseName, uint64_t MaxBlockSize, uint64_t Alignment, bool IsNewStore);
- InsertResult InsertChunk(const void* ChunkData, size_t ChunkSize, const IoHash& ChunkHash);
- InsertResult InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash);
- IoBuffer FindChunk(const IoHash& ChunkHash);
- bool HaveChunk(const IoHash& ChunkHash);
- void FilterChunks(CasChunkSet& InOutChunks);
- void Flush();
- void Scrub(ScrubContext& Ctx);
- void CollectGarbage(GcContext& GcCtx);
- GcStorageSize StorageSize() const;
-
-private:
- spdlog::logger& Log() { return m_Log; }
-
- ChunkBundlerValidator* m_Validator;
- spdlog::logger& m_Log;
- uint64_t m_PayloadAlignment = 1 << 4;
- uint64_t m_MaxBlockSize = 1L << 30; // 1 Gb
- bool m_IsInitialized = false;
- std::filesystem::path RootDirectory;
- TCasLogFile<CompactDiskIndexEntry> m_OpLog;
- std::filesystem::path m_RootDirectory;
- std::string m_ContainerBaseName;
-
- RwLock m_LocationMapLock;
- std::unordered_map<IoHash, CompactDiskLocation, IoHash::Hasher> m_LocationMap;
- std::unordered_map<uint16_t, std::shared_ptr<BasicFile>> m_OpenBlocks;
- uint16_t m_CurrentBlockIndex = 0;
-
- RwLock m_InsertLock; // used to serialize inserts
- std::weak_ptr<BasicFile> m_CurrentBlock;
- std::atomic_uint32_t m_CurrentInsertOffset{};
-
- std::atomic_uint64_t m_CurrentIndexOffset{};
- std::atomic_uint64_t m_TotalSize{};
-
- void MakeIndexSnapshot();
-};
-
-//////////////////////////////////////////////////////////////////////////
-
-void chunkbundler_forcelink();
-
-} // namespace zen