diff options
| author | Dan Engelbrecht <[email protected]> | 2024-11-06 09:36:19 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-11-06 09:36:19 +0100 |
| commit | 14e56014b2c4edd5b10f60679aa58dea8434eaf2 (patch) | |
| tree | fca95acdbceaedcfc3ccdaa2c9b947e0abf468ae /src/zenserver/projectstore/projectstore.cpp | |
| parent | project details cmd resolve prj oplog (#209) (diff) | |
| download | zen-14e56014b2c4edd5b10f60679aa58dea8434eaf2.tar.xz zen-14e56014b2c4edd5b10f60679aa58dea8434eaf2.zip | |
oplog capture new attachments for gc (#210)
* make sure we track added attachments properly in oplogs
Diffstat (limited to 'src/zenserver/projectstore/projectstore.cpp')
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index 25be159b9..7e03432d6 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -4242,6 +4242,7 @@ ProjectStore::PutChunk(const std::string_view ProjectId, return {HttpResponseCode::BadRequest, fmt::format("Chunk request for invalid payload format for chunk '{}'", Cid)}; } + FoundLog->CaptureAddedAttachments(std::vector<IoHash>{Hash}); CidStore::InsertResult Result = m_CidStore.AddChunk(Chunk, Hash); return {Result.New ? HttpResponseCode::Created : HttpResponseCode::OK, {}}; } @@ -4566,6 +4567,7 @@ ProjectStore::Rpc(HttpServerRequest& HttpReq, WriteRawHashes.push_back(RawHash); } + Oplog->CaptureAddedAttachments(WriteRawHashes); m_CidStore.AddChunks(WriteAttachmentBuffers, WriteRawHashes, CidStore::InsertMode::kCopyOnly); } HttpReq.WriteResponse(HttpResponseCode::OK); @@ -4628,13 +4630,14 @@ ProjectStore::Rpc(HttpServerRequest& HttpReq, { // Read file contents into memory, compress and store in CidStore - Oid ChunkId = View["id"sv].AsObjectId(); - IoBuffer FileIoBuffer = DataFile.ReadAll(); - CompressedBuffer Compressed = CompressedBuffer::Compress(SharedBuffer(std::move(FileIoBuffer))); - const IoHash RawHash = Compressed.DecodeRawHash(); - const uint64_t RawSize = Compressed.DecodeRawSize(); - IoBuffer CompressedBuffer = Compressed.GetCompressed().Flatten().AsIoBuffer(); - CidStore::InsertResult Result = m_CidStore.AddChunk(CompressedBuffer, RawHash); + Oid ChunkId = View["id"sv].AsObjectId(); + IoBuffer FileIoBuffer = DataFile.ReadAll(); + CompressedBuffer Compressed = CompressedBuffer::Compress(SharedBuffer(std::move(FileIoBuffer))); + const IoHash RawHash = Compressed.DecodeRawHash(); + const uint64_t RawSize = Compressed.DecodeRawSize(); + IoBuffer CompressedBuffer = Compressed.GetCompressed().Flatten().AsIoBuffer(); + Oplog->CaptureAddedAttachments(std::vector<IoHash>{RawHash}); + CidStore::InsertResult Result = m_CidStore.AddChunk(CompressedBuffer, RawHash); TotalBytes += RawSize; ++TotalFiles; |