aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-05-23 21:29:21 +0200
committerStefan Boberg <[email protected]>2021-05-23 21:29:21 +0200
commitd6c221e378813e47b29694c99296943b9f2a4fd8 (patch)
tree1661c1ca10354b85cd332c3a16e19d9b62b942ce /zenserver/cache/structuredcachestore.cpp
parentAdded IoBuffer::operator MemoryView for convenience (diff)
downloadzen-d6c221e378813e47b29694c99296943b9f2a4fd8.tar.xz
zen-d6c221e378813e47b29694c99296943b9f2a4fd8.zip
Implemented new URI addressing scheme for the Zen cache endpoints, and prepared for additional indexing capabilities
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
-rw-r--r--zenserver/cache/structuredcachestore.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index 3fd9f5ec4..59588af48 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -59,23 +59,14 @@ ZenCacheStore::Get(std::string_view InBucket, const zen::IoHash& HashKey, ZenCac
void
ZenCacheStore::Put(std::string_view InBucket, const zen::IoHash& HashKey, const ZenCacheValue& Value)
{
+ // Store value and index
+
if (Value.Value.Size() <= m_DiskLayerSizeThreshold)
{
m_MemLayer.Put(InBucket, HashKey, Value);
}
m_DiskLayer.Put(InBucket, HashKey, Value);
-
- if (Value.IsCompactBinary)
- {
- zen::CbObject Cbo(SharedBuffer(Value.Value));
-
- std::vector<IoHash> ReferencedChunks;
-
- Cbo.IterateAttachments([&](CbFieldView AttachmentView) { ReferencedChunks.push_back(AttachmentView.AsHash()); });
-
- // TODO: store references in index
- }
}
//////////////////////////////////////////////////////////////////////////
@@ -176,6 +167,7 @@ struct DiskLocation
{
uint64_t Offset;
uint32_t Size;
+ uint32_t IndexDataSize;
};
struct DiskIndexEntry
@@ -186,7 +178,7 @@ struct DiskIndexEntry
#pragma pack(pop)
-static_assert(sizeof(DiskIndexEntry) == 32);
+static_assert(sizeof(DiskIndexEntry) == 36);
struct ZenCacheDiskLayer::CacheBucket
{