aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/projectstore/projectstore.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenserver/projectstore/projectstore.h')
-rw-r--r--src/zenserver/projectstore/projectstore.h62
1 files changed, 19 insertions, 43 deletions
diff --git a/src/zenserver/projectstore/projectstore.h b/src/zenserver/projectstore/projectstore.h
index 77aa32681..258be5930 100644
--- a/src/zenserver/projectstore/projectstore.h
+++ b/src/zenserver/projectstore/projectstore.h
@@ -3,10 +3,10 @@
#pragma once
#include <zencore/compactbinarybuilder.h>
+#include <zencore/compactbinarypackage.h>
#include <zencore/compositebuffer.h>
#include <zencore/uid.h>
#include <zencore/xxhash.h>
-#include <zenhttp/httpserver.h>
#include <zenstore/gc.h>
ZEN_THIRD_PARTY_INCLUDES_START
@@ -14,16 +14,13 @@ ZEN_THIRD_PARTY_INCLUDES_START
ZEN_THIRD_PARTY_INCLUDES_END
#include <map>
-#include <unordered_map>
+#include <variant>
namespace zen {
-class CbPackage;
class CidStore;
class AuthMgr;
class ScrubContext;
-class JobQueue;
-class OpenProcessCache;
/** Project Store
@@ -46,12 +43,7 @@ public:
{
};
- ProjectStore(CidStore& Store,
- std::filesystem::path BasePath,
- GcManager& Gc,
- JobQueue& JobQueue,
- OpenProcessCache& InOpenProcessCache,
- const Configuration& Config);
+ ProjectStore(CidStore& Store, std::filesystem::path BasePath, GcManager& Gc, const Configuration& Config);
~ProjectStore();
struct LogSequenceNumber
@@ -518,41 +510,27 @@ public:
bool PutChunk(Project& Project, Oplog& Oplog, const IoHash& ChunkHash, IoBuffer&& Chunk);
- struct WriteOplogResult
+ struct ChunkRequest
{
- int32_t ErrorCode = 0;
- std::string ErrorDescription;
- std::vector<IoHash> Need;
+ uint64_t Offset = 0;
+ uint64_t Size = (uint64_t)-1;
+ std::variant<IoHash, Oid> Id;
+ std::optional<uint64_t> ModTag;
+ bool SkipData = false;
};
- WriteOplogResult WriteOplog(Project& Project, Oplog& Oplog, const CbObject& ContainerObject);
-
- struct ReadOplogResult
+ struct ChunkResult
{
- int32_t ErrorCode = 0;
- std::string ErrorDescription;
- CbObject ContainerObject;
+ bool Exists = false;
+ IoBuffer ChunkBuffer;
+ uint64_t ModTag = 0;
};
- ReadOplogResult ReadOplog(Project& Project,
- Oplog& Oplog,
- size_t MaxBlockSize,
- size_t MaxChunkEmbedSize,
- size_t MaxChunksPerBlock,
- size_t ChunkFileSizeLimit);
-
- std::pair<HttpResponseCode, std::string> GetChunks(const std::string_view ProjectId,
- const std::string_view OplogId,
- const CbObject& RequestObject,
- CbPackage& OutResponsePackage);
-
- bool Rpc(HttpServerRequest& HttpReq,
- const std::string_view ProjectId,
- const std::string_view OplogId,
- IoBuffer&& Payload,
- AuthMgr& AuthManager);
-
- std::pair<HttpResponseCode, std::string> Export(Ref<Project> Project, Oplog& Oplog, CbObjectView&& Params, AuthMgr& AuthManager);
+ std::vector<ChunkResult> GetChunks(Project& Project, Oplog& Oplog, std::span<const ChunkRequest> Requests);
- std::pair<HttpResponseCode, std::string> Import(Project& Project, Oplog& Oplog, CbObjectView&& Params, AuthMgr& AuthManager);
+ std::vector<ProjectStore::ChunkRequest> ParseChunksRequests(Project& Project, Oplog& Oplog, const CbObject& Cb);
+ CbPackage WriteChunksRequestResponse(Project& Project,
+ Oplog& Oplog,
+ std::vector<ChunkRequest>&& Requests,
+ std::vector<ChunkResult>&& Results);
bool AreDiskWritesAllowed() const;
@@ -564,8 +542,6 @@ private:
LoggerRef m_Log;
GcManager& m_Gc;
CidStore& m_CidStore;
- JobQueue& m_JobQueue;
- OpenProcessCache& m_OpenProcessCache;
std::filesystem::path m_ProjectBasePath;
const Configuration m_Config;
mutable RwLock m_ProjectsLock;