diff options
| author | Dan Engelbrecht <[email protected]> | 2024-03-22 10:12:42 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-03-22 10:12:42 +0100 |
| commit | f45f810fb1961d1cc5dfe57569010f623193b641 (patch) | |
| tree | be6e2fb949afa6f1cc302a02f8f29d771ff24bc7 /src/zenserver/projectstore/jupiterremoteprojectstore.cpp | |
| parent | disable partial getcachechunk responses (#19) (diff) | |
| download | zen-f45f810fb1961d1cc5dfe57569010f623193b641.tar.xz zen-f45f810fb1961d1cc5dfe57569010f623193b641.zip | |
check existance of reused blocks (#18)
* Add HasAttachments to RemoteProjectStore so we can query if attachment blocks actually exist
* use individual requests for compressed blob check in Jupiter
* remove weird 1000.5 to 1000.0 when converting seconds to milliseconds
Diffstat (limited to 'src/zenserver/projectstore/jupiterremoteprojectstore.cpp')
| -rw-r--r-- | src/zenserver/projectstore/jupiterremoteprojectstore.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/zenserver/projectstore/jupiterremoteprojectstore.cpp b/src/zenserver/projectstore/jupiterremoteprojectstore.cpp index 418c2aa84..b288a667c 100644 --- a/src/zenserver/projectstore/jupiterremoteprojectstore.cpp +++ b/src/zenserver/projectstore/jupiterremoteprojectstore.cpp @@ -132,6 +132,53 @@ public: return LoadContainer(m_OptionalBaseKey); } + virtual HasAttachmentsResult HasAttachments(const std::span<IoHash> RawHashes) override + { + CloudCacheSession Session(m_CloudClient.Get()); + const bool UseBatchRequest = + false; // The batch request API in Jupiter is currently broken so we have to resort to individual cheks + + if (UseBatchRequest) + { + CloudCacheExistsResult ExistsResult = Session.BlobExists(m_Namespace, std::set<IoHash>(RawHashes.begin(), RawHashes.end())); + HasAttachmentsResult Result{ConvertResult(ExistsResult), + std::unordered_set<IoHash, IoHash::Hasher>(ExistsResult.Needs.begin(), ExistsResult.Needs.end())}; + if (ExistsResult.ErrorCode) + { + Result.Reason = fmt::format("Failed checking attachment existance in {}/{}. Reason: '{}'", + m_CloudClient->ServiceUrl(), + m_Namespace, + Result.Reason); + } + return Result; + } + else + { + Stopwatch Timer; + HasAttachmentsResult Result; + for (const IoHash& RawHash : RawHashes) + { + CloudCacheResult ExistsResult = Session.CompressedBlobExists(m_Namespace, RawHash); + if (ExistsResult.ErrorCode) + { + Result = {ConvertResult(ExistsResult)}; + Result.Reason = fmt::format("Failed checking oplog attachment existance {}/{}/{}. Reason: '{}'", + m_CloudClient->ServiceUrl(), + m_Namespace, + RawHash, + Result.Reason); + return Result; + } + if (!ExistsResult.Success) + { + Result.Needs.insert(RawHash); + } + } + Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.0; + return Result; + } + } + virtual LoadAttachmentResult LoadAttachment(const IoHash& RawHash) override { CloudCacheSession Session(m_CloudClient.Get()); |