diff options
Diffstat (limited to 'src/zenserver/projectstore/projectstore.cpp')
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index 6ca43af0e..184376c39 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -574,8 +574,7 @@ ProjectStore::Oplog::ReplayLog() { return; } - m_Storage->ReplayLog( - [&](CbObject Op, const OplogEntry& OpEntry) { RegisterOplogEntry(OplogLock, GetMapping(Op), OpEntry, kUpdateReplay); }); + m_Storage->ReplayLog([&](CbObject Op, const OplogEntry& OpEntry) { RegisterOplogEntry(OplogLock, GetMapping(Op), OpEntry); }); } IoBuffer @@ -774,21 +773,20 @@ ProjectStore::Oplog::AddFileMapping(const RwLock::ExclusiveLockScope&, std::string_view ServerPath, std::string_view ClientPath) { + FileMapEntry Entry; + if (Hash != IoHash::Zero) { m_ChunkMap.insert_or_assign(FileId, Hash); } + else + { + Entry.ServerPath = ServerPath; + } - FileMapEntry Entry; - Entry.ServerPath = ServerPath; Entry.ClientPath = ClientPath; m_FileMap[FileId] = std::move(Entry); - - if (Hash != IoHash::Zero) - { - m_ChunkMap.insert_or_assign(FileId, Hash); - } } void @@ -858,8 +856,7 @@ ProjectStore::Oplog::GetMapping(CbObject Core) Oid Id = FileObj["id"sv].AsObjectId(); IoHash Hash = FileObj["data"sv].AsBinaryAttachment(); - Result.Files.emplace_back( - OplogEntryMapping::FileMapping{OplogEntryMapping::Mapping{Id, Hash}, std::string(ServerPath), std::string(ClientPath)}); + Result.Files.emplace_back(OplogEntryMapping::FileMapping{Id, Hash, std::string(ServerPath), std::string(ClientPath)}); ZEN_DEBUG("file {} -> {}, ServerPath: {}, ClientPath: {}", Id, Hash, ServerPath, ClientPath); } @@ -881,13 +878,10 @@ ProjectStore::Oplog::GetMapping(CbObject Core) uint32_t ProjectStore::Oplog::RegisterOplogEntry(RwLock::ExclusiveLockScope& OplogLock, const OplogEntryMapping& OpMapping, - const OplogEntry& OpEntry, - UpdateType TypeOfUpdate) + const OplogEntry& OpEntry) { ZEN_TRACE_CPU("ProjectStore::Oplog::RegisterOplogEntry"); - ZEN_UNUSED(TypeOfUpdate); - // For now we're assuming the update is all in-memory so we can hold an exclusive lock without causing // too many problems. Longer term we'll probably want to ensure we can do concurrent updates however @@ -986,7 +980,7 @@ ProjectStore::Oplog::AppendNewOplogEntry(CbObject Core) const OplogEntry OpEntry = m_Storage->AppendOp(Buffer, OpCoreHash, KeyHash); RwLock::ExclusiveLockScope OplogLock(m_OplogLock); - const uint32_t EntryId = RegisterOplogEntry(OplogLock, Mapping, OpEntry, kUpdateNewEntry); + const uint32_t EntryId = RegisterOplogEntry(OplogLock, Mapping, OpEntry); return EntryId; } @@ -1904,7 +1898,7 @@ ProjectStore::GetProjectFiles(const std::string_view ProjectId, const std::strin Response.BeginObject(); Response << "id"sv << Id; Response << "clientpath"sv << ClientPath; - if (!FilterClient) + if (!FilterClient && !ServerPath.empty()) { Response << "serverpath"sv << ServerPath; } @@ -2519,6 +2513,11 @@ ProjectStore::Rpc(HttpServerRequest& HttpReq, 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; }); |