aboutsummaryrefslogtreecommitdiff
path: root/src/zenremotestore/projectstore/zenremoteprojectstore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenremotestore/projectstore/zenremoteprojectstore.cpp')
-rw-r--r--src/zenremotestore/projectstore/zenremoteprojectstore.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/zenremotestore/projectstore/zenremoteprojectstore.cpp b/src/zenremotestore/projectstore/zenremoteprojectstore.cpp
index ab82edbef..b4c1156ac 100644
--- a/src/zenremotestore/projectstore/zenremoteprojectstore.cpp
+++ b/src/zenremotestore/projectstore/zenremoteprojectstore.cpp
@@ -249,7 +249,18 @@ public:
return GetKnownBlocksResult{{.ErrorCode = static_cast<int>(HttpResponseCode::NoContent)}};
}
- virtual LoadAttachmentResult LoadAttachment(const IoHash& RawHash) override
+ virtual GetBlockDescriptionsResult GetBlockDescriptions(std::span<const IoHash> BlockHashes) override
+ {
+ ZEN_UNUSED(BlockHashes);
+ return GetBlockDescriptionsResult{Result{.ErrorCode = int(HttpResponseCode::NotFound)}};
+ }
+
+ virtual AttachmentExistsInCacheResult AttachmentExistsInCache(std::span<const IoHash> RawHashes) override
+ {
+ return AttachmentExistsInCacheResult{Result{.ErrorCode = 0}, std::vector<bool>(RawHashes.size(), false)};
+ }
+
+ virtual LoadAttachmentResult LoadAttachment(const IoHash& RawHash, const AttachmentRange& Range) override
{
std::string LoadRequest = fmt::format("/{}/oplog/{}/{}"sv, m_Project, m_Oplog, RawHash);
HttpClient::Response Response =
@@ -257,12 +268,7 @@ public:
AddStats(Response);
LoadAttachmentResult Result = LoadAttachmentResult{ConvertResult(Response)};
- if (!Result.ErrorCode)
- {
- Result.Bytes = Response.ResponsePayload;
- Result.Bytes.MakeOwned();
- }
- if (!Result.ErrorCode)
+ if (Result.ErrorCode)
{
Result.Reason = fmt::format("Failed fetching oplog attachment from {}/{}/{}/{}. Reason: '{}'",
m_ProjectStoreUrl,
@@ -271,6 +277,15 @@ public:
RawHash,
Result.Reason);
}
+ if (!Result.ErrorCode && Range)
+ {
+ Result.Bytes = IoBuffer(Response.ResponsePayload, Range.Offset, Range.Bytes);
+ }
+ else
+ {
+ Result.Bytes = Response.ResponsePayload;
+ }
+ Result.Bytes.MakeOwned();
return Result;
}