diff options
| author | Stefan Boberg <[email protected]> | 2025-03-06 17:35:39 +0100 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2025-03-06 17:35:39 +0100 |
| commit | b044289e3c8fbc4eb4ffa5c1d96da51aa0a41f9b (patch) | |
| tree | a511dd945c87415fb5389e6579299095e3f3afc8 /src/zenserver/projectstore/projectstore.cpp | |
| parent | switched std::vector -> eastl::vector (diff) | |
| download | zen-sb/eastl.tar.xz zen-sb/eastl.zip | |
std::span -> eastl::spansb/eastl
Diffstat (limited to 'src/zenserver/projectstore/projectstore.cpp')
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index 0c0c942af..42158b729 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -572,7 +572,7 @@ struct ProjectStore::OplogStorage : public RefCounted } } - uint64_t GetEffectiveBlobsSize(std::span<const OplogEntryAddress> Addresses) const + uint64_t GetEffectiveBlobsSize(eastl::span<const OplogEntryAddress> Addresses) const { uint64_t EffectiveSize = 0; for (const OplogEntryAddress& Address : Addresses) @@ -583,7 +583,7 @@ struct ProjectStore::OplogStorage : public RefCounted } void Compact( - std::span<const uint32_t> LSNs, + eastl::span<const uint32_t> LSNs, std::function<void(const Oid& OpKeyHash, uint32_t OldLSN, uint32_t NewLSN, const OplogEntryAddress& NewAddress)>&& Callback, bool RetainLSNs, bool DryRun) @@ -901,7 +901,7 @@ struct ProjectStore::OplogStorage : public RefCounted InvalidEntries); } - void ReplayLogEntries(const std::span<OplogEntryAddress> Entries, std::function<void(CbObjectView)>&& Handler) + void ReplayLogEntries(const eastl::span<OplogEntryAddress> Entries, std::function<void(CbObjectView)>&& Handler) { ZEN_MEMSCOPE(GetProjectstoreTag()); ZEN_TRACE_CPU("Store::OplogStorage::ReplayLogEntries"); @@ -993,7 +993,7 @@ struct ProjectStore::OplogStorage : public RefCounted return Entry; } - eastl::vector<OplogEntry> AppendOps(std::span<const AppendOpData> Ops) + eastl::vector<OplogEntry> AppendOps(eastl::span<const AppendOpData> Ops) { ZEN_MEMSCOPE(GetProjectstoreTag()); ZEN_TRACE_CPU("Store::OplogStorage::AppendOps"); @@ -2087,7 +2087,7 @@ ProjectStore::Oplog::GetChunkByRawHash(const IoHash& RawHash) } bool -ProjectStore::Oplog::IterateChunks(std::span<IoHash> RawHashes, +ProjectStore::Oplog::IterateChunks(eastl::span<IoHash> RawHashes, bool IncludeModTag, const std::function<bool(size_t Index, const IoBuffer& Payload, uint64_t ModTag)>& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, @@ -2103,7 +2103,7 @@ ProjectStore::Oplog::IterateChunks(std::span<IoHash> RawHashes, } bool -ProjectStore::Oplog::IterateChunks(std::span<Oid> ChunkIds, +ProjectStore::Oplog::IterateChunks(eastl::span<Oid> ChunkIds, bool IncludeModTag, const std::function<bool(size_t Index, const IoBuffer& Payload, uint64_t ModTag)>& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, @@ -2368,13 +2368,13 @@ ProjectStore::Oplog::IterateOplog(std::function<void(CbObjectView)>&& Handler, c } template<typename ContainerElement> -std::span<ContainerElement> +eastl::span<ContainerElement> CreateSpanFromPaging(eastl::vector<ContainerElement>& Container, const ProjectStore::Oplog::Paging& Paging) { - std::span<ContainerElement> Span(Container); - int32_t Size = int32_t(Container.size()); - int32_t Start = std::clamp(Paging.Start, 0, Size); - int32_t End = Paging.Count < 0 ? Size : (Start + std::min<int32_t>(Paging.Count, Size - Start)); + eastl::span<ContainerElement> Span(Container); + int32_t Size = int32_t(Container.size()); + int32_t Start = std::clamp(Paging.Start, 0, Size); + int32_t End = Paging.Count < 0 ? Size : (Start + std::min<int32_t>(Paging.Count, Size - Start)); return Span.subspan(Start, End - Start); } @@ -2403,7 +2403,7 @@ ProjectStore::Oplog::IterateOplogLocked(std::function<void(CbObjectView)>&& Hand return Lhs.Offset < Rhs.Offset; }); - std::span<OplogEntryAddress> EntrySpan = CreateSpanFromPaging(Entries, EntryPaging); + eastl::span<OplogEntryAddress> EntrySpan = CreateSpanFromPaging(Entries, EntryPaging); m_Storage->ReplayLogEntries(EntrySpan, [&](CbObjectView Op) { Handler(Op); }); } @@ -2428,7 +2428,7 @@ ProjectStore::Oplog::GetAttachmentsLocked(eastl::vector<IoHash>& OutAttachments, if (GetAttachmentsFromMetaData<Oid, IoHash>( MetadataPayload, OplogMetaDataExpectedMagic, - [&](std::span<const Oid> Keys, std::span<const uint32_t> AttachmentCounts, std::span<const IoHash> Attachments) { + [&](eastl::span<const Oid> Keys, eastl::span<const uint32_t> AttachmentCounts, eastl::span<const IoHash> Attachments) { ZEN_UNUSED(Keys); ZEN_UNUSED(AttachmentCounts); OutAttachments.insert(OutAttachments.end(), Attachments.begin(), Attachments.end()); @@ -2463,7 +2463,7 @@ ProjectStore::Oplog::GetAttachmentsLocked(eastl::vector<IoHash>& OutAttachments, IoBuffer MetaPayload = BuildReferenceMetaData<Oid>(OplogMetaDataExpectedMagic, Keys, AttachmentCounts, - std::span<const IoHash>(FirstAttachment, AttachmentCount)) + eastl::span<const IoHash>(FirstAttachment, AttachmentCount)) .Flatten() .AsIoBuffer(); @@ -2559,8 +2559,8 @@ ProjectStore::Oplog::IterateOplogWithKey(std::function<void(uint32_t, const Oid& } } - std::span<OplogEntryAddress> EntrySpan = CreateSpanFromPaging(SortedEntries, EntryPaging); - size_t EntryIndex = EntrySpan.empty() ? 0 : static_cast<size_t>(&EntrySpan.front() - &SortedEntries.front()); + eastl::span<OplogEntryAddress> EntrySpan = CreateSpanFromPaging(SortedEntries, EntryPaging); + size_t EntryIndex = EntrySpan.empty() ? 0 : static_cast<size_t>(&EntrySpan.front() - &SortedEntries.front()); m_Storage->ReplayLogEntries(EntrySpan, [&](CbObjectView Op) { Handler(SortedLSNs[EntryIndex], SortedKeys[EntryIndex], Op); EntryIndex++; @@ -2630,7 +2630,7 @@ ProjectStore::Oplog::AddChunkMappings(const std::unordered_map<Oid, IoHash, Oid: } void -ProjectStore::Oplog::CaptureAddedAttachments(std::span<const IoHash> AttachmentHashes) +ProjectStore::Oplog::CaptureAddedAttachments(eastl::span<const IoHash> AttachmentHashes) { ZEN_MEMSCOPE(GetProjectstoreTag()); @@ -2717,7 +2717,7 @@ ProjectStore::Oplog::GetCapturedAttachmentsLocked() } eastl::vector<IoHash> -ProjectStore::Oplog::CheckPendingChunkReferences(std::span<const IoHash> ChunkHashes, const GcClock::Duration& RetainTime) +ProjectStore::Oplog::CheckPendingChunkReferences(eastl::span<const IoHash> ChunkHashes, const GcClock::Duration& RetainTime) { ZEN_MEMSCOPE(GetProjectstoreTag()); @@ -2749,7 +2749,7 @@ ProjectStore::Oplog::CheckPendingChunkReferences(std::span<const IoHash> ChunkHa } void -ProjectStore::Oplog::RemovePendingChunkReferences(std::span<const IoHash> ChunkHashes) +ProjectStore::Oplog::RemovePendingChunkReferences(eastl::span<const IoHash> ChunkHashes) { ZEN_MEMSCOPE(GetProjectstoreTag()); @@ -3060,7 +3060,7 @@ ProjectStore::Oplog::AppendNewOplogEntry(CbObjectView Core) } eastl::vector<uint32_t> -ProjectStore::Oplog::AppendNewOplogEntries(std::span<CbObjectView> Cores) +ProjectStore::Oplog::AppendNewOplogEntries(eastl::span<CbObjectView> Cores) { ZEN_MEMSCOPE(GetProjectstoreTag()); ZEN_TRACE_CPU("Store::Oplog::AppendNewOplogEntries"); @@ -5269,7 +5269,7 @@ ProjectStore::WriteOplog(const std::string_view ProjectId, const std::string_vie auto OnChunkedAttachment = [](const ChunkedInfo&) {}; - auto OnReferencedAttachments = [&Oplog](std::span<IoHash> RawHashes) { Oplog->CaptureAddedAttachments(RawHashes); }; + auto OnReferencedAttachments = [&Oplog](eastl::span<IoHash> RawHashes) { Oplog->CaptureAddedAttachments(RawHashes); }; // Make sure we retain any attachments we download before writing the oplog Oplog->EnableUpdateCapture(); auto _ = MakeGuard([&Oplog]() { Oplog->DisableUpdateCapture(); }); @@ -5527,7 +5527,7 @@ ProjectStore::Rpc(HttpServerRequest& HttpReq, return true; } - std::span<const CbAttachment> Attachments = Package.GetAttachments(); + eastl::span<const CbAttachment> Attachments = Package.GetAttachments(); if (!Attachments.empty()) { eastl::vector<IoBuffer> WriteAttachmentBuffers; @@ -6268,7 +6268,7 @@ public: FilterReferences(Ctx, fmt::format("projectstore [LOCKSTATE] '{}'", "projectstore"), m_References); } - virtual std::span<IoHash> GetUnusedReferences(GcCtx& Ctx, std::span<IoHash> IoCids) override + virtual eastl::span<IoHash> GetUnusedReferences(GcCtx& Ctx, eastl::span<IoHash> IoCids) override { ZEN_TRACE_CPU("Store::GetUnusedReferences"); @@ -6290,8 +6290,8 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); + UsedCount = IoCids.size() - UnusedReferences.size(); return UnusedReferences; } @@ -6452,7 +6452,7 @@ public: FilterReferences(Ctx, fmt::format("projectstore [LOCKSTATE] '{}'", m_OplogBasePath), m_AddedReferences); } - virtual std::span<IoHash> GetUnusedReferences(GcCtx& Ctx, std::span<IoHash> IoCids) override + virtual eastl::span<IoHash> GetUnusedReferences(GcCtx& Ctx, eastl::span<IoHash> IoCids) override { ZEN_TRACE_CPU("Store::Oplog::GetUnusedReferences"); @@ -6476,9 +6476,9 @@ public: m_OplogId); }); - std::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); - UnusedReferences = KeepUnusedReferences(m_AddedReferences, UnusedReferences); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); + UnusedReferences = KeepUnusedReferences(m_AddedReferences, UnusedReferences); + UsedCount = IoCids.size() - UnusedReferences.size(); return UnusedReferences; } @@ -6736,7 +6736,7 @@ namespace testutils { return OidStringBuilder.ToString(); } - CbPackage CreateBulkDataOplogPackage(const Oid& Id, const std::span<const std::pair<Oid, CompressedBuffer>>& Attachments) + CbPackage CreateBulkDataOplogPackage(const Oid& Id, const eastl::span<const std::pair<Oid, CompressedBuffer>>& Attachments) { CbPackage Package; CbObjectWriter Object; @@ -6762,9 +6762,9 @@ namespace testutils { return Package; }; - CbPackage CreateFilesOplogPackage(const Oid& Id, - const std::filesystem::path ProjectRootDir, - const std::span<const std::pair<Oid, std::filesystem::path>>& Attachments) + CbPackage CreateFilesOplogPackage(const Oid& Id, + const std::filesystem::path ProjectRootDir, + const eastl::span<const std::pair<Oid, std::filesystem::path>>& Attachments) { CbPackage Package; CbObjectWriter Object; @@ -6789,9 +6789,9 @@ namespace testutils { }; eastl::vector<std::pair<Oid, CompressedBuffer>> CreateAttachments( - const std::span<const size_t>& Sizes, - OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, - uint64_t BlockSize = 0) + const eastl::span<const size_t>& Sizes, + OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, + uint64_t BlockSize = 0) { eastl::vector<std::pair<Oid, CompressedBuffer>> Result; Result.reserve(Sizes.size()); |