From 26134d49cc2b5174cbee1ce0b8c1b023f5e451eb Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 24 Aug 2023 12:38:51 +0200 Subject: Add `--embedloosefiles` option to `oplog-export` (#376) * Add `--embedloosefiles` option to `oplog-export` which adds loose files to the export, removing need to call `oplog-snapshot` * Retain `ServerPath` in oplog when performing `oplog-snapshot`. This is a short-term fix for current incompatability with the UE cooker. --- src/zenserver/projectstore/projectstore.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/zenserver/projectstore/projectstore.cpp') diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index 06d5221c4..c37b8c8d4 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -2322,13 +2322,15 @@ ProjectStore::ReadOplog(const std::string_view ProjectId, RemoteProjectStore::LoadContainerResult ContainerResult = BuildContainer( ChunkStore, + *Project.Get(), *Oplog, MaxBlockSize, MaxChunkEmbedSize, false, [](CompressedBuffer&&, const IoHash) {}, [](const IoHash&) {}, - [](const std::unordered_set) {}); + [](const std::unordered_set) {}, + nullptr); OutResponse = std::move(ContainerResult.ContainerObject); return ConvertResult(ContainerResult); @@ -2569,7 +2571,7 @@ ProjectStore::Rpc(HttpServerRequest& HttpReq, Oid ChunkId = View["id"sv].AsObjectId(); IoBuffer FileIoBuffer = DataFile.ReadAll(); - CompressedBuffer Compressed = CompressedBuffer::Compress(SharedBuffer(FileIoBuffer)); + 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(); @@ -2592,12 +2594,6 @@ ProjectStore::Rpc(HttpServerRequest& HttpReq, // omit this field as we will write it explicitly ourselves return true; } - else if (Field.GetName() == "serverpath"sv) - { - // omit this field as it's not relevant if there is a hash - return true; - } - return false; }); Writer.AddBinaryAttachment("data"sv, RawHash); @@ -2688,6 +2684,7 @@ ProjectStore::Export(ProjectStore::Project& Project, ProjectStore::Oplog& Oplog, size_t MaxBlockSize = Params["maxblocksize"sv].AsUInt64(128u * 1024u * 1024u); size_t MaxChunkEmbedSize = Params["maxchunkembedsize"sv].AsUInt64(1024u * 1024u); bool Force = Params["force"sv].AsBool(false); + bool EmbedLooseFile = Params["embedloosefiles"sv].AsBool(false); std::pair, std::string> RemoteStoreResult = CreateRemoteStore(Params, AuthManager, MaxBlockSize, MaxChunkEmbedSize); @@ -2708,9 +2705,11 @@ ProjectStore::Export(ProjectStore::Project& Project, ProjectStore::Oplog& Oplog, RemoteProjectStore::Result Result = SaveOplog(m_CidStore, *RemoteStore, + Project, Oplog, MaxBlockSize, MaxChunkEmbedSize, + EmbedLooseFile, StoreInfo.CreateBlocks, StoreInfo.UseTempBlockFiles, Force); -- cgit v1.2.3