aboutsummaryrefslogtreecommitdiff
path: root/zenserver/projectstore.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-06-09 12:18:48 +0200
committerStefan Boberg <[email protected]>2021-06-09 12:18:48 +0200
commit7a6df2c78120be6a436138d8abc7341cad6fa627 (patch)
treedd83ba80e688fe58d589f1daffeb07664996a34a /zenserver/projectstore.cpp
parentAdded initial implementation of chunk batch API (diff)
downloadzen-7a6df2c78120be6a436138d8abc7341cad6fa627.tar.xz
zen-7a6df2c78120be6a436138d8abc7341cad6fa627.zip
Fixed issue with ProjectStore::OplogStorage::Exists()
It would always return false, which was caused by earlier removal of the .zdb files
Diffstat (limited to 'zenserver/projectstore.cpp')
-rw-r--r--zenserver/projectstore.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/zenserver/projectstore.cpp b/zenserver/projectstore.cpp
index 32592d7a8..b331f262a 100644
--- a/zenserver/projectstore.cpp
+++ b/zenserver/projectstore.cpp
@@ -73,8 +73,7 @@ struct ProjectStore::OplogStorage : public RefCounted
[[nodiscard]] bool Exists() { return Exists(m_OplogStoragePath); }
[[nodiscard]] static bool Exists(std::filesystem::path BasePath)
{
- return std::filesystem::exists(BasePath / "ops.zlog") && std::filesystem::exists(BasePath / "ops.zdb") &&
- std::filesystem::exists(BasePath / "ops.zops");
+ return std::filesystem::exists(BasePath / "ops.zlog") && std::filesystem::exists(BasePath / "ops.zops");
}
static bool Delete(std::filesystem::path BasePath) { return DeleteDirectories(BasePath); }
@@ -692,6 +691,7 @@ ProjectStore::OpenProject(std::string_view ProjectId)
Log().info("opening project {} @ {}", ProjectId, ProjectBasePath);
ProjectStore::Project& Prj = m_Projects.try_emplace(std::string{ProjectId}, this, m_CasStore, ProjectBasePath).first->second;
+ Prj.Identifier = ProjectId;
Prj.Read();
return &Prj;
}
@@ -849,7 +849,7 @@ HttpProjectService::HttpProjectService(CasStore& Store, ProjectStore* Projects)
for (uint32_t ChunkIndex = 0; ChunkIndex < RequestHdr.ChunkCount; ++ChunkIndex)
{
const RequestChunkEntry& RequestedChunk = RequestedChunks[ChunkIndex];
- IoBuffer FoundChunk = FoundLog->FindChunk(RequestedChunk.ChunkId);
+ IoBuffer FoundChunk = FoundLog->FindChunk(RequestedChunk.ChunkId);
if (FoundChunk)
{
if (RequestedChunk.Offset > 0 || RequestedChunk.RequestBytes < uint64_t(-1))
@@ -869,7 +869,7 @@ HttpProjectService::HttpProjectService(CasStore& Store, ProjectStore* Projects)
}
OutBlobs.emplace_back(std::move(FoundChunk));
}
- uint8_t* ResponsePtr = reinterpret_cast<uint8_t*>(OutBlobs[0].MutableData());
+ uint8_t* ResponsePtr = reinterpret_cast<uint8_t*>(OutBlobs[0].MutableData());
ResponseHeader ResponseHdr;
ResponseHdr.ChunkCount = RequestHdr.ChunkCount;
memcpy(ResponsePtr, &ResponseHdr, sizeof(ResponseHdr));
@@ -877,8 +877,8 @@ HttpProjectService::HttpProjectService(CasStore& Store, ProjectStore* Projects)
for (uint32_t ChunkIndex = 0; ChunkIndex < RequestHdr.ChunkCount; ++ChunkIndex)
{
const RequestChunkEntry& RequestedChunk = RequestedChunks[ChunkIndex];
- const IoBuffer& FoundChunk(OutBlobs[ChunkIndex + 1]);
- ResponseChunkEntry ResponseChunk;
+ const IoBuffer& FoundChunk(OutBlobs[ChunkIndex + 1]);
+ ResponseChunkEntry ResponseChunk;
ResponseChunk.CorrelationId = ChunkIndex;
if (FoundChunk)
{
@@ -891,7 +891,7 @@ HttpProjectService::HttpProjectService(CasStore& Store, ProjectStore* Projects)
memcpy(ResponsePtr, &ResponseChunk, sizeof(ResponseChunk));
ResponsePtr += sizeof(ResponseChunk);
}
-
+
return HttpReq.WriteResponse(HttpResponse::OK, HttpContentType::kBinary, OutBlobs);
},
HttpVerb::kPost);