aboutsummaryrefslogtreecommitdiff
path: root/zenstore/compactcas.h
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore/compactcas.h')
-rw-r--r--zenstore/compactcas.h39
1 files changed, 33 insertions, 6 deletions
diff --git a/zenstore/compactcas.h b/zenstore/compactcas.h
index 8f7c0213b..a3f3121e6 100644
--- a/zenstore/compactcas.h
+++ b/zenstore/compactcas.h
@@ -23,17 +23,42 @@ namespace zen {
struct CasDiskLocation
{
- uint64_t Offset;
- // If we wanted to be able to store larger chunks using this storage mechanism then
- // we could make this more like the IoStore index so we can store larger chunks.
- // I.e use five bytes for size and seven for offset
- uint32_t Size;
+ CasDiskLocation(uint64_t InOffset, uint64_t InSize)
+ {
+ ZEN_ASSERT(InOffset <= 0xff'ffff'ffff);
+ ZEN_ASSERT(InSize <= 0xff'ffff'ffff);
+
+ memcpy(&m_Offset[0], &InOffset, sizeof m_Offset);
+ memcpy(&m_Size[0], &InSize, sizeof m_Size);
+ }
+
+ CasDiskLocation() = default;
+
+ inline uint64_t GetOffset() const
+ {
+ uint64_t Offset = 0;
+ memcpy(&Offset, &m_Offset, sizeof m_Offset);
+ return Offset;
+ }
+
+ inline uint64_t GetSize() const
+ {
+ uint64_t Size = 0;
+ memcpy(&Size, &m_Size, sizeof m_Size);
+ return Size;
+ }
+
+private:
+ uint8_t m_Offset[5];
+ uint8_t m_Size[5];
};
struct CasDiskIndexEntry
{
IoHash Key;
CasDiskLocation Location;
+ ZenContentType ContentType = ZenContentType::kUnknownContentType;
+ uint8_t Flags = 0;
};
#pragma pack(pop)
@@ -61,7 +86,7 @@ struct CasContainerStrategy
void Initialize(const std::string_view ContainerBaseName, uint64_t Alignment, bool IsNewStore);
void Flush();
void Scrub(ScrubContext& Ctx);
- void GarbageCollect(GcContext& GcCtx);
+ void CollectGarbage(GcContext& GcCtx);
private:
const CasStoreConfiguration& m_Config;
@@ -81,4 +106,6 @@ private:
void MakeSnapshot();
};
+void compactcas_forcelink();
+
} // namespace zen