aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/cache/httpstructuredcache.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-03-06 17:27:59 +0100
committerStefan Boberg <[email protected]>2025-03-06 17:27:59 +0100
commit66e5d1f4e288e0c32f854ebe3b63584b42b83554 (patch)
treed67e9d358419b5baccd429d54988414e0d7cd7a6 /src/zenserver/cache/httpstructuredcache.cpp
parentreduced memory churn using fixed_xxx containers (#236) (diff)
downloadzen-66e5d1f4e288e0c32f854ebe3b63584b42b83554.tar.xz
zen-66e5d1f4e288e0c32f854ebe3b63584b42b83554.zip
switched std::vector -> eastl::vector
Diffstat (limited to 'src/zenserver/cache/httpstructuredcache.cpp')
-rw-r--r--src/zenserver/cache/httpstructuredcache.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp
index b9a9ca380..2f7a74f25 100644
--- a/src/zenserver/cache/httpstructuredcache.cpp
+++ b/src/zenserver/cache/httpstructuredcache.cpp
@@ -150,15 +150,15 @@ HttpStructuredCacheService::ScrubStorage(ScrubContext& Ctx)
void
HttpStructuredCacheService::HandleDetailsRequest(HttpServerRequest& Request)
{
- std::string_view Key = Request.RelativeUri();
- std::vector<std::string> Tokens;
- uint32_t TokenCount = ForEachStrTok(Key, '/', [&Tokens](std::string_view Token) {
- Tokens.push_back(std::string(Token));
- return true;
- });
- std::string FilterNamespace;
- std::string FilterBucket;
- std::string FilterValue;
+ std::string_view Key = Request.RelativeUri();
+ eastl::vector<std::string> Tokens;
+ uint32_t TokenCount = ForEachStrTok(Key, '/', [&Tokens](std::string_view Token) {
+ Tokens.push_back(std::string(Token));
+ return true;
+ });
+ std::string FilterNamespace;
+ std::string FilterBucket;
+ std::string FilterValue;
switch (TokenCount)
{
case 1:
@@ -543,7 +543,7 @@ HttpStructuredCacheService::HandleCacheRequest(HttpServerRequest& Request)
}
ResponseWriter.EndObject();
- std::sort(begin(Info.NamespaceNames), end(Info.NamespaceNames), [](std::string_view L, std::string_view R) {
+ std::sort(Info.NamespaceNames.begin(), Info.NamespaceNames.end(), [](std::string_view L, std::string_view R) {
return L.compare(R) < 0;
});
ResponseWriter.BeginArray("Namespaces");
@@ -602,7 +602,7 @@ HttpStructuredCacheService::HandleCacheNamespaceRequest(HttpServerRequest& Reque
}
ResponseWriter.EndObject();
- std::sort(begin(Info->BucketNames), end(Info->BucketNames), [](std::string_view L, std::string_view R) {
+ std::sort(Info->BucketNames.begin(), Info->BucketNames.end(), [](std::string_view L, std::string_view R) {
return L.compare(R) < 0;
});
@@ -628,7 +628,7 @@ HttpStructuredCacheService::HandleCacheNamespaceRequest(HttpServerRequest& Reque
ResponseWriter.BeginArray("Buckets");
- std::vector<std::string> BucketNames;
+ eastl::vector<std::string> BucketNames;
if (Buckets == "*") // Get all - empty FieldFilter equal getting all fields
{
BucketNames = Info.value().BucketNames;
@@ -640,8 +640,8 @@ HttpStructuredCacheService::HandleCacheNamespaceRequest(HttpServerRequest& Reque
return true;
});
}
- WorkerThreadPool& WorkerPool = GetMediumWorkerPool(EWorkloadType::Background);
- std::vector<IoHash> AllAttachments;
+ WorkerThreadPool& WorkerPool = GetMediumWorkerPool(EWorkloadType::Background);
+ eastl::vector<IoHash> AllAttachments;
for (const std::string& BucketName : BucketNames)
{
ResponseWriter.BeginObject();
@@ -1005,13 +1005,13 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con
CbPackage Package;
if (Package.TryLoad(ClientResultValue.Value))
{
- CbObject CacheRecord = Package.GetObject();
- AttachmentCount Count;
- size_t NumAttachments = Package.GetAttachments().size();
- std::vector<IoHash> ReferencedAttachments;
- std::vector<IoBuffer> WriteAttachmentBuffers;
+ CbObject CacheRecord = Package.GetObject();
+ AttachmentCount Count;
+ size_t NumAttachments = Package.GetAttachments().size();
+ eastl::vector<IoHash> ReferencedAttachments;
+ eastl::vector<IoBuffer> WriteAttachmentBuffers;
WriteAttachmentBuffers.reserve(NumAttachments);
- std::vector<IoHash> WriteRawHashes;
+ eastl::vector<IoHash> WriteRawHashes;
WriteRawHashes.reserve(NumAttachments);
CacheRecord.IterateAttachments([this,
@@ -1093,7 +1093,7 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con
if (!WriteAttachmentBuffers.empty())
{
- std::vector<CidStore::InsertResult> InsertResults =
+ eastl::vector<CidStore::InsertResult> InsertResults =
m_CidStore.AddChunks(WriteAttachmentBuffers, WriteRawHashes);
for (const CidStore::InsertResult& Result : InsertResults)
{
@@ -1264,10 +1264,10 @@ HttpStructuredCacheService::HandlePutCacheRecord(HttpServerRequest& Request, con
Body.SetContentType(ZenContentType::kCbObject);
- CbObjectView CacheRecord(Body.Data());
- std::vector<IoHash> ValidAttachments;
- std::vector<IoHash> ReferencedAttachments;
- int32_t TotalCount = 0;
+ CbObjectView CacheRecord(Body.Data());
+ eastl::vector<IoHash> ValidAttachments;
+ eastl::vector<IoHash> ReferencedAttachments;
+ int32_t TotalCount = 0;
CacheRecord.IterateAttachments([this, &TotalCount, &ValidAttachments, &ReferencedAttachments](CbFieldView AttachmentHash) {
const IoHash Hash = AttachmentHash.AsHash();
@@ -1323,13 +1323,13 @@ HttpStructuredCacheService::HandlePutCacheRecord(HttpServerRequest& Request, con
CbObject CacheRecord = Package.GetObject();
- AttachmentCount Count;
- size_t NumAttachments = Package.GetAttachments().size();
- std::vector<IoHash> ValidAttachments;
- std::vector<IoHash> ReferencedAttachments;
+ AttachmentCount Count;
+ size_t NumAttachments = Package.GetAttachments().size();
+ eastl::vector<IoHash> ValidAttachments;
+ eastl::vector<IoHash> ReferencedAttachments;
ValidAttachments.reserve(NumAttachments);
- std::vector<IoBuffer> WriteAttachmentBuffers;
- std::vector<IoHash> WriteRawHashes;
+ eastl::vector<IoBuffer> WriteAttachmentBuffers;
+ eastl::vector<IoHash> WriteRawHashes;
WriteAttachmentBuffers.reserve(NumAttachments);
WriteRawHashes.reserve(NumAttachments);
@@ -1380,7 +1380,7 @@ HttpStructuredCacheService::HandlePutCacheRecord(HttpServerRequest& Request, con
if (!WriteAttachmentBuffers.empty())
{
- std::vector<CidStore::InsertResult> InsertResults = m_CidStore.AddChunks(WriteAttachmentBuffers, WriteRawHashes);
+ eastl::vector<CidStore::InsertResult> InsertResults = m_CidStore.AddChunks(WriteAttachmentBuffers, WriteRawHashes);
for (const CidStore::InsertResult& InsertResult : InsertResults)
{
if (InsertResult.New)