From b044289e3c8fbc4eb4ffa5c1d96da51aa0a41f9b Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Thu, 6 Mar 2025 17:35:39 +0100 Subject: std::span -> eastl::span --- src/zen/cmds/builds_cmd.cpp | 150 ++++++++++----------- src/zen/cmds/cache_cmd.cpp | 8 +- src/zen/cmds/print_cmd.cpp | 4 +- src/zen/cmds/workspaces_cmd.cpp | 8 +- src/zen/zen.cpp | 10 +- src/zen/zen.h | 12 +- src/zencore/compactbinarypackage.cpp | 2 +- src/zencore/compress.cpp | 142 +++++++++---------- src/zencore/include/zencore/compactbinarypackage.h | 8 +- src/zencore/include/zencore/compositebuffer.h | 10 +- src/zencore/include/zencore/memoryview.h | 6 +- src/zencore/include/zencore/sharedbuffer.h | 2 +- src/zencore/include/zencore/string.h | 19 ++- src/zencore/jobqueue.cpp | 2 +- src/zencore/memtrack/callstacktrace.cpp | 10 +- src/zencore/string.cpp | 16 +-- src/zenhttp/httpclient.cpp | 4 +- src/zenhttp/httpserver.cpp | 6 +- src/zenhttp/include/zenhttp/httpclient.h | 2 +- src/zenhttp/include/zenhttp/httpserver.h | 4 +- src/zenhttp/include/zenhttp/packageformat.h | 2 +- src/zenhttp/packageformat.cpp | 12 +- src/zenhttp/servers/httpasio.cpp | 6 +- src/zenhttp/servers/httpplugin.cpp | 8 +- src/zenhttp/servers/httpsys.cpp | 24 ++-- src/zenhttp/servers/httptracer.cpp | 2 +- src/zenhttp/servers/httptracer.h | 2 +- src/zenserver-test/zenserver-test.cpp | 34 ++--- src/zenserver/config.cpp | 2 +- src/zenserver/projectstore/httpprojectstore.cpp | 4 +- src/zenserver/projectstore/projectstore.cpp | 72 +++++----- src/zenserver/projectstore/projectstore.h | 12 +- src/zenserver/projectstore/remoteprojectstore.cpp | 10 +- src/zenserver/projectstore/remoteprojectstore.h | 4 +- .../projectstore/zenremoteprojectstore.cpp | 4 +- src/zenserver/upstream/upstreamcache.cpp | 70 +++++----- src/zenserver/upstream/upstreamcache.h | 24 ++-- src/zenserver/upstream/zen.h | 10 +- src/zenstore/blockstore.cpp | 28 ++-- src/zenstore/cache/cachedisklayer.cpp | 38 +++--- src/zenstore/cache/structuredcachestore.cpp | 58 ++++---- src/zenstore/cas.cpp | 24 ++-- src/zenstore/cas.h | 8 +- src/zenstore/cidstore.cpp | 10 +- src/zenstore/compactcas.cpp | 20 +-- src/zenstore/compactcas.h | 4 +- src/zenstore/filecas.cpp | 8 +- src/zenstore/filecas.h | 2 +- src/zenstore/gc.cpp | 34 ++--- src/zenstore/hashkeyset.cpp | 2 +- src/zenstore/include/zenstore/blockstore.h | 12 +- .../include/zenstore/cache/cachedisklayer.h | 24 ++-- .../include/zenstore/cache/structuredcachestore.h | 4 +- .../include/zenstore/cache/upstreamcacheclient.h | 18 +-- src/zenstore/include/zenstore/caslog.h | 2 +- src/zenstore/include/zenstore/cidstore.h | 8 +- src/zenstore/include/zenstore/gc.h | 10 +- src/zenstore/include/zenstore/hashkeyset.h | 6 +- src/zenstore/include/zenstore/scrubcontext.h | 2 +- src/zenstore/include/zenstore/workspaces.h | 8 +- src/zenstore/scrubcontext.cpp | 2 +- src/zenstore/workspaces.cpp | 12 +- src/zenutil/cache/cachepolicy.cpp | 10 +- src/zenutil/cache/cacherequests.cpp | 12 +- src/zenutil/chunkblock.cpp | 2 +- src/zenutil/chunkedcontent.cpp | 38 +++--- src/zenutil/chunkingcontroller.cpp | 28 ++-- src/zenutil/chunkrequests.cpp | 2 +- src/zenutil/filebuildstorage.cpp | 2 +- src/zenutil/include/zenutil/buildstorage.h | 6 +- src/zenutil/include/zenutil/cache/cachepolicy.h | 12 +- src/zenutil/include/zenutil/cache/cacherequests.h | 10 +- src/zenutil/include/zenutil/chunkedcontent.h | 20 +-- src/zenutil/include/zenutil/chunkingcontroller.h | 14 +- src/zenutil/include/zenutil/chunkrequests.h | 4 +- src/zenutil/include/zenutil/referencemetadata.h | 26 ++-- src/zenutil/jupiter/jupiterbuildstorage.cpp | 2 +- 77 files changed, 631 insertions(+), 628 deletions(-) (limited to 'src') diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp index af51ef0e7..5331c34f4 100644 --- a/src/zen/cmds/builds_cmd.cpp +++ b/src/zen/cmds/builds_cmd.cpp @@ -169,7 +169,7 @@ namespace { } template - std::string FormatArray(std::span Items, std::string_view Prefix) + std::string FormatArray(eastl::span Items, std::string_view Prefix) { ExtendableStringBuilder<512> SB; for (const T& Item : Items) @@ -179,7 +179,7 @@ namespace { return SB.ToString(); } - void CleanDirectory(const std::filesystem::path& Path, std::span ExcludeDirectories) + void CleanDirectory(const std::filesystem::path& Path, eastl::span ExcludeDirectories) { ZEN_TRACE_CPU("CleanDirectory"); @@ -234,7 +234,7 @@ namespace { CompositeBuffer WriteToTempFileIfNeeded(const CompositeBuffer& Buffer, const std::filesystem::path& TempFolderPath, const IoHash& Hash) { // If this is a file based buffer or a compressed buffer with a memory-based header, we don't need to rewrite to disk to save memory - std::span Segments = Buffer.GetSegments(); + eastl::span Segments = Buffer.GetSegments(); ZEN_ASSERT(Buffer.GetSegments().size() > 0); IoBufferFileReference FileRef; if (Segments.back().GetFileReference(FileRef)) @@ -505,11 +505,11 @@ namespace { } }; - eastl::vector CalculateAbsoluteChunkOrders(const std::span LocalChunkHashes, - const std::span LocalChunkOrder, + eastl::vector CalculateAbsoluteChunkOrders(const eastl::span LocalChunkHashes, + const eastl::span LocalChunkOrder, const tsl::robin_map& ChunkHashToLocalChunkIndex, - const std::span& LooseChunkIndexes, - const std::span& BlockDescriptions) + const eastl::span& LooseChunkIndexes, + const eastl::span& BlockDescriptions) { ZEN_TRACE_CPU("CalculateAbsoluteChunkOrders"); @@ -571,13 +571,13 @@ namespace { return AbsoluteChunkOrder; } - void CalculateLocalChunkOrders(const std::span& AbsoluteChunkOrders, - const std::span LooseChunkHashes, - const std::span LooseChunkRawSizes, - const std::span& BlockDescriptions, - eastl::vector& OutLocalChunkHashes, - eastl::vector& OutLocalChunkRawSizes, - eastl::vector& OutLocalChunkOrders) + void CalculateLocalChunkOrders(const eastl::span& AbsoluteChunkOrders, + const eastl::span LooseChunkHashes, + const eastl::span LooseChunkRawSizes, + const eastl::span& BlockDescriptions, + eastl::vector& OutLocalChunkHashes, + eastl::vector& OutLocalChunkRawSizes, + eastl::vector& OutLocalChunkOrders) { ZEN_TRACE_CPU("CalculateLocalChunkOrders"); @@ -641,19 +641,19 @@ namespace { #endif // EXTRA_VERIFY } - void WriteBuildContentToCompactBinary(CbObjectWriter& PartManifestWriter, - const SourcePlatform Platform, - std::span Paths, - std::span RawHashes, - std::span RawSizes, - std::span Attributes, - std::span SequenceRawHashes, - std::span ChunkCounts, - std::span LocalChunkHashes, - std::span LocalChunkRawSizes, - eastl::vector AbsoluteChunkOrders, - const std::span LooseLocalChunkIndexes, - const std::span BlockHashes) + void WriteBuildContentToCompactBinary(CbObjectWriter& PartManifestWriter, + const SourcePlatform Platform, + eastl::span Paths, + eastl::span RawHashes, + eastl::span RawSizes, + eastl::span Attributes, + eastl::span SequenceRawHashes, + eastl::span ChunkCounts, + eastl::span LocalChunkHashes, + eastl::span LocalChunkRawSizes, + eastl::vector AbsoluteChunkOrders, + const eastl::span LooseLocalChunkIndexes, + const eastl::span BlockHashes) { ZEN_ASSERT(Platform != SourcePlatform::_Count); PartManifestWriter.AddString("platform"sv, ToString(Platform)); @@ -832,8 +832,8 @@ namespace { { OutSequenceRawHashes.push_back(PathRawHash); OutChunkCounts.push_back(LegacyChunkCount); - std::span AbsoluteChunkOrder = - std::span(LegacyAbsoluteChunkOrders).subspan(OrderIndexOffset, LegacyChunkCount); + eastl::span AbsoluteChunkOrder = + eastl::span(LegacyAbsoluteChunkOrders).subspan(OrderIndexOffset, LegacyChunkCount); OutAbsoluteChunkOrders.insert(OutAbsoluteChunkOrders.end(), AbsoluteChunkOrder.begin(), AbsoluteChunkOrder.end()); } OrderIndexOffset += LegacyChunkCounts[PathIndex]; @@ -911,7 +911,7 @@ namespace { CbObject CreateStateObject(const Oid& BuildId, eastl::vector> AllBuildParts, - std::span PartContents, + eastl::span PartContents, const FolderContent& LocalFolderState) { CbObjectWriter CurrentStateWriter; @@ -1181,8 +1181,8 @@ namespace { { auto It = Lookup.ChunkHashToChunkIndex.find(ChunkHash); ZEN_ASSERT(It != Lookup.ChunkHashToChunkIndex.end()); - uint32_t ChunkIndex = It->second; - std::span ChunkLocations = GetChunkSequenceLocations(Lookup, ChunkIndex); + uint32_t ChunkIndex = It->second; + eastl::span ChunkLocations = GetChunkSequenceLocations(Lookup, ChunkIndex); ZEN_ASSERT(!ChunkLocations.empty()); CompositeBuffer Chunk = OpenFileCache.GetRange(ChunkLocations[0].SequenceIndex, ChunkLocations[0].Offset, @@ -1748,10 +1748,10 @@ namespace { const std::filesystem::path& Path, const ChunkedFolderContent& Content, const ChunkedContentLookup& Lookup, - std::span RawHashes, + eastl::span RawHashes, const eastl::vector>& NewBlockChunks, GeneratedBlocks& NewBlocks, - std::span LooseChunkIndexes, + eastl::span LooseChunkIndexes, const std::uint64_t LargeAttachmentSize, DiskStatistics& DiskStats, UploadStatistics& UploadStats, @@ -2076,8 +2076,8 @@ namespace { } eastl::vector FindReuseBlocks(const eastl::vector& KnownBlocks, - std::span ChunkHashes, - std::span ChunkIndexes, + eastl::span ChunkHashes, + eastl::span ChunkIndexes, uint8_t MinPercentLimit, eastl::vector& OutUnusedChunkIndexes, FindBlocksStatistics& FindBlocksStats) @@ -2806,7 +2806,7 @@ namespace { PutBuildPartResult.second.size()); IoHash PartHash = PutBuildPartResult.first; - auto UploadAttachments = [&](std::span RawHashes) { + auto UploadAttachments = [&](eastl::span RawHashes) { if (!AbortFlag) { ZEN_CONSOLE_VERBOSE("Uploading attachments: {}", FormatArray(RawHashes, "\n "sv)); @@ -3339,11 +3339,11 @@ namespace { }; eastl::vector GetRemainingChunkTargets( - std::span> SequenceIndexChunksLeftToWriteCounters, - const ChunkedContentLookup& Lookup, - uint32_t ChunkIndex) + eastl::span> SequenceIndexChunksLeftToWriteCounters, + const ChunkedContentLookup& Lookup, + uint32_t ChunkIndex) { - std::span ChunkSources = GetChunkSequenceLocations(Lookup, ChunkIndex); + eastl::span ChunkSources = GetChunkSequenceLocations(Lookup, ChunkIndex); eastl::vector ChunkTargetPtrs; if (!ChunkSources.empty()) { @@ -3359,14 +3359,14 @@ namespace { return ChunkTargetPtrs; }; - bool WriteBlockToDisk(const std::filesystem::path& CacheFolderPath, - const ChunkedFolderContent& RemoteContent, - std::span> SequenceIndexChunksLeftToWriteCounters, - const CompositeBuffer& DecompressedBlockBuffer, - const ChunkedContentLookup& Lookup, - std::atomic* RemoteChunkIndexNeedsCopyFromSourceFlags, - std::atomic& OutChunksComplete, - std::atomic& OutBytesWritten) + bool WriteBlockToDisk(const std::filesystem::path& CacheFolderPath, + const ChunkedFolderContent& RemoteContent, + eastl::span> SequenceIndexChunksLeftToWriteCounters, + const CompositeBuffer& DecompressedBlockBuffer, + const ChunkedContentLookup& Lookup, + std::atomic* RemoteChunkIndexNeedsCopyFromSourceFlags, + std::atomic& OutChunksComplete, + std::atomic& OutBytesWritten) { ZEN_TRACE_CPU("WriteBlockToDisk"); @@ -3524,13 +3524,13 @@ namespace { return Decompressed; } - void WriteChunkToDisk(const std::filesystem::path& CacheFolderPath, - const ChunkedFolderContent& Content, - const ChunkedContentLookup& Lookup, - std::span ChunkTargets, - const CompositeBuffer& ChunkData, - WriteFileCache& OpenFileCache, - std::atomic& OutBytesWritten) + void WriteChunkToDisk(const std::filesystem::path& CacheFolderPath, + const ChunkedFolderContent& Content, + const ChunkedContentLookup& Lookup, + eastl::span ChunkTargets, + const CompositeBuffer& ChunkData, + WriteFileCache& OpenFileCache, + std::atomic& OutBytesWritten) { ZEN_TRACE_CPU("WriteChunkToDisk"); @@ -3628,7 +3628,7 @@ namespace { const IoHash& ChunkHash, const std::uint64_t PreferredMultipartChunkSize, const eastl::vector& ChunkTargetPtrs, - std::span> SequenceIndexChunksLeftToWriteCounters, + eastl::span> SequenceIndexChunksLeftToWriteCounters, ParallellWork& Work, WorkerThreadPool& WritePool, WorkerThreadPool& NetworkPool, @@ -4171,8 +4171,8 @@ namespace { { uint64_t CacheLocalFileBytesRead = 0; - size_t TargetStart = 0; - const std::span AllTargets( + size_t TargetStart = 0; + const eastl::span AllTargets( CopyData.TargetChunkLocationPtrs); struct WriteOp @@ -4187,7 +4187,7 @@ namespace { for (const CacheCopyData::ChunkTarget& ChunkTarget : CopyData.ChunkTargets) { - std::span TargetRange = + eastl::span TargetRange = AllTargets.subspan(TargetStart, ChunkTarget.TargetChunkLocationCount); for (const ChunkedContentLookup::ChunkSequenceLocation* Target : TargetRange) { @@ -4648,11 +4648,11 @@ namespace { } } - eastl::vector> ResolveBuildPartNames(BuildStorage& Storage, - const Oid& BuildId, - const eastl::vector& BuildPartIds, - std::span BuildPartNames, - std::uint64_t& OutPreferredMultipartChunkSize) + eastl::vector> ResolveBuildPartNames(BuildStorage& Storage, + const Oid& BuildId, + const eastl::vector& BuildPartIds, + eastl::span BuildPartNames, + std::uint64_t& OutPreferredMultipartChunkSize) { eastl::vector> Result; { @@ -4920,7 +4920,7 @@ namespace { } RemoteContent = - MergeChunkedFolderContents(OutPartContents[0], std::span(OutPartContents).subspan(1)); + MergeChunkedFolderContents(OutPartContents[0], eastl::span(OutPartContents).subspan(1)); { tsl::robin_set AllBlockHashes; for (const ChunkBlockDescription& Description : OutBlockDescriptions) @@ -5039,7 +5039,7 @@ namespace { { LocalContent = MergeChunkedFolderContents(SavedPartContents[0], - std::span(SavedPartContents).subspan(1)); + eastl::span(SavedPartContents).subspan(1)); } if (!LocalFolderState.AreKnownFilesEqual(CurrentLocalFolderContent)) @@ -5181,14 +5181,14 @@ namespace { return LocalContent; } - void DownloadFolder(BuildStorage& Storage, - const Oid& BuildId, - const eastl::vector& BuildPartIds, - std::span BuildPartNames, - const std::filesystem::path& Path, - bool AllowMultiparts, - bool WipeTargetFolder, - bool PostDownloadVerify) + void DownloadFolder(BuildStorage& Storage, + const Oid& BuildId, + const eastl::vector& BuildPartIds, + eastl::span BuildPartNames, + const std::filesystem::path& Path, + bool AllowMultiparts, + bool WipeTargetFolder, + bool PostDownloadVerify) { ZEN_TRACE_CPU("DownloadFolder"); diff --git a/src/zen/cmds/cache_cmd.cpp b/src/zen/cmds/cache_cmd.cpp index f12dbcf63..558a69532 100644 --- a/src/zen/cmds/cache_cmd.cpp +++ b/src/zen/cmds/cache_cmd.cpp @@ -476,7 +476,7 @@ CacheGenerateCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** a HttpClient Http(m_HostName); - auto GeneratePutCacheValueRequest([this, &KeyDistribution, &Generator](std::span BatchSizes, uint64_t RequestIndex) { + auto GeneratePutCacheValueRequest([this, &KeyDistribution, &Generator](eastl::span BatchSizes, uint64_t RequestIndex) { cacherequests::PutCacheValuesRequest Request({.AcceptMagic = kCbPkgMagic, .Namespace = m_Namespace}); for (std::uint64_t ValueSize : BatchSizes) { @@ -490,7 +490,7 @@ CacheGenerateCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** a return Request; }); - auto GeneratePutCacheRecordRequest([this, &KeyDistribution, &Generator](std::span BatchSizes, uint64_t RequestIndex) { + auto GeneratePutCacheRecordRequest([this, &KeyDistribution, &Generator](eastl::span BatchSizes, uint64_t RequestIndex) { cacherequests::PutCacheRecordsRequest Request({.AcceptMagic = kCbPkgMagic, .Namespace = m_Namespace}); uint64_t KeyBase = KeyDistribution(Generator); std::string RecordKeyString = fmt::format("{}-{}-{}", RequestIndex, KeyBase, BatchSizes.size()); @@ -514,8 +514,8 @@ CacheGenerateCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** a uint64_t RequestIndex = 0; while (Offset < Sizes.size()) { - size_t SizeCount = SizeCountDistribution(Generator); - std::span BatchSizes = std::span(Sizes).subspan(Offset, Min(Max(SizeCount, 1u), Sizes.size() - Offset)); + size_t SizeCount = SizeCountDistribution(Generator); + eastl::span BatchSizes = eastl::span(Sizes).subspan(Offset, Min(Max(SizeCount, 1u), Sizes.size() - Offset)); WorkLatch.AddCount(1); WorkerPool.ScheduleWork([&, BatchSizes, RequestIndex]() { diff --git a/src/zen/cmds/print_cmd.cpp b/src/zen/cmds/print_cmd.cpp index 469dddf55..6558296b7 100644 --- a/src/zen/cmds/print_cmd.cpp +++ b/src/zen/cmds/print_cmd.cpp @@ -84,8 +84,8 @@ PrintCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) { CbPackage Package = ParsePackageMessage(Data); - CbObject Object = Package.GetObject(); - std::span Attachments = Package.GetAttachments(); + CbObject Object = Package.GetObject(); + eastl::span Attachments = Package.GetAttachments(); ZEN_CONSOLE("Package - {} attachments, object hash {}", Package.GetAttachments().size(), Package.GetObjectHash()); ZEN_CONSOLE(""); diff --git a/src/zen/cmds/workspaces_cmd.cpp b/src/zen/cmds/workspaces_cmd.cpp index f6f86e078..2876d2fda 100644 --- a/src/zen/cmds/workspaces_cmd.cpp +++ b/src/zen/cmds/workspaces_cmd.cpp @@ -703,10 +703,10 @@ WorkspaceShareCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** } } - auto ChunksToOidStrings = [](HttpClient& Http, - std::string_view WorkspaceId, - std::string_view ShareId, - std::span ChunkIds) -> std::vector { + auto ChunksToOidStrings = [](HttpClient& Http, + std::string_view WorkspaceId, + std::string_view ShareId, + eastl::span ChunkIds) -> std::vector { std::vector Oids; Oids.reserve(ChunkIds.size()); eastl::vector NeedsConvertIndexes; diff --git a/src/zen/zen.cpp b/src/zen/zen.cpp index 4c6aa0087..598e84aad 100644 --- a/src/zen/zen.cpp +++ b/src/zen/zen.cpp @@ -124,11 +124,11 @@ ZenCmdBase::ParseOptions(cxxopts::Options& CmdOptions, int argc, char** argv) // Build an array for sub command to parse int ZenCmdBase::GetSubCommand(cxxopts::Options&, - int argc, - char** argv, - std::span SubOptions, - cxxopts::Options*& OutSubOption, - eastl::vector& OutSubCommandArguments) + int argc, + char** argv, + eastl::span SubOptions, + cxxopts::Options*& OutSubOption, + eastl::vector& OutSubCommandArguments) { for (int i = 1; i < argc; ++i) { diff --git a/src/zen/zen.h b/src/zen/zen.h index 510429b91..fb47fb178 100644 --- a/src/zen/zen.h +++ b/src/zen/zen.h @@ -52,12 +52,12 @@ public: bool ParseOptions(int argc, char** argv); static bool ParseOptions(cxxopts::Options& Options, int argc, char** argv); - static int GetSubCommand(cxxopts::Options& Options, - int argc, - char** argv, - std::span SubOptions, - cxxopts::Options*& OutSubOption, - eastl::vector& OutSubCommandArguments); + static int GetSubCommand(cxxopts::Options& Options, + int argc, + char** argv, + eastl::span SubOptions, + cxxopts::Options*& OutSubOption, + eastl::vector& OutSubCommandArguments); static std::string FormatHttpResponse(const cpr::Response& Response); static int MapHttpToCommandReturnCode(const cpr::Response& Response); static std::string ResolveTargetHostSpec(const std::string& InHostSpec); diff --git a/src/zencore/compactbinarypackage.cpp b/src/zencore/compactbinarypackage.cpp index ffe64f2e9..91fcc75f3 100644 --- a/src/zencore/compactbinarypackage.cpp +++ b/src/zencore/compactbinarypackage.cpp @@ -373,7 +373,7 @@ CbPackage::AddAttachment(const CbAttachment& Attachment, AttachmentResolver* Res } void -CbPackage::AddAttachments(std::span InAttachments) +CbPackage::AddAttachments(eastl::span InAttachments) { if (InAttachments.empty()) { diff --git a/src/zencore/compress.cpp b/src/zencore/compress.cpp index bc9ce0c30..2c2ff87de 100644 --- a/src/zencore/compress.cpp +++ b/src/zencore/compress.cpp @@ -755,7 +755,7 @@ BlockDecoder::DecompressToStream(const BufferHeader& Header, UniqueBuffer BlockSizeBuffer; MemoryView BlockSizeView = CompressedData.ViewOrCopyRange(sizeof(BufferHeader), Header.BlockCount * sizeof(uint32_t), BlockSizeBuffer); - std::span CompressedBlockSizes(reinterpret_cast(BlockSizeView.GetData()), Header.BlockCount); + eastl::span CompressedBlockSizes(reinterpret_cast(BlockSizeView.GetData()), Header.BlockCount); UniqueBuffer CompressedBlockCopy; @@ -891,7 +891,7 @@ BlockDecoder::TryDecompressTo(const BufferHeader& Header, UniqueBuffer BlockSizeBuffer; MemoryView BlockSizeView = CompressedData.ViewOrCopyRange(sizeof(BufferHeader), Header.BlockCount * sizeof(uint32_t), BlockSizeBuffer); - std::span CompressedBlockSizes(reinterpret_cast(BlockSizeView.GetData()), Header.BlockCount); + eastl::span CompressedBlockSizes(reinterpret_cast(BlockSizeView.GetData()), Header.BlockCount); UniqueBuffer CompressedBlockCopy; UniqueBuffer UncompressedBlockCopy; @@ -1569,8 +1569,8 @@ GetCompressedRange(const BufferHeader& Header, } else { - MemoryView BlockSizeView = HeaderRawData.Mid(sizeof(Header), Header.BlockCount * sizeof(uint32_t)); - std::span CompressedBlockSizes(reinterpret_cast(BlockSizeView.GetData()), Header.BlockCount); + MemoryView BlockSizeView = HeaderRawData.Mid(sizeof(Header), Header.BlockCount * sizeof(uint32_t)); + eastl::span CompressedBlockSizes(reinterpret_cast(BlockSizeView.GetData()), Header.BlockCount); const uint64_t BlockSize = uint64_t(1) << Header.BlockSizeExponent; const uint64_t LastBlockSize = BlockSize - ((Header.BlockCount * BlockSize) - Header.TotalRawSize); @@ -1657,8 +1657,8 @@ CopyCompressedRange(const BufferHeader& Header, } else { - MemoryView BlockSizeView = HeaderRawData.Mid(sizeof(Header), Header.BlockCount * sizeof(uint32_t)); - std::span CompressedBlockSizes(reinterpret_cast(BlockSizeView.GetData()), Header.BlockCount); + MemoryView BlockSizeView = HeaderRawData.Mid(sizeof(Header), Header.BlockCount * sizeof(uint32_t)); + eastl::span CompressedBlockSizes(reinterpret_cast(BlockSizeView.GetData()), Header.BlockCount); const uint64_t BlockSize = uint64_t(1) << Header.BlockSizeExponent; const uint64_t LastBlockSize = BlockSize - ((Header.BlockCount * BlockSize) - Header.TotalRawSize); @@ -2369,7 +2369,7 @@ TEST_CASE("CompressedBuffer") return Data; }; - auto ValidateData = [](std::span Values, std::span ExpectedValues, uint64_t Offset) { + auto ValidateData = [](eastl::span Values, eastl::span ExpectedValues, uint64_t Offset) { for (size_t Idx = Offset; uint64_t Value : Values) { const uint64_t ExpectedValue = ExpectedValues[Idx++]; @@ -2385,7 +2385,7 @@ TEST_CASE("CompressedBuffer") const eastl::vector& ExpectedValues) { SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); CHECK(Uncompressed.GetSize() == Count * sizeof(uint64_t)); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); ValidateData(Values, ExpectedValues, OffsetCount); }; @@ -2409,32 +2409,32 @@ TEST_CASE("CompressedBuffer") SUBCASE("decompress with offset only") { - const uint64_t BlockSize = 64 * sizeof(uint64_t); - const uint64_t N = 1000; - eastl::vector ExpectedValues = GenerateData(N); - CompressedBuffer Compressed = CompressedBuffer::Compress(SharedBuffer::MakeView(MakeMemoryView(ExpectedValues)), - OodleCompressor::Mermaid, - OodleCompressionLevel::Optimal4, - BlockSize); - const uint64_t OffsetCount = 150; - SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t)); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + const uint64_t BlockSize = 64 * sizeof(uint64_t); + const uint64_t N = 1000; + eastl::vector ExpectedValues = GenerateData(N); + CompressedBuffer Compressed = CompressedBuffer::Compress(SharedBuffer::MakeView(MakeMemoryView(ExpectedValues)), + OodleCompressor::Mermaid, + OodleCompressionLevel::Optimal4, + BlockSize); + const uint64_t OffsetCount = 150; + SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); ValidateData(Values, ExpectedValues, OffsetCount); } SUBCASE("decompress buffer with one block") { - const uint64_t BlockSize = 256 * sizeof(uint64_t); - const uint64_t N = 100; - eastl::vector ExpectedValues = GenerateData(N); - CompressedBuffer Compressed = CompressedBuffer::Compress(SharedBuffer::MakeView(MakeMemoryView(ExpectedValues)), - OodleCompressor::Mermaid, - OodleCompressionLevel::Optimal4, - BlockSize); - const uint64_t OffsetCount = 2; - const uint64_t Count = 50; - SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + const uint64_t BlockSize = 256 * sizeof(uint64_t); + const uint64_t N = 100; + eastl::vector ExpectedValues = GenerateData(N); + CompressedBuffer Compressed = CompressedBuffer::Compress(SharedBuffer::MakeView(MakeMemoryView(ExpectedValues)), + OodleCompressor::Mermaid, + OodleCompressionLevel::Optimal4, + BlockSize); + const uint64_t OffsetCount = 2; + const uint64_t Count = 50; + SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2446,18 +2446,18 @@ TEST_CASE("CompressedBuffer") OodleCompressor::NotSet, OodleCompressionLevel::None); { - const uint64_t OffsetCount = 0; - const uint64_t Count = N; - SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + const uint64_t OffsetCount = 0; + const uint64_t Count = N; + SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); ValidateData(Values, ExpectedValues, OffsetCount); } { - const uint64_t OffsetCount = 21; - const uint64_t Count = 999; - SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + const uint64_t OffsetCount = 21; + const uint64_t Count = 999; + SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); ValidateData(Values, ExpectedValues, OffsetCount); } } @@ -2477,7 +2477,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 0; const uint64_t Count = N; SharedBuffer Uncompressed = Compressed.CopyRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2486,7 +2486,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 64; const uint64_t Count = N - 64; SharedBuffer Uncompressed = Compressed.CopyRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2498,10 +2498,10 @@ TEST_CASE("CompressedBuffer") const uint64_t RawSize = Count * sizeof(uint64_t); uint64_t FirstBlockOffset = RawOffset % BlockSize; - SharedBuffer Uncompressed = Compressed.CopyRange(RawOffset, RawSize).Decompress(); - std::span AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); - std::span Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), - RawSize / sizeof(uint64_t)); + SharedBuffer Uncompressed = Compressed.CopyRange(RawOffset, RawSize).Decompress(); + eastl::span AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), + RawSize / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2513,10 +2513,10 @@ TEST_CASE("CompressedBuffer") const uint64_t RawSize = Count * sizeof(uint64_t); uint64_t FirstBlockOffset = RawOffset % BlockSize; - SharedBuffer Uncompressed = Compressed.CopyRange(RawOffset, RawSize).Decompress(); - std::span AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); - std::span Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), - RawSize / sizeof(uint64_t)); + SharedBuffer Uncompressed = Compressed.CopyRange(RawOffset, RawSize).Decompress(); + eastl::span AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), + RawSize / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2537,7 +2537,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 0; const uint64_t Count = N; SharedBuffer Uncompressed = Compressed.GetRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2546,7 +2546,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 64; const uint64_t Count = N - 64; SharedBuffer Uncompressed = Compressed.GetRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2558,10 +2558,10 @@ TEST_CASE("CompressedBuffer") const uint64_t RawSize = Count * sizeof(uint64_t); uint64_t FirstBlockOffset = RawOffset % BlockSize; - SharedBuffer Uncompressed = Compressed.GetRange(RawOffset, RawSize).Decompress(); - std::span AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); - std::span Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), - RawSize / sizeof(uint64_t)); + SharedBuffer Uncompressed = Compressed.GetRange(RawOffset, RawSize).Decompress(); + eastl::span AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), + RawSize / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2573,10 +2573,10 @@ TEST_CASE("CompressedBuffer") const uint64_t RawSize = Count * sizeof(uint64_t); uint64_t FirstBlockOffset = RawOffset % BlockSize; - SharedBuffer Uncompressed = Compressed.GetRange(RawOffset, RawSize).Decompress(); - std::span AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); - std::span Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), - RawSize / sizeof(uint64_t)); + SharedBuffer Uncompressed = Compressed.GetRange(RawOffset, RawSize).Decompress(); + eastl::span AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), + RawSize / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2595,7 +2595,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 0; const uint64_t Count = N; SharedBuffer Uncompressed = Compressed.CopyRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2604,7 +2604,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 1; const uint64_t Count = N - OffsetCount; SharedBuffer Uncompressed = Compressed.CopyRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2613,7 +2613,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 42; const uint64_t Count = 100; SharedBuffer Uncompressed = Compressed.CopyRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2632,7 +2632,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 0; const uint64_t Count = N; SharedBuffer Uncompressed = Compressed.GetRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2641,7 +2641,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 1; const uint64_t Count = N - OffsetCount; SharedBuffer Uncompressed = Compressed.GetRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2650,7 +2650,7 @@ TEST_CASE("CompressedBuffer") const uint64_t OffsetCount = 42; const uint64_t Count = 100; SharedBuffer Uncompressed = Compressed.GetRange(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)).Decompress(); - std::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); CHECK(Values.size() == Count); ValidateData(Values, ExpectedValues, OffsetCount); } @@ -2680,13 +2680,13 @@ TEST_CASE("CompressedBufferReader") Reader.SetSource(Compressed); { const SharedBuffer Uncompressed = Reader.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); - CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(std::span{ExpectedValues}.subspan(OffsetCount, Count)))); + CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(eastl::span{ExpectedValues}.subspan(OffsetCount, Count)))); } { UniqueBuffer Uncompressed = UniqueBuffer::Alloc(Count * sizeof(uint64_t)); if (Reader.TryDecompressTo(Uncompressed, OffsetCount * sizeof(uint64_t))) { - CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(std::span{ExpectedValues}.subspan(OffsetCount, Count)))); + CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(eastl::span{ExpectedValues}.subspan(OffsetCount, Count)))); } } }; @@ -2730,12 +2730,12 @@ TEST_CASE("CompressedBufferReader") BufferReader Ar(Buffer.GetData(), int64_t(Buffer.GetSize())); CompressedBufferReaderSourceScope Source(Reader, Ar); const SharedBuffer Uncompressed = Reader.Decompress(OffsetCount * sizeof(uint64_t)); - CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(std::span{ExpectedValues}.subspan(OffsetCount)))); + CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(eastl::span{ExpectedValues}.subspan(OffsetCount)))); } { CompressedBufferReaderSourceScope Source(Reader, Compressed); const SharedBuffer Uncompressed = Reader.Decompress(OffsetCount * sizeof(uint64_t)); - CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(std::span{ExpectedValues}.subspan(OffsetCount)))); + CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(eastl::span{ExpectedValues}.subspan(OffsetCount)))); } // Short (malformed) Buffer @@ -2770,12 +2770,12 @@ TEST_CASE("CompressedBufferReader") BufferReader Ar(Buffer.GetData(), int64_t(Buffer.GetSize())); CompressedBufferReaderSourceScope Source(Reader, Ar); const SharedBuffer Uncompressed = Reader.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); - CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(std::span{ExpectedValues}.subspan(OffsetCount, Count)))); + CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(eastl::span{ExpectedValues}.subspan(OffsetCount, Count)))); } { CompressedBufferReaderSourceScope Source(Reader, Compressed); const SharedBuffer Uncompressed = Reader.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); - CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(std::span{ExpectedValues}.subspan(OffsetCount, Count)))); + CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(eastl::span{ExpectedValues}.subspan(OffsetCount, Count)))); } } @@ -2793,14 +2793,14 @@ TEST_CASE("CompressedBufferReader") constexpr uint64_t OffsetCount = 0; constexpr uint64_t Count = N; const SharedBuffer Uncompressed = Reader.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); - CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(std::span{ExpectedValues}.subspan(OffsetCount, Count)))); + CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(eastl::span{ExpectedValues}.subspan(OffsetCount, Count)))); } { constexpr uint64_t OffsetCount = 21; constexpr uint64_t Count = 999; const SharedBuffer Uncompressed = Reader.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); - CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(std::span{ExpectedValues}.subspan(OffsetCount, Count)))); + CHECK(Uncompressed.GetView().EqualBytes(MakeMemoryView(eastl::span{ExpectedValues}.subspan(OffsetCount, Count)))); } // Short (malformed) Buffer diff --git a/src/zencore/include/zencore/compactbinarypackage.h b/src/zencore/include/zencore/compactbinarypackage.h index 9ec12cb0f..15daa6640 100644 --- a/src/zencore/include/zencore/compactbinarypackage.h +++ b/src/zencore/include/zencore/compactbinarypackage.h @@ -8,8 +8,8 @@ #include #include +#include #include -#include #include #include @@ -267,9 +267,9 @@ public: } /** Returns the attachments in this package. */ - inline std::span GetAttachments() const + inline eastl::span GetAttachments() const { - return std::span(begin(Attachments), end(Attachments)); + return eastl::span(begin(Attachments), end(Attachments)); } /** @@ -289,7 +289,7 @@ public: /** Add the attachment to this package, along with any references that can be resolved. */ inline void AddAttachment(const CbAttachment& Attachment, AttachmentResolver Resolver) { AddAttachment(Attachment, &Resolver); } - void AddAttachments(std::span Attachments); + void AddAttachments(eastl::span Attachments); void ReserveAttachments(size_t Count); diff --git a/src/zencore/include/zencore/compositebuffer.h b/src/zencore/include/zencore/compositebuffer.h index 153c7d9ce..4378e38fc 100644 --- a/src/zencore/include/zencore/compositebuffer.h +++ b/src/zencore/include/zencore/compositebuffer.h @@ -6,9 +6,9 @@ #include #include +#include #include #include -#include #include @@ -49,9 +49,9 @@ public: [[nodiscard]] ZENCORE_API uint64_t GetSize() const; /** Returns the segments that the buffer is composed from. */ - [[nodiscard]] inline std::span GetSegments() const + [[nodiscard]] inline eastl::span GetSegments() const { - return std::span{begin(m_Segments), end(m_Segments)}; + return eastl::span{begin(m_Segments), end(m_Segments)}; } /** Returns true if the composite buffer is not null. */ @@ -142,8 +142,8 @@ private: inline void AppendBuffers(SharedBuffer&& Buffer) { m_Segments.push_back(std::move(Buffer)); } inline void AppendBuffers(IoBuffer&& Buffer) { m_Segments.push_back(SharedBuffer(std::move(Buffer))); } - static inline size_t GetBufferCount(std::span&& Container) { return Container.size(); } - inline void AppendBuffers(std::span&& Container) + static inline size_t GetBufferCount(eastl::span&& Container) { return Container.size(); } + inline void AppendBuffers(eastl::span&& Container) { m_Segments.reserve(m_Segments.size() + Container.size()); for (IoBuffer& Buffer : Container) diff --git a/src/zencore/include/zencore/memoryview.h b/src/zencore/include/zencore/memoryview.h index 2d11450cc..4854afcea 100644 --- a/src/zencore/include/zencore/memoryview.h +++ b/src/zencore/include/zencore/memoryview.h @@ -7,10 +7,10 @@ #include #include +#include #include #include #include -#include namespace zen { @@ -307,7 +307,7 @@ template [[nodiscard]] constexpr inline MemoryView MakeMemoryView(const R& Container) { - std::span Span = Container; + eastl::span Span = Container; return MemoryView(Span.data(), Span.size_bytes()); } @@ -342,7 +342,7 @@ template [[nodiscard]] constexpr inline MutableMemoryView MakeMutableMemoryView(R& Container) { - std::span Span = Container; + eastl::span Span = Container; return MutableMemoryView(Span.data(), Span.size_bytes()); } diff --git a/src/zencore/include/zencore/sharedbuffer.h b/src/zencore/include/zencore/sharedbuffer.h index 7df5109cb..4786d9a5b 100644 --- a/src/zencore/include/zencore/sharedbuffer.h +++ b/src/zencore/include/zencore/sharedbuffer.h @@ -157,7 +157,7 @@ public: /** Make a non-owning view of the memory of the contiguous container. */ [[nodiscard]] inline static SharedBuffer MakeView(const ContiguousRange auto& Container) { - std::span Span = Container; + eastl::span Span = Container; return MakeView(Span.data(), Span.size() * sizeof(typename decltype(Span)::element_type)); } /** Make a non-owned view of the input */ diff --git a/src/zencore/include/zencore/string.h b/src/zencore/include/zencore/string.h index 68129b691..375449a6f 100644 --- a/src/zencore/include/zencore/string.h +++ b/src/zencore/include/zencore/string.h @@ -5,6 +5,7 @@ #include "intmath.h" #include "zencore.h" +#include #include #include #include @@ -12,9 +13,7 @@ #include #include #include -#include #include - #include namespace zen { @@ -91,8 +90,8 @@ ZENCORE_API const char* FilepathFindExtension(const std::string_view& path, cons // Text formatting of numbers // -ZENCORE_API bool ToString(std::span Buffer, uint64_t Num); -ZENCORE_API bool ToString(std::span Buffer, int64_t Num); +ZENCORE_API bool ToString(eastl::span Buffer, uint64_t Num); +ZENCORE_API bool ToString(eastl::span Buffer, int64_t Num); struct TextNumBase { @@ -683,11 +682,11 @@ ParseHexNumber(const std::string_view HexString, UnsignedIntegral auto& OutValue // Format numbers for humans // -ZENCORE_API size_t NiceNumToBuffer(uint64_t Num, std::span Buffer); -ZENCORE_API size_t NiceBytesToBuffer(uint64_t Num, std::span Buffer); -ZENCORE_API size_t NiceByteRateToBuffer(uint64_t Num, uint64_t ms, std::span Buffer); -ZENCORE_API size_t NiceLatencyNsToBuffer(uint64_t NanoSeconds, std::span Buffer); -ZENCORE_API size_t NiceTimeSpanMsToBuffer(uint64_t Milliseconds, std::span Buffer); +ZENCORE_API size_t NiceNumToBuffer(uint64_t Num, eastl::span Buffer); +ZENCORE_API size_t NiceBytesToBuffer(uint64_t Num, eastl::span Buffer); +ZENCORE_API size_t NiceByteRateToBuffer(uint64_t Num, uint64_t ms, eastl::span Buffer); +ZENCORE_API size_t NiceLatencyNsToBuffer(uint64_t NanoSeconds, eastl::span Buffer); +ZENCORE_API size_t NiceTimeSpanMsToBuffer(uint64_t Milliseconds, eastl::span Buffer); struct NiceBase { @@ -733,7 +732,7 @@ NiceRate(uint64_t Num, uint64_t DurationMilliseconds, const char* Unit = "B") if (DurationMilliseconds) { // Leave a little of 'Buffer' for the "Unit/s" suffix - std::span BufferSpan(Buffer, sizeof(Buffer) - 8); + eastl::span BufferSpan(Buffer, sizeof(Buffer) - 8); NiceNumToBuffer(Num * 1000 / DurationMilliseconds, BufferSpan); } else diff --git a/src/zencore/jobqueue.cpp b/src/zencore/jobqueue.cpp index bb113afa9..ef4f0dba1 100644 --- a/src/zencore/jobqueue.cpp +++ b/src/zencore/jobqueue.cpp @@ -476,7 +476,7 @@ TEST_CASE("JobQueue") }); } - auto Join = [](std::span Strings, std::string_view Delimiter) -> std::string { + auto Join = [](eastl::span Strings, std::string_view Delimiter) -> std::string { ExtendableStringBuilder<128> SB; if (Strings.empty()) { diff --git a/src/zencore/memtrack/callstacktrace.cpp b/src/zencore/memtrack/callstacktrace.cpp index d860c05d1..f7e66660c 100644 --- a/src/zencore/memtrack/callstacktrace.cpp +++ b/src/zencore/memtrack/callstacktrace.cpp @@ -56,7 +56,7 @@ CallstackTrace_Initialize() # include # include -# include +# include # include @@ -396,7 +396,7 @@ FBacktracer::FBacktracer(FMalloc* InMalloc) //////////////////////////////////////////////////////////////////////////////// FBacktracer::~FBacktracer() { - std::span ModulesView(Modules, ModulesNum); + eastl::span ModulesView(Modules, ModulesNum); for (FModule& Module : ModulesView) { Malloc->Free(Module.Functions); @@ -730,9 +730,9 @@ FBacktracer::LookupFunction(uintptr_t Address, FLookupState& State) const // Now we've a module we have a table of functions and their stack sizes so // we can get the frame size for Address - uint32_t FuncId = uint32_t(Address - IdToAddress(Module->Id)); - std::span FuncsView(Module->Functions, Module->NumFunctions); - auto FindIt = std::upper_bound(begin(FuncsView), end(FuncsView), FuncId, IdPredicate); + uint32_t FuncId = uint32_t(Address - IdToAddress(Module->Id)); + eastl::span FuncsView(Module->Functions, Module->NumFunctions); + auto FindIt = std::upper_bound(begin(FuncsView), end(FuncsView), FuncId, IdPredicate); if (FindIt == begin(FuncsView)) { return nullptr; diff --git a/src/zencore/string.cpp b/src/zencore/string.cpp index a0d8c927f..758c06755 100644 --- a/src/zencore/string.cpp +++ b/src/zencore/string.cpp @@ -47,14 +47,14 @@ utf32to8_impl(u32bit_iterator StartIt, u32bit_iterator EndIt, ::zen::StringBuild namespace zen { bool -ToString(std::span Buffer, uint64_t Num) +ToString(eastl::span Buffer, uint64_t Num) { snprintf(Buffer.data(), Buffer.size(), "%" PRIu64, Num); return true; } bool -ToString(std::span Buffer, int64_t Num) +ToString(eastl::span Buffer, int64_t Num) { snprintf(Buffer.data(), Buffer.size(), "%" PRId64, Num); @@ -253,7 +253,7 @@ namespace { * Convert a number to an appropriately human-readable output. */ int -NiceNumGeneral(uint64_t Num, std::span Buffer, NicenumFormat Format) +NiceNumGeneral(uint64_t Num, eastl::span Buffer, NicenumFormat Format) { switch (Format) { @@ -351,19 +351,19 @@ NiceNumGeneral(uint64_t Num, std::span Buffer, NicenumFormat Format) } size_t -NiceNumToBuffer(uint64_t Num, std::span Buffer) +NiceNumToBuffer(uint64_t Num, eastl::span Buffer) { return NiceNumGeneral(Num, Buffer, kNicenum1024); } size_t -NiceBytesToBuffer(uint64_t Num, std::span Buffer) +NiceBytesToBuffer(uint64_t Num, eastl::span Buffer) { return NiceNumGeneral(Num, Buffer, kNicenumBytes); } size_t -NiceByteRateToBuffer(uint64_t Num, uint64_t ElapsedMs, std::span Buffer) +NiceByteRateToBuffer(uint64_t Num, uint64_t ElapsedMs, eastl::span Buffer) { size_t n = 0; @@ -385,13 +385,13 @@ NiceByteRateToBuffer(uint64_t Num, uint64_t ElapsedMs, std::span Buffer) } size_t -NiceLatencyNsToBuffer(uint64_t Nanos, std::span Buffer) +NiceLatencyNsToBuffer(uint64_t Nanos, eastl::span Buffer) { return NiceNumGeneral(Nanos, Buffer, kNicenumTime); } size_t -NiceTimeSpanMsToBuffer(uint64_t Millis, std::span Buffer) +NiceTimeSpanMsToBuffer(uint64_t Millis, eastl::span Buffer) { if (Millis < 1000) { diff --git a/src/zenhttp/httpclient.cpp b/src/zenhttp/httpclient.cpp index 1a5955609..969395427 100644 --- a/src/zenhttp/httpclient.cpp +++ b/src/zenhttp/httpclient.cpp @@ -758,8 +758,8 @@ HttpClient::TransactPackage(std::string_view Url, CbPackage Package, const KeyVa // First, list of offered chunks for filtering on the server end - eastl::vector AttachmentsToSend; - std::span Attachments = Package.GetAttachments(); + eastl::vector AttachmentsToSend; + eastl::span Attachments = Package.GetAttachments(); const uint32_t RequestId = ++HttpClientRequestIdCounter; auto RequestIdString = fmt::to_string(RequestId); diff --git a/src/zenhttp/httpserver.cpp b/src/zenhttp/httpserver.cpp index 26c1f3025..ae4a740a1 100644 --- a/src/zenhttp/httpserver.cpp +++ b/src/zenhttp/httpserver.cpp @@ -26,9 +26,9 @@ #include #include +#include #include #include -#include #include #include @@ -529,7 +529,7 @@ HttpServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType void HttpServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, CompositeBuffer& Payload) { - std::span Segments = Payload.GetSegments(); + eastl::span Segments = Payload.GetSegments(); eastl::fixed_vector Buffers; Buffers.reserve(Segments.size()); @@ -539,7 +539,7 @@ HttpServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType Buffers.push_back(Segment.AsIoBuffer()); } - WriteResponse(ResponseCode, ContentType, std::span(begin(Buffers), end(Buffers))); + WriteResponse(ResponseCode, ContentType, eastl::span(begin(Buffers), end(Buffers))); } std::string diff --git a/src/zenhttp/include/zenhttp/httpclient.h b/src/zenhttp/include/zenhttp/httpclient.h index a46b9fd83..a9c9fe00d 100644 --- a/src/zenhttp/include/zenhttp/httpclient.h +++ b/src/zenhttp/include/zenhttp/httpclient.h @@ -88,7 +88,7 @@ public: : Entries({{{std::string(Entry.first), std::string(Entry.second)}}}) { } - KeyValueMap(std::span>&& List) : Entries(List.begin(), List.end()) {} + KeyValueMap(eastl::span>&& List) : Entries(List.begin(), List.end()) {} KeyValueMap(std::initializer_list>&& List) : Entries(List.begin(), List.end()) {} }; diff --git a/src/zenhttp/include/zenhttp/httpserver.h b/src/zenhttp/include/zenhttp/httpserver.h index 6cff5c69c..4f049ee8b 100644 --- a/src/zenhttp/include/zenhttp/httpserver.h +++ b/src/zenhttp/include/zenhttp/httpserver.h @@ -13,12 +13,12 @@ #include #include +#include #include #include #include #include #include -#include #include namespace zen { @@ -95,7 +95,7 @@ public: Note that this is destructive in the sense that the IoBuffer instances referred to by Blobs will be moved into our response handler array where they are kept alive, in order to reduce ref-counting storms */ - virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::span Blobs) = 0; + virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span Blobs) = 0; virtual void WriteResponse(HttpResponseCode ResponseCode) = 0; virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::u8string_view ResponseString) = 0; virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, CompositeBuffer& Payload); diff --git a/src/zenhttp/include/zenhttp/packageformat.h b/src/zenhttp/include/zenhttp/packageformat.h index f5bd53c5b..bd2f5573d 100644 --- a/src/zenhttp/include/zenhttp/packageformat.h +++ b/src/zenhttp/include/zenhttp/packageformat.h @@ -138,7 +138,7 @@ public: void Finalize(); const eastl::vector& GetAttachments() { return m_Attachments; } CbObject GetRootObject() { return m_RootObject; } - std::span GetPayloadBuffers() { return m_PayloadBuffers; } + eastl::span GetPayloadBuffers() { return m_PayloadBuffers; } private: enum class State diff --git a/src/zenhttp/packageformat.cpp b/src/zenhttp/packageformat.cpp index b772ba2cf..9d3608656 100644 --- a/src/zenhttp/packageformat.cpp +++ b/src/zenhttp/packageformat.cpp @@ -16,8 +16,8 @@ #include #include +#include #include -#include #include @@ -59,7 +59,7 @@ CompositeBuffer FormatPackageMessageBuffer(const CbPackage& Data, FormatFlags Flags, void* TargetProcessHandle) { auto Vec = FormatPackageMessageInternal(Data, Flags, TargetProcessHandle); - return CompositeBuffer(std::span{begin(Vec), end(Vec)}); + return CompositeBuffer(eastl::span{begin(Vec), end(Vec)}); } static void @@ -190,8 +190,8 @@ FormatPackageMessageInternal(const CbPackage& Data, FormatFlags Flags, void* Tar }); #endif // ZEN_PLATFORM_WINDOWS - const std::span& Attachments = Data.GetAttachments(); - IoBufferVec_t ResponseBuffers; + const eastl::span& Attachments = Data.GetAttachments(); + IoBufferVec_t ResponseBuffers; ResponseBuffers.reserve(2 + Attachments.size()); // TODO: may want to use an additional fudge factor here to avoid growing since each // attachment is likely to consist of several buffers @@ -266,7 +266,7 @@ FormatPackageMessageInternal(const CbPackage& Data, FormatFlags Flags, void* Tar .Flags = CbAttachmentEntry::kIsCompressed, .AttachmentHash = AttachmentHash}; - std::span Segments = Compressed.GetSegments(); + eastl::span Segments = Compressed.GetSegments(); ResponseBuffers.reserve(ResponseBuffers.size() + Segments.size() - 1); for (const SharedBuffer& Segment : Segments) { @@ -320,7 +320,7 @@ FormatPackageMessageInternal(const CbPackage& Data, FormatFlags Flags, void* Tar { *AttachmentInfo++ = {.PayloadSize = AttachmentBinary.GetSize(), .Flags = 0, .AttachmentHash = Attachment.GetHash()}; - std::span Segments = AttachmentBinary.GetSegments(); + eastl::span Segments = AttachmentBinary.GetSegments(); ResponseBuffers.reserve(ResponseBuffers.size() + Segments.size() - 1); for (const SharedBuffer& Segment : Segments) { diff --git a/src/zenhttp/servers/httpasio.cpp b/src/zenhttp/servers/httpasio.cpp index 987d1ab64..61cb2f709 100644 --- a/src/zenhttp/servers/httpasio.cpp +++ b/src/zenhttp/servers/httpasio.cpp @@ -115,7 +115,7 @@ public: virtual IoBuffer ReadPayload() override; virtual void WriteResponse(HttpResponseCode ResponseCode) override; - virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::span Blobs) override; + virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span Blobs) override; virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::u8string_view ResponseString) override; virtual void WriteResponseAsync(std::function&& ContinuationHandler) override; virtual bool TryGetRanges(HttpRanges& Ranges) override; @@ -136,7 +136,7 @@ public: HttpResponse() = default; explicit HttpResponse(HttpContentType ContentType) : m_ContentType(ContentType) {} - void InitializeForPayload(uint16_t ResponseCode, std::span BlobList) + void InitializeForPayload(uint16_t ResponseCode, eastl::span BlobList) { ZEN_MEMSCOPE(GetHttpasioTag()); @@ -920,7 +920,7 @@ HttpAsioServerRequest::WriteResponse(HttpResponseCode ResponseCode) } void -HttpAsioServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::span Blobs) +HttpAsioServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span Blobs) { ZEN_MEMSCOPE(GetHttpasioTag()); diff --git a/src/zenhttp/servers/httpplugin.cpp b/src/zenhttp/servers/httpplugin.cpp index d06e5a001..7d8ab983d 100644 --- a/src/zenhttp/servers/httpplugin.cpp +++ b/src/zenhttp/servers/httpplugin.cpp @@ -146,7 +146,7 @@ public: virtual IoBuffer ReadPayload() override; virtual void WriteResponse(HttpResponseCode ResponseCode) override; - virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::span Blobs) override; + virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span Blobs) override; virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::u8string_view ResponseString) override; virtual void WriteResponseAsync(std::function&& ContinuationHandler) override; virtual bool TryGetRanges(HttpRanges& Ranges) override; @@ -169,7 +169,7 @@ public: HttpPluginResponse(const HttpPluginResponse&) = delete; HttpPluginResponse& operator=(const HttpPluginResponse&) = delete; - void InitializeForPayload(uint16_t ResponseCode, std::span BlobList); + void InitializeForPayload(uint16_t ResponseCode, eastl::span BlobList); inline uint16_t ResponseCode() const { return m_ResponseCode; } inline uint64_t ContentLength() const { return m_ContentLength; } @@ -190,7 +190,7 @@ private: }; void -HttpPluginResponse::InitializeForPayload(uint16_t ResponseCode, std::span BlobList) +HttpPluginResponse::InitializeForPayload(uint16_t ResponseCode, eastl::span BlobList) { ZEN_MEMSCOPE(GetHttppluginTag()); ZEN_TRACE_CPU("http_plugin::InitializeForPayload"); @@ -638,7 +638,7 @@ HttpPluginServerRequest::WriteResponse(HttpResponseCode ResponseCode) } void -HttpPluginServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::span Blobs) +HttpPluginServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span Blobs) { ZEN_ASSERT(!m_Response); ZEN_MEMSCOPE(GetHttppluginTag()); diff --git a/src/zenhttp/servers/httpsys.cpp b/src/zenhttp/servers/httpsys.cpp index e35f27d9a..8daf02594 100644 --- a/src/zenhttp/servers/httpsys.cpp +++ b/src/zenhttp/servers/httpsys.cpp @@ -279,7 +279,7 @@ public: virtual IoBuffer ReadPayload() override; virtual void WriteResponse(HttpResponseCode ResponseCode) override; - virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::span Blobs) override; + virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span Blobs) override; virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::u8string_view ResponseString) override; virtual void WriteResponseAsync(std::function&& ContinuationHandler) override; virtual bool TryGetRanges(HttpRanges& Ranges) override; @@ -372,10 +372,10 @@ public: HttpContentType ContentType, const void* Payload, size_t PayloadSize); - HttpMessageResponseRequest(HttpSysTransaction& InRequest, - uint16_t ResponseCode, - HttpContentType ContentType, - std::span Blobs); + HttpMessageResponseRequest(HttpSysTransaction& InRequest, + uint16_t ResponseCode, + HttpContentType ContentType, + eastl::span Blobs); ~HttpMessageResponseRequest(); virtual void IssueRequest(std::error_code& ErrorCode) override final; @@ -392,7 +392,7 @@ private: HttpContentType m_ContentType = HttpContentType::kBinary; eastl::fixed_vector m_DataBuffers; - void InitializeForPayload(uint16_t ResponseCode, std::span Blobs); + void InitializeForPayload(uint16_t ResponseCode, eastl::span Blobs); }; HttpMessageResponseRequest::HttpMessageResponseRequest(HttpSysTransaction& InRequest, uint16_t ResponseCode) @@ -427,10 +427,10 @@ HttpMessageResponseRequest::HttpMessageResponseRequest(HttpSysTransaction& InReq InitializeForPayload(ResponseCode, SingleBufferList); } -HttpMessageResponseRequest::HttpMessageResponseRequest(HttpSysTransaction& InRequest, - uint16_t ResponseCode, - HttpContentType ContentType, - std::span BlobList) +HttpMessageResponseRequest::HttpMessageResponseRequest(HttpSysTransaction& InRequest, + uint16_t ResponseCode, + HttpContentType ContentType, + eastl::span BlobList) : HttpSysRequestHandler(InRequest) , m_ContentType(ContentType) { @@ -442,7 +442,7 @@ HttpMessageResponseRequest::~HttpMessageResponseRequest() } void -HttpMessageResponseRequest::InitializeForPayload(uint16_t ResponseCode, std::span BlobList) +HttpMessageResponseRequest::InitializeForPayload(uint16_t ResponseCode, eastl::span BlobList) { ZEN_TRACE_CPU("httpsys::InitializeForPayload"); @@ -1747,7 +1747,7 @@ HttpSysServerRequest::WriteResponse(HttpResponseCode ResponseCode) } void -HttpSysServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::span Blobs) +HttpSysServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span Blobs) { ZEN_MEMSCOPE(GetHttpsysTag()); diff --git a/src/zenhttp/servers/httptracer.cpp b/src/zenhttp/servers/httptracer.cpp index 6a243c36b..1df9cc64a 100644 --- a/src/zenhttp/servers/httptracer.cpp +++ b/src/zenhttp/servers/httptracer.cpp @@ -18,7 +18,7 @@ HttpServerTracer::Initialize(std::filesystem::path DataDir) } void -HttpServerTracer::WriteDebugPayload(std::string_view Filename, const std::span Payload) +HttpServerTracer::WriteDebugPayload(std::string_view Filename, const eastl::span Payload) { uint64_t PayloadSize = 0; eastl::vector Buffers; diff --git a/src/zenhttp/servers/httptracer.h b/src/zenhttp/servers/httptracer.h index da72c79c9..a89e5331d 100644 --- a/src/zenhttp/servers/httptracer.h +++ b/src/zenhttp/servers/httptracer.h @@ -16,7 +16,7 @@ class HttpServerTracer { public: void Initialize(std::filesystem::path DataDir); - void WriteDebugPayload(std::string_view Filename, const std::span Payload); + void WriteDebugPayload(std::string_view Filename, const eastl::span Payload); private: std::filesystem::path m_DataDir; // Application data directory diff --git a/src/zenserver-test/zenserver-test.cpp b/src/zenserver-test/zenserver-test.cpp index 0dbe2cb4b..b635aaa5e 100644 --- a/src/zenserver-test/zenserver-test.cpp +++ b/src/zenserver-test/zenserver-test.cpp @@ -40,11 +40,11 @@ ZEN_THIRD_PARTY_INCLUDES_START #undef GetObject ZEN_THIRD_PARTY_INCLUDES_END +#include #include #include #include #include -#include #include #include #include @@ -554,7 +554,7 @@ namespace utils { return New(Port, fmt::format("--debug --upstream-thread-count=0 --upstream-zen-url=http://localhost:{}", UpstreamPort)); } - static ZenConfig NewWithThreadedUpstreams(uint16_t NewPort, std::span UpstreamPorts, bool Debug) + static ZenConfig NewWithThreadedUpstreams(uint16_t NewPort, eastl::span UpstreamPorts, bool Debug) { std::string Args = Debug ? "--debug" : ""; for (uint16_t Port : UpstreamPorts) @@ -598,7 +598,7 @@ namespace utils { return Value; }; - eastl::vector> CreateAttachments(const std::span& Sizes) + eastl::vector> CreateAttachments(const eastl::span& Sizes) { eastl::vector> Result; Result.reserve(Sizes.size()); @@ -610,7 +610,7 @@ namespace utils { return Result; } - eastl::vector> CreateSemiRandomAttachments(const std::span& Sizes) + eastl::vector> CreateSemiRandomAttachments(const eastl::span& Sizes) { eastl::vector> Result; Result.reserve(Sizes.size()); @@ -746,8 +746,8 @@ TEST_CASE("zcache.cbpackage") }; auto IsEqual = [](zen::CbPackage Lhs, zen::CbPackage Rhs) -> bool { - std::span LhsAttachments = Lhs.GetAttachments(); - std::span RhsAttachments = Rhs.GetAttachments(); + eastl::span LhsAttachments = Lhs.GetAttachments(); + eastl::span RhsAttachments = Rhs.GetAttachments(); if (LhsAttachments.size() != RhsAttachments.size()) { @@ -1332,12 +1332,12 @@ TEST_CASE("zcache.rpc") bool Success; }; - auto GetCacheRecords = [](std::string_view BaseUri, - std::string_view Namespace, - std::span Keys, - zen::CachePolicy Policy, - zen::RpcAcceptOptions AcceptOptions = zen::RpcAcceptOptions::kNone, - int Pid = 0) -> GetCacheRecordResult { + auto GetCacheRecords = [](std::string_view BaseUri, + std::string_view Namespace, + eastl::span Keys, + zen::CachePolicy Policy, + zen::RpcAcceptOptions AcceptOptions = zen::RpcAcceptOptions::kNone, + int Pid = 0) -> GetCacheRecordResult { cacherequests::GetCacheRecordsRequest Request = {.AcceptMagic = kCbPkgMagic, .AcceptOptions = static_cast(AcceptOptions), .ProcessPid = Pid, @@ -1732,10 +1732,10 @@ TEST_CASE("zcache.failing.upstream") bool Success = false; }; - auto GetCacheRecords = [](std::string_view BaseUri, - std::string_view Namespace, - std::span Keys, - zen::CachePolicy Policy) -> GetCacheRecordResult { + auto GetCacheRecords = [](std::string_view BaseUri, + std::string_view Namespace, + eastl::span Keys, + zen::CachePolicy Policy) -> GetCacheRecordResult { cacherequests::GetCacheRecordsRequest Request = {.AcceptMagic = kCbPkgMagic, .DefaultPolicy = Policy, .Namespace = std::string(Namespace)}; @@ -2751,7 +2751,7 @@ OidAsString(const Oid& Id) } CbPackage -CreateOplogPackage(const Oid& Id, const std::span>& Attachments) +CreateOplogPackage(const Oid& Id, const eastl::span>& Attachments) { CbPackage Package; CbObjectWriter Object; diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp index 00fa99110..8aef2f7d3 100644 --- a/src/zenserver/config.cpp +++ b/src/zenserver/config.cpp @@ -151,7 +151,7 @@ ParseUpstreamCachePolicy(std::string_view Options) } ZenObjectStoreConfig -ParseBucketConfigs(std::span Buckets) +ParseBucketConfigs(eastl::span Buckets) { using namespace std::literals; diff --git a/src/zenserver/projectstore/httpprojectstore.cpp b/src/zenserver/projectstore/httpprojectstore.cpp index 80e09939a..f80ead49e 100644 --- a/src/zenserver/projectstore/httpprojectstore.cpp +++ b/src/zenserver/projectstore/httpprojectstore.cpp @@ -994,7 +994,7 @@ HttpProjectService::HandleOplogOpPrepRequest(HttpRouterRequest& Req) ChunkList.push_back(Entry.AsHash()); } - NeedList = FoundLog->CheckPendingChunkReferences(std::span(begin(ChunkList), end(ChunkList)), std::chrono::minutes(2)); + NeedList = FoundLog->CheckPendingChunkReferences(eastl::span(begin(ChunkList), end(ChunkList)), std::chrono::minutes(2)); } CbObjectWriter Cbo(1 + 1 + 5 + NeedList.size() * (1 + sizeof(IoHash::Hash)) + 1); @@ -1173,7 +1173,7 @@ HttpProjectService::HandleOplogOpNewRequest(HttpRouterRequest& Req) // Once we stored the op, we no longer need to retain any chunks this op references if (!ReferencedChunks.empty()) { - FoundLog->RemovePendingChunkReferences(std::span(begin(ReferencedChunks), end(ReferencedChunks))); + FoundLog->RemovePendingChunkReferences(eastl::span(begin(ReferencedChunks), end(ReferencedChunks))); } m_ProjectStats.OpWriteCount++; 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 Addresses) const + uint64_t GetEffectiveBlobsSize(eastl::span Addresses) const { uint64_t EffectiveSize = 0; for (const OplogEntryAddress& Address : Addresses) @@ -583,7 +583,7 @@ struct ProjectStore::OplogStorage : public RefCounted } void Compact( - std::span LSNs, + eastl::span LSNs, std::function&& Callback, bool RetainLSNs, bool DryRun) @@ -901,7 +901,7 @@ struct ProjectStore::OplogStorage : public RefCounted InvalidEntries); } - void ReplayLogEntries(const std::span Entries, std::function&& Handler) + void ReplayLogEntries(const eastl::span Entries, std::function&& Handler) { ZEN_MEMSCOPE(GetProjectstoreTag()); ZEN_TRACE_CPU("Store::OplogStorage::ReplayLogEntries"); @@ -993,7 +993,7 @@ struct ProjectStore::OplogStorage : public RefCounted return Entry; } - eastl::vector AppendOps(std::span Ops) + eastl::vector AppendOps(eastl::span 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 RawHashes, +ProjectStore::Oplog::IterateChunks(eastl::span RawHashes, bool IncludeModTag, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, @@ -2103,7 +2103,7 @@ ProjectStore::Oplog::IterateChunks(std::span RawHashes, } bool -ProjectStore::Oplog::IterateChunks(std::span ChunkIds, +ProjectStore::Oplog::IterateChunks(eastl::span ChunkIds, bool IncludeModTag, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, @@ -2368,13 +2368,13 @@ ProjectStore::Oplog::IterateOplog(std::function&& Handler, c } template -std::span +eastl::span CreateSpanFromPaging(eastl::vector& Container, const ProjectStore::Oplog::Paging& Paging) { - std::span 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(Paging.Count, Size - Start)); + eastl::span 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(Paging.Count, Size - Start)); return Span.subspan(Start, End - Start); } @@ -2403,7 +2403,7 @@ ProjectStore::Oplog::IterateOplogLocked(std::function&& Hand return Lhs.Offset < Rhs.Offset; }); - std::span EntrySpan = CreateSpanFromPaging(Entries, EntryPaging); + eastl::span EntrySpan = CreateSpanFromPaging(Entries, EntryPaging); m_Storage->ReplayLogEntries(EntrySpan, [&](CbObjectView Op) { Handler(Op); }); } @@ -2428,7 +2428,7 @@ ProjectStore::Oplog::GetAttachmentsLocked(eastl::vector& OutAttachments, if (GetAttachmentsFromMetaData( MetadataPayload, OplogMetaDataExpectedMagic, - [&](std::span Keys, std::span AttachmentCounts, std::span Attachments) { + [&](eastl::span Keys, eastl::span AttachmentCounts, eastl::span Attachments) { ZEN_UNUSED(Keys); ZEN_UNUSED(AttachmentCounts); OutAttachments.insert(OutAttachments.end(), Attachments.begin(), Attachments.end()); @@ -2463,7 +2463,7 @@ ProjectStore::Oplog::GetAttachmentsLocked(eastl::vector& OutAttachments, IoBuffer MetaPayload = BuildReferenceMetaData(OplogMetaDataExpectedMagic, Keys, AttachmentCounts, - std::span(FirstAttachment, AttachmentCount)) + eastl::span(FirstAttachment, AttachmentCount)) .Flatten() .AsIoBuffer(); @@ -2559,8 +2559,8 @@ ProjectStore::Oplog::IterateOplogWithKey(std::function EntrySpan = CreateSpanFromPaging(SortedEntries, EntryPaging); - size_t EntryIndex = EntrySpan.empty() ? 0 : static_cast(&EntrySpan.front() - &SortedEntries.front()); + eastl::span EntrySpan = CreateSpanFromPaging(SortedEntries, EntryPaging); + size_t EntryIndex = EntrySpan.empty() ? 0 : static_cast(&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 AttachmentHashes) +ProjectStore::Oplog::CaptureAddedAttachments(eastl::span AttachmentHashes) { ZEN_MEMSCOPE(GetProjectstoreTag()); @@ -2717,7 +2717,7 @@ ProjectStore::Oplog::GetCapturedAttachmentsLocked() } eastl::vector -ProjectStore::Oplog::CheckPendingChunkReferences(std::span ChunkHashes, const GcClock::Duration& RetainTime) +ProjectStore::Oplog::CheckPendingChunkReferences(eastl::span ChunkHashes, const GcClock::Duration& RetainTime) { ZEN_MEMSCOPE(GetProjectstoreTag()); @@ -2749,7 +2749,7 @@ ProjectStore::Oplog::CheckPendingChunkReferences(std::span ChunkHa } void -ProjectStore::Oplog::RemovePendingChunkReferences(std::span ChunkHashes) +ProjectStore::Oplog::RemovePendingChunkReferences(eastl::span ChunkHashes) { ZEN_MEMSCOPE(GetProjectstoreTag()); @@ -3060,7 +3060,7 @@ ProjectStore::Oplog::AppendNewOplogEntry(CbObjectView Core) } eastl::vector -ProjectStore::Oplog::AppendNewOplogEntries(std::span Cores) +ProjectStore::Oplog::AppendNewOplogEntries(eastl::span 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 RawHashes) { Oplog->CaptureAddedAttachments(RawHashes); }; + auto OnReferencedAttachments = [&Oplog](eastl::span 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 Attachments = Package.GetAttachments(); + eastl::span Attachments = Package.GetAttachments(); if (!Attachments.empty()) { eastl::vector WriteAttachmentBuffers; @@ -6268,7 +6268,7 @@ public: FilterReferences(Ctx, fmt::format("projectstore [LOCKSTATE] '{}'", "projectstore"), m_References); } - virtual std::span GetUnusedReferences(GcCtx& Ctx, std::span IoCids) override + virtual eastl::span GetUnusedReferences(GcCtx& Ctx, eastl::span IoCids) override { ZEN_TRACE_CPU("Store::GetUnusedReferences"); @@ -6290,8 +6290,8 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span UnusedReferences = KeepUnusedReferences(m_References, IoCids); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span 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 GetUnusedReferences(GcCtx& Ctx, std::span IoCids) override + virtual eastl::span GetUnusedReferences(GcCtx& Ctx, eastl::span IoCids) override { ZEN_TRACE_CPU("Store::Oplog::GetUnusedReferences"); @@ -6476,9 +6476,9 @@ public: m_OplogId); }); - std::span UnusedReferences = KeepUnusedReferences(m_References, IoCids); - UnusedReferences = KeepUnusedReferences(m_AddedReferences, UnusedReferences); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span 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>& Attachments) + CbPackage CreateBulkDataOplogPackage(const Oid& Id, const eastl::span>& 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>& Attachments) + CbPackage CreateFilesOplogPackage(const Oid& Id, + const std::filesystem::path ProjectRootDir, + const eastl::span>& Attachments) { CbPackage Package; CbObjectWriter Object; @@ -6789,9 +6789,9 @@ namespace testutils { }; eastl::vector> CreateAttachments( - const std::span& Sizes, - OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, - uint64_t BlockSize = 0) + const eastl::span& Sizes, + OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, + uint64_t BlockSize = 0) { eastl::vector> Result; Result.reserve(Sizes.size()); diff --git a/src/zenserver/projectstore/projectstore.h b/src/zenserver/projectstore/projectstore.h index b502bd6dc..ccba87d04 100644 --- a/src/zenserver/projectstore/projectstore.h +++ b/src/zenserver/projectstore/projectstore.h @@ -122,12 +122,12 @@ public: IoBuffer FindChunk(const Oid& ChunkId, uint64_t* OptOutModificationTag); IoBuffer GetChunkByRawHash(const IoHash& RawHash); - bool IterateChunks(std::span RawHashes, + bool IterateChunks(eastl::span RawHashes, bool IncludeModTag, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit); - bool IterateChunks(std::span ChunkIds, + bool IterateChunks(eastl::span ChunkIds, bool IncludeModTag, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, @@ -141,7 +141,7 @@ public: uint32_t AppendNewOplogEntry(CbPackage Op); uint32_t AppendNewOplogEntry(CbObjectView Core); - eastl::vector AppendNewOplogEntries(std::span Cores); + eastl::vector AppendNewOplogEntries(eastl::span Cores); enum UpdateType { @@ -173,10 +173,10 @@ public: void EnableUpdateCapture(); void DisableUpdateCapture(); - void CaptureAddedAttachments(std::span AttachmentHashes); + void CaptureAddedAttachments(eastl::span AttachmentHashes); eastl::vector GetCapturedAttachmentsLocked(); - eastl::vector CheckPendingChunkReferences(std::span ChunkHashes, const GcClock::Duration& RetainTime); - void RemovePendingChunkReferences(std::span ChunkHashes); + eastl::vector CheckPendingChunkReferences(eastl::span ChunkHashes, const GcClock::Duration& RetainTime); + void RemovePendingChunkReferences(eastl::span ChunkHashes); eastl::vector GetPendingChunkReferencesLocked(); RwLock::SharedLockScope GetGcReferencerLock() { return RwLock::SharedLockScope(m_OplogLock); } diff --git a/src/zenserver/projectstore/remoteprojectstore.cpp b/src/zenserver/projectstore/remoteprojectstore.cpp index 41f20d760..8c657ab5b 100644 --- a/src/zenserver/projectstore/remoteprojectstore.cpp +++ b/src/zenserver/projectstore/remoteprojectstore.cpp @@ -1104,7 +1104,7 @@ GetBlockHashesFromOplog(CbObjectView ContainerObject) } eastl::vector -GetBlocksFromOplog(CbObjectView ContainerObject, std::span IncludeBlockHashes) +GetBlocksFromOplog(CbObjectView ContainerObject, eastl::span IncludeBlockHashes) { using namespace std::literals; eastl::vector Result; @@ -1650,7 +1650,7 @@ BuildContainer(CidStore& ChunkStore, CompositeBuffer Decompressed = Compressed.DecompressToComposite(); if (Decompressed) { - std::span Segments = Decompressed.GetSegments(); + eastl::span Segments = Decompressed.GetSegments(); if (Segments.size() == 1) { IoBuffer DecompressedData = Segments[0].AsIoBuffer(); @@ -2634,7 +2634,7 @@ SaveOplog(CidStore& ChunkStore, RemoteProjectStore::Result ParseOplogContainer(const CbObject& ContainerObject, - const std::function RawHashes)>& OnReferencedAttachments, + const std::function RawHashes)>& OnReferencedAttachments, const std::function& HasAttachment, const std::function&& Chunks)>& OnNeedBlock, const std::function& OnNeedAttachment, @@ -2778,7 +2778,7 @@ ParseOplogContainer(const CbObject& ContainerObject, RemoteProjectStore::Result SaveOplogContainer(ProjectStore::Oplog& Oplog, const CbObject& ContainerObject, - const std::function RawHashes)>& OnReferencedAttachments, + const std::function RawHashes)>& OnReferencedAttachments, const std::function& HasAttachment, const std::function&& Chunks)>& OnNeedBlock, const std::function& OnNeedAttachment, @@ -2975,7 +2975,7 @@ LoadOplog(CidStore& ChunkStore, } }; - auto OnReferencedAttachments = [&Oplog](std::span RawHashes) { Oplog.CaptureAddedAttachments(RawHashes); }; + auto OnReferencedAttachments = [&Oplog](eastl::span RawHashes) { Oplog.CaptureAddedAttachments(RawHashes); }; // Make sure we retain any attachments we download before writing the oplog Oplog.EnableUpdateCapture(); diff --git a/src/zenserver/projectstore/remoteprojectstore.h b/src/zenserver/projectstore/remoteprojectstore.h index 26788179d..582194022 100644 --- a/src/zenserver/projectstore/remoteprojectstore.h +++ b/src/zenserver/projectstore/remoteprojectstore.h @@ -140,7 +140,7 @@ class JobContext; RemoteProjectStore::Result SaveOplogContainer( ProjectStore::Oplog& Oplog, const CbObject& ContainerObject, - const std::function RawHashes)>& OnReferencedAttachments, + const std::function RawHashes)>& OnReferencedAttachments, const std::function& HasAttachment, const std::function&& Chunks)>& OnNeedBlock, const std::function& OnNeedAttachment, @@ -168,6 +168,6 @@ RemoteProjectStore::Result LoadOplog(CidStore& ChunkStore, JobContext* OptionalContext); eastl::vector GetBlockHashesFromOplog(CbObjectView ContainerObject); -eastl::vector GetBlocksFromOplog(CbObjectView ContainerObject, std::span IncludeBlockHashes); +eastl::vector GetBlocksFromOplog(CbObjectView ContainerObject, eastl::span IncludeBlockHashes); } // namespace zen diff --git a/src/zenserver/projectstore/zenremoteprojectstore.cpp b/src/zenserver/projectstore/zenremoteprojectstore.cpp index 0f6be6d6a..43981004f 100644 --- a/src/zenserver/projectstore/zenremoteprojectstore.cpp +++ b/src/zenserver/projectstore/zenremoteprojectstore.cpp @@ -191,8 +191,8 @@ public: } else { - CbPackage Package = Response.AsPackage(); - std::span Attachments = Package.GetAttachments(); + CbPackage Package = Response.AsPackage(); + eastl::span Attachments = Package.GetAttachments(); Result.Chunks.reserve(Attachments.size()); for (const CbAttachment& Attachment : Attachments) { diff --git a/src/zenserver/upstream/upstreamcache.cpp b/src/zenserver/upstream/upstreamcache.cpp index 5ddc141d4..a54e77103 100644 --- a/src/zenserver/upstream/upstreamcache.cpp +++ b/src/zenserver/upstream/upstreamcache.cpp @@ -295,9 +295,9 @@ namespace detail { } } - virtual GetUpstreamCacheResult GetCacheRecords(std::string_view Namespace, - std::span Requests, - OnCacheRecordGetComplete&& OnComplete) override + virtual GetUpstreamCacheResult GetCacheRecords(std::string_view Namespace, + eastl::span Requests, + OnCacheRecordGetComplete&& OnComplete) override { ZEN_TRACE_CPU("Upstream::Jupiter::GetCacheRecords"); @@ -392,9 +392,9 @@ namespace detail { } } - virtual GetUpstreamCacheResult GetCacheChunks(std::string_view Namespace, - std::span CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) override final + virtual GetUpstreamCacheResult GetCacheChunks(std::string_view Namespace, + eastl::span CacheChunkRequests, + OnCacheChunksGetComplete&& OnComplete) override final { ZEN_TRACE_CPU("Upstream::Jupiter::GetCacheChunks"); @@ -447,9 +447,9 @@ namespace detail { return Result; } - virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, - std::span CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) override final + virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, + eastl::span CacheValueRequests, + OnCacheValueGetComplete&& OnComplete) override final { ZEN_TRACE_CPU("Upstream::Jupiter::GetCacheValues"); @@ -522,9 +522,9 @@ namespace detail { return Result; } - virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, - IoBuffer RecordValue, - std::span Values) override + virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, + IoBuffer RecordValue, + eastl::span Values) override { ZEN_TRACE_CPU("Upstream::Jupiter::PutCacheRecord"); @@ -646,7 +646,7 @@ namespace detail { double TotalElapsedSeconds = 0.0; std::string_view BlobStoreNamespace = GetActualBlobStoreNamespace(Namespace); - const auto PutBlobs = [&](std::span ValueContentIds, std::string& OutReason) -> bool { + const auto PutBlobs = [&](eastl::span ValueContentIds, std::string& OutReason) -> bool { for (const IoHash& ValueContentId : ValueContentIds) { IoBuffer BlobBuffer; @@ -865,9 +865,9 @@ namespace detail { } } - virtual GetUpstreamCacheResult GetCacheRecords(std::string_view Namespace, - std::span Requests, - OnCacheRecordGetComplete&& OnComplete) override + virtual GetUpstreamCacheResult GetCacheRecords(std::string_view Namespace, + eastl::span Requests, + OnCacheRecordGetComplete&& OnComplete) override { ZEN_TRACE_CPU("Upstream::Zen::GetCacheRecords"); ZEN_ASSERT(Requests.size() > 0); @@ -988,9 +988,9 @@ namespace detail { } } - virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, - std::span CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) override final + virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, + eastl::span CacheValueRequests, + OnCacheValueGetComplete&& OnComplete) override final { ZEN_TRACE_CPU("Upstream::Zen::GetCacheValues"); ZEN_ASSERT(!CacheValueRequests.empty()); @@ -1108,9 +1108,9 @@ namespace detail { return {.Error{.ErrorCode = Result.ErrorCode, .Reason = std::move(Result.Reason)}}; } - virtual GetUpstreamCacheResult GetCacheChunks(std::string_view Namespace, - std::span CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) override final + virtual GetUpstreamCacheResult GetCacheChunks(std::string_view Namespace, + eastl::span CacheChunkRequests, + OnCacheChunksGetComplete&& OnComplete) override final { ZEN_TRACE_CPU("Upstream::Zen::GetCacheChunks"); ZEN_ASSERT(!CacheChunkRequests.empty()); @@ -1244,9 +1244,9 @@ namespace detail { return {.Error{.ErrorCode = Result.ErrorCode, .Reason = std::move(Result.Reason)}}; } - virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, - IoBuffer RecordValue, - std::span Values) override + virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, + IoBuffer RecordValue, + eastl::span Values) override { ZEN_TRACE_CPU("Upstream::Zen::PutCacheRecord"); @@ -1586,9 +1586,9 @@ public: return {}; } - virtual void GetCacheRecords(std::string_view Namespace, - std::span Requests, - OnCacheRecordGetComplete&& OnComplete) override final + virtual void GetCacheRecords(std::string_view Namespace, + eastl::span Requests, + OnCacheRecordGetComplete&& OnComplete) override final { ZEN_TRACE_CPU("Upstream::GetCacheRecords"); @@ -1654,9 +1654,9 @@ public: } } - virtual void GetCacheChunks(std::string_view Namespace, - std::span CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) override final + virtual void GetCacheChunks(std::string_view Namespace, + eastl::span CacheChunkRequests, + OnCacheChunksGetComplete&& OnComplete) override final { ZEN_TRACE_CPU("Upstream::GetCacheChunks"); @@ -1767,9 +1767,9 @@ public: return {}; } - virtual void GetCacheValues(std::string_view Namespace, - std::span CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) override final + virtual void GetCacheValues(std::string_view Namespace, + eastl::span CacheValueRequests, + OnCacheValueGetComplete&& OnComplete) override final { ZEN_TRACE_CPU("Upstream::GetCacheValues"); @@ -1945,7 +1945,7 @@ private: PutUpstreamCacheResult Result; { metrics::OperationTiming::Scope Scope(Stats.CachePutRequestTiming); - Result = Endpoint->PutCacheRecord(CacheRecord, CacheValue.Value, std::span(Payloads)); + Result = Endpoint->PutCacheRecord(CacheRecord, CacheValue.Value, eastl::span(Payloads)); } Stats.CachePutTotalBytes.Increment(Result.Bytes); diff --git a/src/zenserver/upstream/upstreamcache.h b/src/zenserver/upstream/upstreamcache.h index 219f2474e..16f921885 100644 --- a/src/zenserver/upstream/upstreamcache.h +++ b/src/zenserver/upstream/upstreamcache.h @@ -107,22 +107,22 @@ public: virtual UpstreamEndpointStatus GetStatus() = 0; virtual GetUpstreamCacheSingleResult GetCacheRecord(std::string_view Namespace, const CacheKey& CacheKey, ZenContentType Type) = 0; - virtual GetUpstreamCacheResult GetCacheRecords(std::string_view Namespace, - std::span Requests, - OnCacheRecordGetComplete&& OnComplete) = 0; + virtual GetUpstreamCacheResult GetCacheRecords(std::string_view Namespace, + eastl::span Requests, + OnCacheRecordGetComplete&& OnComplete) = 0; - virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, - std::span CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) = 0; + virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, + eastl::span CacheValueRequests, + OnCacheValueGetComplete&& OnComplete) = 0; virtual GetUpstreamCacheSingleResult GetCacheChunk(std::string_view Namespace, const CacheKey& CacheKey, const IoHash& PayloadId) = 0; - virtual GetUpstreamCacheResult GetCacheChunks(std::string_view Namespace, - std::span CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) = 0; + virtual GetUpstreamCacheResult GetCacheChunks(std::string_view Namespace, + eastl::span CacheChunkRequests, + OnCacheChunksGetComplete&& OnComplete) = 0; - virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, - IoBuffer RecordValue, - std::span Payloads) = 0; + virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, + IoBuffer RecordValue, + eastl::span Payloads) = 0; virtual UpstreamEndpointStats& Stats() = 0; diff --git a/src/zenserver/upstream/zen.h b/src/zenserver/upstream/zen.h index 78b6bc589..2ef5dd660 100644 --- a/src/zenserver/upstream/zen.h +++ b/src/zenserver/upstream/zen.h @@ -45,11 +45,11 @@ struct ZenCacheResult struct ZenStructuredCacheClientOptions { - std::string_view Name; - std::string_view Url; - std::span Urls; - std::chrono::milliseconds ConnectTimeout{}; - std::chrono::milliseconds Timeout{}; + std::string_view Name; + std::string_view Url; + eastl::span Urls; + std::chrono::milliseconds ConnectTimeout{}; + std::chrono::milliseconds Timeout{}; }; /** Zen Structured Cache session diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp index 7df9117db..8a196db33 100644 --- a/src/zenstore/blockstore.cpp +++ b/src/zenstore/blockstore.cpp @@ -578,7 +578,7 @@ BlockStore::WriteChunk(const void* Data, uint64_t Size, uint32_t Alignment, cons } void -BlockStore::WriteChunks(std::span Datas, uint32_t Alignment, const WriteChunksCallback& Callback) +BlockStore::WriteChunks(eastl::span Datas, uint32_t Alignment, const WriteChunksCallback& Callback) { ZEN_MEMSCOPE(GetBlocksTag()); ZEN_TRACE_CPU("BlockStore::WriteChunks"); @@ -721,8 +721,8 @@ BlockStore::Flush(bool ForceNewBlock) } bool -BlockStore::IterateBlock(std::span ChunkLocations, - std::span InChunkIndexes, +BlockStore::IterateBlock(eastl::span ChunkLocations, + eastl::span InChunkIndexes, const IterateChunksSmallSizeCallback& SmallSizeCallback, const IterateChunksLargeSizeCallback& LargeSizeCallback, uint64_t LargeSizeLimit) @@ -752,10 +752,10 @@ BlockStore::IterateBlock(std::span ChunkLocations, return ChunkLocations[IndexA].Offset < ChunkLocations[IndexB].Offset; }); - auto GetNextRange = [LargeSizeLimit, - IterateSmallChunkWindowSize, - IterateSmallChunkMaxGapSize, - &ChunkLocations](uint64_t BlockFileSize, std::span ChunkIndexes, size_t StartIndexOffset) -> size_t { + auto GetNextRange = [LargeSizeLimit, IterateSmallChunkWindowSize, IterateSmallChunkMaxGapSize, &ChunkLocations]( + uint64_t BlockFileSize, + eastl::span ChunkIndexes, + size_t StartIndexOffset) -> size_t { size_t ChunkCount = 0; size_t StartIndex = ChunkIndexes[StartIndexOffset]; const BlockStoreLocation& StartLocation = ChunkLocations[StartIndex]; @@ -882,7 +882,7 @@ BlockStore::IterateBlock(std::span ChunkLocations, } bool -BlockStore::IterateChunks(const std::span& ChunkLocations, const IterateChunksCallback& Callback) +BlockStore::IterateChunks(const eastl::span& ChunkLocations, const IterateChunksCallback& Callback) { ZEN_MEMSCOPE(GetBlocksTag()); ZEN_TRACE_CPU("BlockStore::IterateChunks"); @@ -903,9 +903,9 @@ BlockStore::IterateChunks(const std::span& ChunkLocati std::sort(ChunkOrder.begin(), ChunkOrder.end(), [&ChunkLocations](const size_t Lhs, const size_t Rhs) { return ChunkLocations[Lhs].BlockIndex < ChunkLocations[Rhs].BlockIndex; }); - size_t RangeStart = 0; - size_t RangeEnd = 0; - const std::span ChunkIndexRange(ChunkOrder); + size_t RangeStart = 0; + size_t RangeEnd = 0; + const eastl::span ChunkIndexRange(ChunkOrder); while (RangeStart < ChunkOrder.size()) { const size_t ChunkIndex = ChunkOrder[RangeStart]; @@ -1461,7 +1461,7 @@ TEST_CASE("blockstore.multichunks") BlockStoreLocation Locations[5]; size_t ChunkOffset = 0; - Store.WriteChunks(MultiChunkData, 4, [&](std::span InLocations) { + Store.WriteChunks(MultiChunkData, 4, [&](eastl::span InLocations) { for (const BlockStoreLocation& Location : InLocations) { Locations[ChunkOffset++] = Location; @@ -1484,7 +1484,7 @@ TEST_CASE("blockstore.multichunks") "ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ_93"; MultiChunkData.push_back(IoBuffer(IoBuffer::Wrap, FifthChunkData.data(), FifthChunkData.size())); - Store.WriteChunks(MultiChunkData, 4, [&](std::span InLocations) { + Store.WriteChunks(MultiChunkData, 4, [&](eastl::span InLocations) { for (const BlockStoreLocation& Location : InLocations) { CHECK(ChunkOffset < 5); @@ -1595,7 +1595,7 @@ TEST_CASE("blockstore.iterate.chunks") BadLocationOutOfRange, BadBlockIndex}; Latch WorkLatch(1); - Store.IterateChunks(Locations, [&](uint32_t, std::span ChunkIndexes) -> bool { + Store.IterateChunks(Locations, [&](uint32_t, eastl::span ChunkIndexes) -> bool { WorkLatch.AddCount(1); WorkerPool.ScheduleWork([&, ChunkIndexes = eastl::vector(ChunkIndexes.begin(), ChunkIndexes.end())]() { auto _ = MakeGuard([&WorkLatch]() { WorkLatch.CountDown(); }); diff --git a/src/zenstore/cache/cachedisklayer.cpp b/src/zenstore/cache/cachedisklayer.cpp index 2f648bc2d..bbd38d737 100644 --- a/src/zenstore/cache/cachedisklayer.cpp +++ b/src/zenstore/cache/cachedisklayer.cpp @@ -1266,7 +1266,7 @@ ZenCacheDiskLayer::CacheBucket::EndPutBatch(PutBatchHandle* Batch) noexcept } size_t IndexOffset = 0; - m_BlockStore.WriteChunks(Batch->Buffers, m_Configuration.PayloadAlignment, [&](std::span Locations) { + m_BlockStore.WriteChunks(Batch->Buffers, m_Configuration.PayloadAlignment, [&](eastl::span Locations) { ZEN_MEMSCOPE(GetCacheDiskTag()); eastl::vector DiskEntries; { @@ -1527,12 +1527,12 @@ ZenCacheDiskLayer::CacheBucket::EndGetBatch(GetBatchHandle* Batch) noexcept { ZEN_TRACE_CPU("Z$::Bucket::EndGetBatch::ReadInline"); m_BlockStore.IterateChunks( - std::span{begin(InlineBlockLocations), end(InlineBlockLocations)}, - [&](uint32_t, std::span ChunkIndexes) -> bool { + eastl::span{begin(InlineBlockLocations), end(InlineBlockLocations)}, + [&](uint32_t, eastl::span ChunkIndexes) -> bool { // Only read into memory the IoBuffers we could potentially add to memcache const uint64_t LargeChunkSizeLimit = Max(m_Configuration.MemCacheSizeThreshold, 1u * 1024u); m_BlockStore.IterateBlock( - std::span{begin(InlineBlockLocations), end(InlineBlockLocations)}, + eastl::span{begin(InlineBlockLocations), end(InlineBlockLocations)}, ChunkIndexes, [this, &FillOne, &InlineDiskLocations, &InlineKeyIndexes](size_t ChunkIndex, const void* Data, @@ -1798,7 +1798,7 @@ ZenCacheDiskLayer::CacheBucket::Get(const IoHash& HashKey, ZenCacheValue& OutVal void ZenCacheDiskLayer::CacheBucket::Put(const IoHash& HashKey, const ZenCacheValue& Value, - std::span References, + eastl::span References, PutBatchHandle* OptionalBatchHandle) { ZEN_TRACE_CPU("Z$::Bucket::Put"); @@ -2236,7 +2236,7 @@ ZenCacheDiskLayer::CacheBucket::ScrubStorage(ScrubContext& Ctx) return true; }; - m_BlockStore.IterateChunks(ChunkLocations, [&](uint32_t, std::span ChunkIndexes) { + m_BlockStore.IterateChunks(ChunkLocations, [&](uint32_t, eastl::span ChunkIndexes) { return m_BlockStore.IterateBlock(ChunkLocations, ChunkIndexes, ValidateSmallChunk, ValidateLargeChunk, 0); }); } @@ -2404,7 +2404,7 @@ ZenCacheDiskLayer::CacheBucket::EnumerateBucketContents( } void -ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, std::span References) +ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, eastl::span References) { ZEN_TRACE_CPU("Z$::Bucket::PutStandaloneCacheValue"); @@ -2651,7 +2651,7 @@ ZenCacheDiskLayer::CacheBucket::GetMetaData(RwLock::SharedLockScope&, const Buck void ZenCacheDiskLayer::CacheBucket::PutInlineCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, - std::span References, + eastl::span References, PutBatchHandle* OptionalBatchHandle) { ZEN_TRACE_CPU("Z$::Bucket::PutInlineCacheValue"); @@ -3098,10 +3098,10 @@ ZenCacheDiskLayer::CacheBucket::RemoveExpiredData(GcCtx& Ctx, GcStats& Stats) } bool -ZenCacheDiskLayer::CacheBucket::ReadAttachmentsFromMetaData(uint32_t BlockIndex, - std::span InlineKeys, - std::span ChunkIndexes, - eastl::vector& OutReferences) const +ZenCacheDiskLayer::CacheBucket::ReadAttachmentsFromMetaData(uint32_t BlockIndex, + eastl::span InlineKeys, + eastl::span ChunkIndexes, + eastl::vector& OutReferences) const { ZEN_TRACE_CPU("Z$::Bucket::ReadAttachmentsFromMetaData"); IoBuffer MetaDataPayload = m_BlockStore.GetMetaData(BlockIndex); @@ -3117,7 +3117,7 @@ ZenCacheDiskLayer::CacheBucket::ReadAttachmentsFromMetaData(uint32_t BlockI return GetAttachmentsFromMetaData( MetaDataPayload, cache::impl::BlockMetaDataExpectedMagic, - [&](std::span Keys, std::span AttachmentCounts, std::span Attachments) { + [&](eastl::span Keys, eastl::span AttachmentCounts, eastl::span Attachments) { auto AttachmentReadIt = Attachments.begin(); OutReferences.resize(OutReferences.size() + Attachments.size()); auto OutReferencesWriteIt = OutReferences.end() - Attachments.size(); @@ -3296,7 +3296,7 @@ ZenCacheDiskLayer::CacheBucket::GetReferences(const LoggerRef& Logger, cache::impl::BlockMetaDataExpectedMagic, Keys, AttachmentCounts, - std::span(OutReferences) + eastl::span(OutReferences) .subspan(PrecachedReferencesStart, OutReferences.size() - PrecachedReferencesStart)) .Flatten() .AsIoBuffer(); @@ -3421,7 +3421,7 @@ public: FilterReferences(Ctx, fmt::format("cachebucket [LOCKSTATE] '{}'", m_CacheBucket.m_BucketDir), m_AddedReferences); } - virtual std::span GetUnusedReferences(GcCtx& Ctx, std::span IoCids) override + virtual eastl::span GetUnusedReferences(GcCtx& Ctx, eastl::span IoCids) override { ZEN_TRACE_CPU("Z$::Bucket::GetUnusedReferences"); @@ -3443,9 +3443,9 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span UnusedReferences = KeepUnusedReferences(m_PrecachedReferences, IoCids); - UnusedReferences = KeepUnusedReferences(m_AddedReferences, UnusedReferences); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span UnusedReferences = KeepUnusedReferences(m_PrecachedReferences, IoCids); + UnusedReferences = KeepUnusedReferences(m_AddedReferences, UnusedReferences); + UsedCount = IoCids.size() - UnusedReferences.size(); return UnusedReferences; } @@ -3857,7 +3857,7 @@ void ZenCacheDiskLayer::Put(std::string_view InBucket, const IoHash& HashKey, const ZenCacheValue& Value, - std::span References, + eastl::span References, PutBatchHandle* OptionalBatchHandle) { ZEN_TRACE_CPU("Z$::Put"); diff --git a/src/zenstore/cache/structuredcachestore.cpp b/src/zenstore/cache/structuredcachestore.cpp index 87c95f8a2..d86cbf414 100644 --- a/src/zenstore/cache/structuredcachestore.cpp +++ b/src/zenstore/cache/structuredcachestore.cpp @@ -256,7 +256,7 @@ void ZenCacheNamespace::Put(std::string_view InBucket, const IoHash& HashKey, const ZenCacheValue& Value, - std::span References, + eastl::span References, PutBatchHandle* OptionalBatchHandle) { ZEN_TRACE_CPU(OptionalBatchHandle ? "Z$::Namespace::Put(Batched)" : "Z$::Namespace::Put"); @@ -722,7 +722,7 @@ ZenCacheStore::Put(const CacheRequestContext& Context, std::string_view Bucket, const IoHash& HashKey, const ZenCacheValue& Value, - std::span References, + eastl::span References, PutBatch* OptionalBatchHandle) { // Ad hoc rejection of known bad usage patterns for DDC bucket names @@ -1230,7 +1230,7 @@ public: FilterReferences(Ctx, fmt::format("cachestore [LOCKSTATE] '{}'", "cachestore"), m_References); } - virtual std::span GetUnusedReferences(GcCtx& Ctx, std::span IoCids) override + virtual eastl::span GetUnusedReferences(GcCtx& Ctx, eastl::span IoCids) override { ZEN_TRACE_CPU("Z$::GetUnusedReferences"); @@ -1252,8 +1252,8 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span UnusedReferences = KeepUnusedReferences(m_References, IoCids); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span UnusedReferences = KeepUnusedReferences(m_References, IoCids); + UsedCount = IoCids.size() - UnusedReferences.size(); return UnusedReferences; } @@ -1307,7 +1307,7 @@ namespace testutils { std::pair CreateBinaryBlob(size_t Size) { return {Oid::NewOid(), CreateRandomBlob(Size)}; } - eastl::vector> CreateCompressedAttachment(CidStore& Store, const std::span& Sizes) + eastl::vector> CreateCompressedAttachment(CidStore& Store, const eastl::span& Sizes) { eastl::vector> Result; Result.reserve(Sizes.size()); @@ -1321,7 +1321,7 @@ namespace testutils { return Result; } - std::pair CreateRecord(std::span> Attachments) + std::pair CreateRecord(eastl::span> Attachments) { Oid Id = Oid::NewOid(); IoHash Key = ToIoHash(Id); @@ -2103,27 +2103,29 @@ TEST_CASE("cachestore.newgc.basics") std::unordered_map CacheEntries; - auto CreateCacheRecord = - [&](ZenCacheNamespace& Zcs, CidStore& CidStore, std::string_view Bucket, std::span> Attachments) { - eastl::vector AttachmentKeys; - for (const auto& Attachment : Attachments) - { - AttachmentKeys.push_back(Attachment.second.DecodeRawHash()); - } - auto Record = CreateRecord(Attachments); - Zcs.Put(Bucket, - Record.first, - {.Value = Record.second, - .RawSize = Record.second.GetSize(), - .RawHash = IoHash::HashBuffer(Record.second.GetData(), Record.second.GetSize())}, - AttachmentKeys); - for (const auto& Attachment : Attachments) - { - CidStore.AddChunk(Attachment.second.GetCompressed().Flatten().AsIoBuffer(), Attachment.second.DecodeRawHash()); - } - CacheEntries.insert({Record.first, CacheEntry{.Data = Record.second, .Attachments = {Attachments.begin(), Attachments.end()}}}); - return Record.first; - }; + auto CreateCacheRecord = [&](ZenCacheNamespace& Zcs, + CidStore& CidStore, + std::string_view Bucket, + eastl::span> Attachments) { + eastl::vector AttachmentKeys; + for (const auto& Attachment : Attachments) + { + AttachmentKeys.push_back(Attachment.second.DecodeRawHash()); + } + auto Record = CreateRecord(Attachments); + Zcs.Put(Bucket, + Record.first, + {.Value = Record.second, + .RawSize = Record.second.GetSize(), + .RawHash = IoHash::HashBuffer(Record.second.GetData(), Record.second.GetSize())}, + AttachmentKeys); + for (const auto& Attachment : Attachments) + { + CidStore.AddChunk(Attachment.second.GetCompressed().Flatten().AsIoBuffer(), Attachment.second.DecodeRawHash()); + } + CacheEntries.insert({Record.first, CacheEntry{.Data = Record.second, .Attachments = {Attachments.begin(), Attachments.end()}}}); + return Record.first; + }; auto CreateCacheValue = [&](ZenCacheNamespace& Zcs, std::string_view Bucket, size_t Size) { std::pair CacheValue = CreateBinaryBlob(Size); IoHash Key = ToIoHash(CacheValue.first); diff --git a/src/zenstore/cas.cpp b/src/zenstore/cas.cpp index e85383a2a..ce1ebe231 100644 --- a/src/zenstore/cas.cpp +++ b/src/zenstore/cas.cpp @@ -62,13 +62,13 @@ public: virtual void Initialize(const CidStoreConfiguration& InConfig) override; virtual CasStore::InsertResult InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash, InsertMode Mode) override; - virtual eastl::vector InsertChunks(std::span Data, - std::span ChunkHashes, - InsertMode Mode = InsertMode::kMayBeMovedInPlace) override; + virtual eastl::vector InsertChunks(eastl::span Data, + eastl::span ChunkHashes, + InsertMode Mode = InsertMode::kMayBeMovedInPlace) override; virtual IoBuffer FindChunk(const IoHash& ChunkHash) override; virtual bool ContainsChunk(const IoHash& ChunkHash) override; virtual void FilterChunks(HashKeySet& InOutChunks) override; - virtual bool IterateChunks(std::span DecompressedIds, + virtual bool IterateChunks(eastl::span DecompressedIds, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit) override; @@ -260,9 +260,9 @@ CasImpl::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash, InsertMode Mode) static void GetCompactCasResults(CasContainerStrategy& Strategy, - std::span Data, - std::span ChunkHashes, - std::span Indexes, + eastl::span Data, + eastl::span ChunkHashes, + eastl::span Indexes, eastl::vector Results) { const size_t Count = Indexes.size(); @@ -294,9 +294,9 @@ GetCompactCasResults(CasContainerStrategy& Strategy, static void GetFileCasResults(FileCasStrategy& Strategy, CasStore::InsertMode Mode, - std::span Data, - std::span ChunkHashes, - std::span Indexes, + eastl::span Data, + eastl::span ChunkHashes, + eastl::span Indexes, eastl::vector Results) { for (size_t Index : Indexes) @@ -306,7 +306,7 @@ GetFileCasResults(FileCasStrategy& Strategy, }; eastl::vector -CasImpl::InsertChunks(std::span Data, std::span ChunkHashes, CasStore::InsertMode Mode) +CasImpl::InsertChunks(eastl::span Data, eastl::span ChunkHashes, CasStore::InsertMode Mode) { ZEN_MEMSCOPE(GetCasTag()); ZEN_TRACE_CPU("CAS::InsertChunks"); @@ -406,7 +406,7 @@ CasImpl::FilterChunks(HashKeySet& InOutChunks) } bool -CasImpl::IterateChunks(std::span DecompressedIds, +CasImpl::IterateChunks(eastl::span DecompressedIds, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit) diff --git a/src/zenstore/cas.h b/src/zenstore/cas.h index 5e7085d9b..b771a5657 100644 --- a/src/zenstore/cas.h +++ b/src/zenstore/cas.h @@ -39,13 +39,13 @@ public: virtual void Initialize(const CidStoreConfiguration& Config) = 0; virtual InsertResult InsertChunk(IoBuffer Data, const IoHash& ChunkHash, InsertMode Mode = InsertMode::kMayBeMovedInPlace) = 0; - virtual eastl::vector InsertChunks(std::span Data, - std::span ChunkHashes, - InsertMode Mode = InsertMode::kMayBeMovedInPlace) = 0; + virtual eastl::vector InsertChunks(eastl::span Data, + eastl::span ChunkHashes, + InsertMode Mode = InsertMode::kMayBeMovedInPlace) = 0; virtual IoBuffer FindChunk(const IoHash& ChunkHash) = 0; virtual bool ContainsChunk(const IoHash& ChunkHash) = 0; virtual void FilterChunks(HashKeySet& InOutChunks) = 0; - virtual bool IterateChunks(std::span DecompressedIds, + virtual bool IterateChunks(eastl::span DecompressedIds, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit) = 0; diff --git a/src/zenstore/cidstore.cpp b/src/zenstore/cidstore.cpp index ca505cc7a..b0125ca1e 100644 --- a/src/zenstore/cidstore.cpp +++ b/src/zenstore/cidstore.cpp @@ -45,7 +45,9 @@ struct CidStore::Impl return {.New = Result.New}; } - eastl::vector AddChunks(std::span ChunkDatas, std::span RawHashes, CidStore::InsertMode Mode) + eastl::vector AddChunks(eastl::span ChunkDatas, + eastl::span RawHashes, + CidStore::InsertMode Mode) { if (ChunkDatas.size() == 1) { @@ -117,7 +119,7 @@ struct CidStore::Impl InOutChunks.RemoveHashesIf([&](const IoHash& Hash) { return ContainsChunk(Hash); }); } - bool IterateChunks(std::span DecompressedIds, + bool IterateChunks(eastl::span DecompressedIds, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit) @@ -198,7 +200,7 @@ CidStore::AddChunk(const IoBuffer& ChunkData, const IoHash& RawHash, InsertMode } eastl::vector -CidStore::AddChunks(std::span ChunkDatas, std::span RawHashes, InsertMode Mode) +CidStore::AddChunks(eastl::span ChunkDatas, eastl::span RawHashes, InsertMode Mode) { return m_Impl->AddChunks(ChunkDatas, RawHashes, Mode); } @@ -216,7 +218,7 @@ CidStore::ContainsChunk(const IoHash& DecompressedId) } bool -CidStore::IterateChunks(std::span DecompressedIds, +CidStore::IterateChunks(eastl::span DecompressedIds, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit) diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp index 2e331ab34..e0ed14e14 100644 --- a/src/zenstore/compactcas.cpp +++ b/src/zenstore/compactcas.cpp @@ -226,7 +226,7 @@ CasContainerStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash) } eastl::vector -CasContainerStrategy::InsertChunks(std::span Chunks, std::span ChunkHashes) +CasContainerStrategy::InsertChunks(eastl::span Chunks, eastl::span ChunkHashes) { ZEN_MEMSCOPE(GetCasContainerTag()); @@ -263,7 +263,7 @@ CasContainerStrategy::InsertChunks(std::span Chunks, std::span } size_t ChunkOffset = 0; - m_BlockStore.WriteChunks(Datas, m_PayloadAlignment, [&](std::span Locations) { + m_BlockStore.WriteChunks(Datas, m_PayloadAlignment, [&](eastl::span Locations) { ZEN_MEMSCOPE(GetCasContainerTag()); eastl::vector IndexEntries; for (const BlockStoreLocation& Location : Locations) @@ -323,7 +323,7 @@ CasContainerStrategy::FilterChunks(HashKeySet& InOutChunks) } bool -CasContainerStrategy::IterateChunks(std::span ChunkHashes, +CasContainerStrategy::IterateChunks(eastl::span ChunkHashes, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit) @@ -360,7 +360,7 @@ CasContainerStrategy::IterateChunks(std::span ChunkHashes, return true; } - auto DoOneBlock = [&](std::span ChunkIndexes) { + auto DoOneBlock = [&](eastl::span ChunkIndexes) { if (ChunkIndexes.size() < 4) { for (size_t ChunkIndex : ChunkIndexes) @@ -391,7 +391,7 @@ CasContainerStrategy::IterateChunks(std::span ChunkHashes, Latch WorkLatch(1); std::atomic_bool AsyncContinue = true; - bool Continue = m_BlockStore.IterateChunks(FoundChunkLocations, [&](uint32_t BlockIndex, std::span ChunkIndexes) { + bool Continue = m_BlockStore.IterateChunks(FoundChunkLocations, [&](uint32_t BlockIndex, eastl::span ChunkIndexes) { if (OptionalWorkerPool && (ChunkIndexes.size() > 3)) { WorkLatch.AddCount(1); @@ -531,7 +531,7 @@ CasContainerStrategy::ScrubStorage(ScrubContext& Ctx) return true; }; - m_BlockStore.IterateChunks(ChunkLocations, [&](uint32_t, std::span ChunkIndexes) { + m_BlockStore.IterateChunks(ChunkLocations, [&](uint32_t, eastl::span ChunkIndexes) { return m_BlockStore.IterateBlock(ChunkLocations, ChunkIndexes, ValidateSmallChunk, ValidateLargeChunk, 0); }); } @@ -767,9 +767,9 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span UnusedCids = GetUnusedReferences(m_Cids); - Stats.CheckedCount = m_Cids.size(); - Stats.FoundCount = UnusedCids.size(); + eastl::span UnusedCids = GetUnusedReferences(m_Cids); + Stats.CheckedCount = m_Cids.size(); + Stats.FoundCount = UnusedCids.size(); if (!Ctx.Settings.CollectSmallObjects) { @@ -1518,7 +1518,7 @@ TEST_CASE("compactcas.threadedinsert") HashKeySet Deleted; GcStats Stats; GcStoreCompactor* Compactor = - Pruner->RemoveUnreferencedData(Ctx, Stats, [&](std::span References) -> std::span { + Pruner->RemoveUnreferencedData(Ctx, Stats, [&](eastl::span References) -> eastl::span { eastl::vector Unreferenced; HashKeySet Retain; Retain.AddHashesToSet(KeepHashes); diff --git a/src/zenstore/compactcas.h b/src/zenstore/compactcas.h index f72a707ca..eea0b2e15 100644 --- a/src/zenstore/compactcas.h +++ b/src/zenstore/compactcas.h @@ -52,11 +52,11 @@ struct CasContainerStrategy final : public GcStorage, public GcReferenceStore ~CasContainerStrategy(); CasStore::InsertResult InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash); - eastl::vector InsertChunks(std::span Chunks, std::span ChunkHashes); + eastl::vector InsertChunks(eastl::span Chunks, eastl::span ChunkHashes); IoBuffer FindChunk(const IoHash& ChunkHash); bool HaveChunk(const IoHash& ChunkHash); void FilterChunks(HashKeySet& InOutChunks); - bool IterateChunks(std::span ChunkHashes, + bool IterateChunks(eastl::span ChunkHashes, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit); diff --git a/src/zenstore/filecas.cpp b/src/zenstore/filecas.cpp index 36942b515..52e501595 100644 --- a/src/zenstore/filecas.cpp +++ b/src/zenstore/filecas.cpp @@ -615,7 +615,7 @@ FileCasStrategy::FilterChunks(HashKeySet& InOutChunks) } bool -FileCasStrategy::IterateChunks(std::span ChunkHashes, +FileCasStrategy::IterateChunks(eastl::span ChunkHashes, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool) { @@ -1388,9 +1388,9 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span UnusedCids = GetUnusedReferences(m_Cids); - Stats.CheckedCount = m_Cids.size(); - Stats.FoundCount = UnusedCids.size(); + eastl::span UnusedCids = GetUnusedReferences(m_Cids); + Stats.CheckedCount = m_Cids.size(); + Stats.FoundCount = UnusedCids.size(); if (UnusedCids.empty()) { // Nothing to collect diff --git a/src/zenstore/filecas.h b/src/zenstore/filecas.h index c3adf125c..0976a4fc3 100644 --- a/src/zenstore/filecas.h +++ b/src/zenstore/filecas.h @@ -39,7 +39,7 @@ struct FileCasStrategy final : public GcStorage, public GcReferenceStore IoBuffer FindChunk(const IoHash& ChunkHash); bool HaveChunk(const IoHash& ChunkHash); void FilterChunks(HashKeySet& InOutChunks); - bool IterateChunks(std::span ChunkHashes, + bool IterateChunks(eastl::span ChunkHashes, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool); void Flush(); diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp index 258ec80ca..b158c97aa 100644 --- a/src/zenstore/gc.cpp +++ b/src/zenstore/gc.cpp @@ -581,8 +581,8 @@ FilterReferences(GcCtx& Ctx, std::string_view Context, eastl::vector& In return true; } -std::span -KeepUnusedReferences(std::span SortedUsedReferences, std::span SortedReferences) +eastl::span +KeepUnusedReferences(eastl::span SortedUsedReferences, eastl::span SortedReferences) { if (SortedUsedReferences.empty()) { @@ -1166,8 +1166,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) { ZEN_TRACE_CPU("GcV2::RemoveUnreferencedData"); - const auto GetUnusedReferences = [&ReferenceCheckers, &Ctx](std::span References) -> std::span { - std::span UnusedCids(References); + const auto GetUnusedReferences = [&ReferenceCheckers, &Ctx](eastl::span References) -> eastl::span { + eastl::span UnusedCids(References); ZEN_ASSERT(UnusedCids.empty() || UnusedCids[0] != IoHash::Zero); for (const auto& It : ReferenceCheckers) { @@ -2852,35 +2852,35 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector UsedReferences; eastl::vector References; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.empty()); } { eastl::vector UsedReferences{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; eastl::vector References; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.empty()); } { eastl::vector UsedReferences{}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 5); } { eastl::vector UsedReferences{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.empty()); } { eastl::vector UsedReferences{Hashes[0], Hashes[2], Hashes[4]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 2); CHECK(UnusedReferences[0] == Hashes[1]); CHECK(UnusedReferences[1] == Hashes[3]); @@ -2889,7 +2889,7 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector UsedReferences{Hashes[2], Hashes[3], Hashes[4]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 2); CHECK(UnusedReferences[0] == Hashes[0]); CHECK(UnusedReferences[1] == Hashes[1]); @@ -2898,7 +2898,7 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector UsedReferences{Hashes[0], Hashes[1], Hashes[2]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 2); CHECK(UnusedReferences[0] == Hashes[3]); CHECK(UnusedReferences[1] == Hashes[4]); @@ -2907,7 +2907,7 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector UsedReferences{Hashes[0], Hashes[1], Hashes[2], Hashes[4]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 1); CHECK(UnusedReferences[0] == Hashes[3]); } @@ -2915,7 +2915,7 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector UsedReferences{Hashes[1], Hashes[3]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 3); CHECK(UnusedReferences[0] == Hashes[0]); CHECK(UnusedReferences[1] == Hashes[2]); @@ -2925,7 +2925,7 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector UsedReferences{Hashes[0]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 4); CHECK(UnusedReferences[0] == Hashes[1]); CHECK(UnusedReferences[1] == Hashes[2]); @@ -2936,7 +2936,7 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector UsedReferences{Hashes[1]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 4); CHECK(UnusedReferences[0] == Hashes[0]); CHECK(UnusedReferences[1] == Hashes[2]); @@ -2947,7 +2947,7 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector UsedReferences{Hashes[3]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 4); CHECK(UnusedReferences[0] == Hashes[0]); CHECK(UnusedReferences[1] == Hashes[1]); @@ -2958,7 +2958,7 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector UsedReferences{Hashes[4]}; eastl::vector References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 4); CHECK(UnusedReferences[0] == Hashes[0]); CHECK(UnusedReferences[1] == Hashes[1]); diff --git a/src/zenstore/hashkeyset.cpp b/src/zenstore/hashkeyset.cpp index a5436f5cb..1fa32d25d 100644 --- a/src/zenstore/hashkeyset.cpp +++ b/src/zenstore/hashkeyset.cpp @@ -13,7 +13,7 @@ HashKeySet::AddHashToSet(const IoHash& HashToAdd) } void -HashKeySet::AddHashesToSet(std::span HashesToAdd) +HashKeySet::AddHashesToSet(eastl::span HashesToAdd) { m_HashSet.insert(HashesToAdd.begin(), HashesToAdd.end()); } diff --git a/src/zenstore/include/zenstore/blockstore.h b/src/zenstore/include/zenstore/blockstore.h index fe38d40ae..205939faf 100644 --- a/src/zenstore/include/zenstore/blockstore.h +++ b/src/zenstore/include/zenstore/blockstore.h @@ -132,7 +132,7 @@ public: typedef std::function IterateChunksSmallSizeCallback; typedef std::function IterateChunksLargeSizeCallback; typedef std::function WriteChunkCallback; - typedef std::function ChunkIndexes)> IterateChunksCallback; + typedef std::function ChunkIndexes)> IterateChunksCallback; struct BlockUsageInfo { @@ -155,16 +155,16 @@ public: void WriteChunk(const void* Data, uint64_t Size, uint32_t Alignment, const WriteChunkCallback& Callback); - typedef std::function Locations)> WriteChunksCallback; - void WriteChunks(std::span Datas, uint32_t Alignment, const WriteChunksCallback& Callback); + typedef std::function Locations)> WriteChunksCallback; + void WriteChunks(eastl::span Datas, uint32_t Alignment, const WriteChunksCallback& Callback); IoBuffer TryGetChunk(const BlockStoreLocation& Location) const; void Flush(bool ForceNewBlock); - bool IterateChunks(const std::span& ChunkLocations, const IterateChunksCallback& Callback); + bool IterateChunks(const eastl::span& ChunkLocations, const IterateChunksCallback& Callback); - bool IterateBlock(std::span ChunkLocations, - std::span ChunkIndexes, + bool IterateBlock(eastl::span ChunkLocations, + eastl::span ChunkIndexes, const IterateChunksSmallSizeCallback& SmallSizeCallback, const IterateChunksLargeSizeCallback& LargeSizeCallback, uint64_t LargeSizeLimit); diff --git a/src/zenstore/include/zenstore/cache/cachedisklayer.h b/src/zenstore/include/zenstore/cache/cachedisklayer.h index c5c0ae36e..d350744b0 100644 --- a/src/zenstore/include/zenstore/cache/cachedisklayer.h +++ b/src/zenstore/include/zenstore/cache/cachedisklayer.h @@ -182,7 +182,7 @@ public: void Put(std::string_view Bucket, const IoHash& HashKey, const ZenCacheValue& Value, - std::span References, + eastl::span References, PutBatchHandle* OptionalBatchHandle); bool Drop(); bool DropBucket(std::string_view Bucket); @@ -234,11 +234,11 @@ public: struct PutBatchHandle; PutBatchHandle* BeginPutBatch(eastl::vector& OutResult); void EndPutBatch(PutBatchHandle* Batch) noexcept; - void Put(const IoHash& HashKey, const ZenCacheValue& Value, std::span References, PutBatchHandle* OptionalBatchHandle); - uint64_t MemCacheTrim(GcClock::TimePoint ExpireTime); - bool Drop(); - void Flush(); - void ScrubStorage(ScrubContext& Ctx); + void Put(const IoHash& HashKey, const ZenCacheValue& Value, eastl::span References, PutBatchHandle* OptionalBatchHandle); + uint64_t MemCacheTrim(GcClock::TimePoint ExpireTime); + bool Drop(); + void Flush(); + void ScrubStorage(ScrubContext& Ctx); RwLock::SharedLockScope GetGcReferencerLock(); struct ReferencesStats @@ -256,10 +256,10 @@ public: eastl::vector& OutReferences, ReferencesStats* OptionalOutReferencesStats); - bool ReadAttachmentsFromMetaData(uint32_t BlockIndex, - std::span InlineKeys, - std::span ChunkIndexes, - eastl::vector& OutReferences) const; + bool ReadAttachmentsFromMetaData(uint32_t BlockIndex, + eastl::span InlineKeys, + eastl::span ChunkIndexes, + eastl::vector& OutReferences) const; inline GcStorageSize StorageSize() const { @@ -381,11 +381,11 @@ public: virtual eastl::vector CreateReferenceValidators(GcCtx& Ctx) override; void BuildPath(PathBuilderBase& Path, const IoHash& HashKey) const; - void PutStandaloneCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, std::span References); + void PutStandaloneCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, eastl::span References); IoBuffer GetStandaloneCacheValue(const DiskLocation& Loc, const IoHash& HashKey) const; void PutInlineCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, - std::span References, + eastl::span References, PutBatchHandle* OptionalBatchHandle = nullptr); IoBuffer GetInlineCacheValue(const DiskLocation& Loc) const; CacheValueDetails::ValueDetails GetValueDetails(RwLock::SharedLockScope&, const IoHash& Key, PayloadIndex Index) const; diff --git a/src/zenstore/include/zenstore/cache/structuredcachestore.h b/src/zenstore/include/zenstore/cache/structuredcachestore.h index faaba407f..7f65e6d12 100644 --- a/src/zenstore/include/zenstore/cache/structuredcachestore.h +++ b/src/zenstore/include/zenstore/cache/structuredcachestore.h @@ -94,7 +94,7 @@ public: void Put(std::string_view Bucket, const IoHash& HashKey, const ZenCacheValue& Value, - std::span References, + eastl::span References, PutBatchHandle* OptionalBatchHandle = nullptr); bool DropBucket(std::string_view Bucket); @@ -248,7 +248,7 @@ public: std::string_view Bucket, const IoHash& HashKey, const ZenCacheValue& Value, - std::span References, + eastl::span References, PutBatch* OptionalBatchHandle = nullptr); bool DropBucket(std::string_view Namespace, std::string_view Bucket); diff --git a/src/zenstore/include/zenstore/cache/upstreamcacheclient.h b/src/zenstore/include/zenstore/cache/upstreamcacheclient.h index ee5f93019..9e7c87026 100644 --- a/src/zenstore/include/zenstore/cache/upstreamcacheclient.h +++ b/src/zenstore/include/zenstore/cache/upstreamcacheclient.h @@ -101,17 +101,17 @@ public: virtual bool IsActive() = 0; - virtual void GetCacheValues(std::string_view Namespace, - std::span CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) = 0; + virtual void GetCacheValues(std::string_view Namespace, + eastl::span CacheValueRequests, + OnCacheValueGetComplete&& OnComplete) = 0; - virtual void GetCacheRecords(std::string_view Namespace, - std::span Requests, - OnCacheRecordGetComplete&& OnComplete) = 0; + virtual void GetCacheRecords(std::string_view Namespace, + eastl::span Requests, + OnCacheRecordGetComplete&& OnComplete) = 0; - virtual void GetCacheChunks(std::string_view Namespace, - std::span CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) = 0; + virtual void GetCacheChunks(std::string_view Namespace, + eastl::span CacheChunkRequests, + OnCacheChunksGetComplete&& OnComplete) = 0; virtual void EnqueueUpstream(UpstreamCacheRecord CacheRecord) = 0; }; diff --git a/src/zenstore/include/zenstore/caslog.h b/src/zenstore/include/zenstore/caslog.h index 3d95c9c90..8cd16e34a 100644 --- a/src/zenstore/include/zenstore/caslog.h +++ b/src/zenstore/include/zenstore/caslog.h @@ -85,7 +85,7 @@ public: CasLogFile::Append(&Record, sizeof Record); } - void Append(const std::span& Records) { CasLogFile::Append(Records.data(), sizeof(T) * Records.size()); } + void Append(const eastl::span& Records) { CasLogFile::Append(Records.data(), sizeof(T) * Records.size()); } }; } // namespace zen diff --git a/src/zenstore/include/zenstore/cidstore.h b/src/zenstore/include/zenstore/cidstore.h index ac73d71ea..0bbc175e4 100644 --- a/src/zenstore/include/zenstore/cidstore.h +++ b/src/zenstore/include/zenstore/cidstore.h @@ -76,11 +76,11 @@ public: void Initialize(const CidStoreConfiguration& Config); InsertResult AddChunk(const IoBuffer& ChunkData, const IoHash& RawHash, InsertMode Mode = InsertMode::kMayBeMovedInPlace); - eastl::vector AddChunks(std::span ChunkDatas, - std::span RawHashes, - InsertMode Mode = InsertMode::kMayBeMovedInPlace); + eastl::vector AddChunks(eastl::span ChunkDatas, + eastl::span RawHashes, + InsertMode Mode = InsertMode::kMayBeMovedInPlace); virtual IoBuffer FindChunkByCid(const IoHash& DecompressedId) override; - bool IterateChunks(std::span DecompressedIds, + bool IterateChunks(eastl::span DecompressedIds, const std::function& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit); diff --git a/src/zenstore/include/zenstore/gc.h b/src/zenstore/include/zenstore/gc.h index f98b0a537..b12ddc76b 100644 --- a/src/zenstore/include/zenstore/gc.h +++ b/src/zenstore/include/zenstore/gc.h @@ -12,13 +12,13 @@ ZEN_THIRD_PARTY_INCLUDES_START #include ZEN_THIRD_PARTY_INCLUDES_END +#include #include #include #include #include #include #include -#include #include ZEN_THIRD_PARTY_INCLUDES_START @@ -228,11 +228,11 @@ public: // Go through IoCids and see which ones are referenced. If it is the reference must be removed from IoCids // This function should use pre-cached information on what is referenced as we are in stop the world mode - virtual std::span GetUnusedReferences(GcCtx& Ctx, std::span IoCids) = 0; + virtual eastl::span GetUnusedReferences(GcCtx& Ctx, eastl::span IoCids) = 0; }; -std::span KeepUnusedReferences(std::span SortedUsedReferences, std::span SortedReferences); -bool FilterReferences(GcCtx& Ctx, std::string_view Context, eastl::vector& InOutReferences); +eastl::span KeepUnusedReferences(eastl::span SortedUsedReferences, eastl::span SortedReferences); +bool FilterReferences(GcCtx& Ctx, std::string_view Context, eastl::vector& InOutReferences); /** * @brief An interface to implement a lock for Stop The World (from writing new data) @@ -285,7 +285,7 @@ public: virtual std::string GetGcName(GcCtx& Ctx) = 0; - typedef std::function(std::span References)> GetUnusedReferencesFunc; + typedef std::function(eastl::span References)> GetUnusedReferencesFunc; // Check a set of references to see if they are in use. // Use the GetUnusedReferences input function to check if references are used and update any pointers diff --git a/src/zenstore/include/zenstore/hashkeyset.h b/src/zenstore/include/zenstore/hashkeyset.h index 411a6256e..70aacd0e2 100644 --- a/src/zenstore/include/zenstore/hashkeyset.h +++ b/src/zenstore/include/zenstore/hashkeyset.h @@ -18,14 +18,14 @@ class HashKeySet { public: void AddHashToSet(const IoHash& HashToAdd); - void AddHashesToSet(std::span HashesToAdd); + void AddHashesToSet(eastl::span HashesToAdd); void RemoveHashesIf(std::function&& Predicate); void IterateHashes(std::function&& Callback) const; [[nodiscard]] inline bool ContainsHash(const IoHash& Hash) const { return m_HashSet.find(Hash) != m_HashSet.end(); } [[nodiscard]] inline bool IsEmpty() const { return m_HashSet.empty(); } [[nodiscard]] inline size_t GetSize() const { return m_HashSet.size(); } - inline void FilterHashes(std::span Candidates, Invocable auto MatchFunc) const + inline void FilterHashes(eastl::span Candidates, Invocable auto MatchFunc) const { for (const IoHash& Candidate : Candidates) { @@ -36,7 +36,7 @@ public: } } - inline void FilterHashes(std::span Candidates, Invocable auto MatchFunc) const + inline void FilterHashes(eastl::span Candidates, Invocable auto MatchFunc) const { for (const IoHash& Candidate : Candidates) { diff --git a/src/zenstore/include/zenstore/scrubcontext.h b/src/zenstore/include/zenstore/scrubcontext.h index 2f28cfec7..73214e24c 100644 --- a/src/zenstore/include/zenstore/scrubcontext.h +++ b/src/zenstore/include/zenstore/scrubcontext.h @@ -22,7 +22,7 @@ public: std::chrono::steady_clock::time_point Deadline = std::chrono::steady_clock::time_point::max()); ~ScrubContext(); - void ReportBadCidChunks(std::span BadCasChunks); + void ReportBadCidChunks(eastl::span BadCasChunks); inline uint64_t ScrubTimestamp() const { return m_ScrubTime; } void ReportScrubbed(uint64_t ChunkCount, uint64_t ChunkBytes) { diff --git a/src/zenstore/include/zenstore/workspaces.h b/src/zenstore/include/zenstore/workspaces.h index f2eb119a9..c36429af8 100644 --- a/src/zenstore/include/zenstore/workspaces.h +++ b/src/zenstore/include/zenstore/workspaces.h @@ -71,10 +71,10 @@ public: ShareFile GetWorkspaceShareChunkInfo(const Oid& WorkspaceId, const Oid& ShareId, const Oid& ChunkId, WorkerThreadPool& WorkerPool); - eastl::vector GetWorkspaceShareChunks(const Oid& WorkspaceId, - const Oid& ShareId, - const std::span ChunkRequests, - WorkerThreadPool& WorkerPool); + eastl::vector GetWorkspaceShareChunks(const Oid& WorkspaceId, + const Oid& ShareId, + const eastl::span ChunkRequests, + WorkerThreadPool& WorkerPool); eastl::vector GetWorkspaces() const; std::optional GetWorkspaceConfiguration(const Oid& WorkspaceId) const; diff --git a/src/zenstore/scrubcontext.cpp b/src/zenstore/scrubcontext.cpp index fbcd7d33c..78b88673a 100644 --- a/src/zenstore/scrubcontext.cpp +++ b/src/zenstore/scrubcontext.cpp @@ -41,7 +41,7 @@ ScrubContext::IsBadCid(const IoHash& Cid) const } void -ScrubContext::ReportBadCidChunks(std::span BadCasChunks) +ScrubContext::ReportBadCidChunks(eastl::span BadCasChunks) { RwLock::ExclusiveLockScope _(m_Lock); m_BadCid.AddHashesToSet(BadCasChunks); diff --git a/src/zenstore/workspaces.cpp b/src/zenstore/workspaces.cpp index c33997d13..7e7ce5c38 100644 --- a/src/zenstore/workspaces.cpp +++ b/src/zenstore/workspaces.cpp @@ -27,7 +27,7 @@ namespace { static constexpr std::string_view WorkspacesConfigName("config.json"); static constexpr std::string_view WorkspaceConfigName("zenworkspaceconfig.json"); - std::string WorkspacesToJson(std::span Workspaces) + std::string WorkspacesToJson(eastl::span Workspaces) { using namespace std::literals; @@ -84,7 +84,7 @@ namespace { return {}; } - std::string WorkspaceSharesToJson(std::span WorkspaceShares) + std::string WorkspaceSharesToJson(eastl::span WorkspaceShares) { using namespace std::literals; @@ -569,10 +569,10 @@ Workspaces::GetWorkspaceShareChunkInfo(const Oid& WorkspaceId, const Oid& ShareI } eastl::vector -Workspaces::GetWorkspaceShareChunks(const Oid& WorkspaceId, - const Oid& ShareId, - const std::span ChunkRequests, - WorkerThreadPool& WorkerPool) +Workspaces::GetWorkspaceShareChunks(const Oid& WorkspaceId, + const Oid& ShareId, + const eastl::span ChunkRequests, + WorkerThreadPool& WorkerPool) { if (ChunkRequests.size() == 0) { diff --git a/src/zenutil/cache/cachepolicy.cpp b/src/zenutil/cache/cachepolicy.cpp index 8bfb11a30..0b3551d38 100644 --- a/src/zenutil/cache/cachepolicy.cpp +++ b/src/zenutil/cache/cachepolicy.cpp @@ -163,7 +163,7 @@ public: Values.insert(Insert, Value); } - inline std::span GetValuePolicies() const final { return Values; } + inline eastl::span GetValuePolicies() const final { return Values; } private: eastl::vector Values; @@ -174,8 +174,8 @@ CacheRecordPolicy::GetValuePolicy(const Oid& Id) const { if (Shared) { - const std::span Values = Shared->GetValuePolicies(); - const auto Iter = + const eastl::span Values = Shared->GetValuePolicies(); + const auto Iter = std::lower_bound(Values.begin(), Values.end(), Id, [](const CacheValuePolicy& A, const Oid& B) { return A.Id < B; }); if (Iter != Values.end() && Iter->Id == Id) { @@ -272,8 +272,8 @@ CacheRecordPolicyBuilder::Build() const auto Add = [](const CachePolicy A, const CachePolicy B) { return ((A | B) & ~CachePolicy::SkipData) | ((A & B) & CachePolicy::SkipData); }; - const std::span Values = Shared->GetValuePolicies(); - Policy.RecordPolicy = BasePolicy; + const eastl::span Values = Shared->GetValuePolicies(); + Policy.RecordPolicy = BasePolicy; for (const CacheValuePolicy& ValuePolicy : Values) { Policy.RecordPolicy = Add(Policy.RecordPolicy, ValuePolicy.Policy); diff --git a/src/zenutil/cache/cacherequests.cpp b/src/zenutil/cache/cacherequests.cpp index 9b999304e..d5bc994c1 100644 --- a/src/zenutil/cache/cacherequests.cpp +++ b/src/zenutil/cache/cacherequests.cpp @@ -368,7 +368,7 @@ namespace cacherequests { bool GetCacheRecordsRequest::Parse(const CbPackage& RpcRequest) { return Parse(RpcRequest.GetObject()); } - bool GetCacheRecordsRequest::Format(CbObjectWriter& Writer, const std::span OptionalRecordFilter) const + bool GetCacheRecordsRequest::Format(CbObjectWriter& Writer, const eastl::span OptionalRecordFilter) const { Writer << "Method" << "GetCacheRecords"; @@ -422,7 +422,7 @@ namespace cacherequests { return true; } - bool GetCacheRecordsRequest::Format(CbPackage& OutPackage, const std::span OptionalRecordFilter) const + bool GetCacheRecordsRequest::Format(CbPackage& OutPackage, const eastl::span OptionalRecordFilter) const { CbObjectWriter Writer; if (!Format(Writer, OptionalRecordFilter)) @@ -433,7 +433,7 @@ namespace cacherequests { return true; } - bool GetCacheRecordsResult::Parse(const CbPackage& Package, const std::span OptionalRecordResultIndexes) + bool GetCacheRecordsResult::Parse(const CbPackage& Package, const eastl::span OptionalRecordResultIndexes) { CbObject ResponseObject = Package.GetObject(); CbArrayView ResultsArray = ResponseObject["Result"].AsArrayView(); @@ -700,7 +700,7 @@ namespace cacherequests { return true; } - bool GetCacheValuesRequest::Format(CbPackage& OutPackage, const std::span OptionalValueFilter) const + bool GetCacheValuesRequest::Format(CbPackage& OutPackage, const eastl::span OptionalValueFilter) const { CbObjectWriter Writer; Writer << "Method" @@ -757,7 +757,7 @@ namespace cacherequests { return true; } - bool CacheValuesResult::Parse(const CbPackage& Package, const std::span OptionalValueResultIndexes) + bool CacheValuesResult::Parse(const CbPackage& Package, const eastl::span OptionalValueResultIndexes) { CbObject ResponseObject = Package.GetObject(); CbArrayView ResultsArray = ResponseObject["Result"].AsArrayView(); @@ -1090,7 +1090,7 @@ namespace cacherequests { return (Lhs.Id == Rhs.Id) && (Lhs.Policy == Rhs.Policy); } - static bool operator==(const std::span& Lhs, const std::span& Rhs) + static bool operator==(const eastl::span& Lhs, const eastl::span& Rhs) { if (Lhs.size() != Lhs.size()) { diff --git a/src/zenutil/chunkblock.cpp b/src/zenutil/chunkblock.cpp index 6c8ed43cc..2606963e7 100644 --- a/src/zenutil/chunkblock.cpp +++ b/src/zenutil/chunkblock.cpp @@ -164,7 +164,7 @@ GenerateChunkBlock(eastl::vector>&& FetchChunk { std::pair Chunk = It.second(It.first); uint64_t ChunkSize = 0; - std::span Segments = Chunk.second.GetCompressed().GetSegments(); + eastl::span Segments = Chunk.second.GetCompressed().GetSegments(); for (const SharedBuffer& Segment : Segments) { ZEN_ASSERT(Segment.IsOwned()); diff --git a/src/zenutil/chunkedcontent.cpp b/src/zenutil/chunkedcontent.cpp index 13b8dd0d2..351e2837e 100644 --- a/src/zenutil/chunkedcontent.cpp +++ b/src/zenutil/chunkedcontent.cpp @@ -28,9 +28,9 @@ namespace { ChunkedContentData& InOutChunkedContent, tsl::robin_map& ChunkHashToChunkIndex, const IoHash& RawHash, - std::span ChunkSequence, - std::span ChunkHashes, - std::span ChunkRawSizes) + eastl::span ChunkSequence, + eastl::span ChunkHashes, + eastl::span ChunkRawSizes) { ZEN_ASSERT(ChunkHashes.size() == ChunkRawSizes.size()); InOutChunkedContent.ChunkCounts.push_back(gsl::narrow(ChunkSequence.size())); @@ -529,7 +529,7 @@ LoadChunkedFolderContentToCompactBinary(CbObjectView Input) } ChunkedFolderContent -MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span Overlays) +MergeChunkedFolderContents(const ChunkedFolderContent& Base, eastl::span Overlays) { ZEN_TRACE_CPU("MergeChunkedFolderContents"); @@ -564,7 +564,7 @@ MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span RawHashToSequenceRawHashIndex; - auto BuildOverlayPaths = [](std::span Overlays) -> tsl::robin_set { + auto BuildOverlayPaths = [](eastl::span Overlays) -> tsl::robin_set { tsl::robin_set Result; for (const ChunkedFolderContent& OverlayContent : Overlays) { @@ -581,7 +581,7 @@ MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span& ChunkHashToChunkIndex, tsl::robin_map& RawHashToSequenceRawHashIndex, const tsl::robin_map& GenericPathToActualPath, - std::span Overlays) { + eastl::span Overlays) { const ChunkedContentLookup OverlayLookup = BuildChunkedContentLookup(OverlayContent); tsl::robin_set BaseOverlayPaths = BuildOverlayPaths(Overlays); for (uint32_t PathIndex = 0; PathIndex < OverlayContent.Paths.size(); PathIndex++) @@ -604,12 +604,12 @@ MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span(Result.ChunkedContent.SequenceRawHashes.size())}); - const uint32_t SequenceRawHashIndex = OverlayLookup.RawHashToSequenceIndex.at(RawHash); - const uint32_t OrderIndexOffset = OverlayLookup.SequenceIndexChunkOrderOffset[SequenceRawHashIndex]; - const uint32_t ChunkCount = OverlayContent.ChunkedContent.ChunkCounts[SequenceRawHashIndex]; - ChunkingStatistics Stats; - std::span OriginalChunkOrder = - std::span(OverlayContent.ChunkedContent.ChunkOrders).subspan(OrderIndexOffset, ChunkCount); + const uint32_t SequenceRawHashIndex = OverlayLookup.RawHashToSequenceIndex.at(RawHash); + const uint32_t OrderIndexOffset = OverlayLookup.SequenceIndexChunkOrderOffset[SequenceRawHashIndex]; + const uint32_t ChunkCount = OverlayContent.ChunkedContent.ChunkCounts[SequenceRawHashIndex]; + ChunkingStatistics Stats; + eastl::span OriginalChunkOrder = + eastl::span(OverlayContent.ChunkedContent.ChunkOrders).subspan(OrderIndexOffset, ChunkCount); AddChunkSequence(Stats, Result.ChunkedContent, ChunkHashToChunkIndex, @@ -639,7 +639,7 @@ MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span DeletedPaths) +DeletePathsFromChunkedContent(const ChunkedFolderContent& BaseContent, eastl::span DeletedPaths) { ZEN_TRACE_CPU("DeletePathsFromChunkedContent"); @@ -674,12 +674,12 @@ DeletePathsFromChunkedContent(const ChunkedFolderContent& BaseContent, std::span { RawHashToSequenceRawHashIndex.insert( {RawHash, gsl::narrow(Result.ChunkedContent.SequenceRawHashes.size())}); - const uint32_t SequenceRawHashIndex = BaseLookup.RawHashToSequenceIndex.at(RawHash); - const uint32_t OrderIndexOffset = BaseLookup.SequenceIndexChunkOrderOffset[SequenceRawHashIndex]; - const uint32_t ChunkCount = BaseContent.ChunkedContent.ChunkCounts[SequenceRawHashIndex]; - ChunkingStatistics Stats; - std::span OriginalChunkOrder = - std::span(BaseContent.ChunkedContent.ChunkOrders).subspan(OrderIndexOffset, ChunkCount); + const uint32_t SequenceRawHashIndex = BaseLookup.RawHashToSequenceIndex.at(RawHash); + const uint32_t OrderIndexOffset = BaseLookup.SequenceIndexChunkOrderOffset[SequenceRawHashIndex]; + const uint32_t ChunkCount = BaseContent.ChunkedContent.ChunkCounts[SequenceRawHashIndex]; + ChunkingStatistics Stats; + eastl::span OriginalChunkOrder = + eastl::span(BaseContent.ChunkedContent.ChunkOrders).subspan(OrderIndexOffset, ChunkCount); AddChunkSequence(Stats, Result.ChunkedContent, ChunkHashToChunkIndex, diff --git a/src/zenutil/chunkingcontroller.cpp b/src/zenutil/chunkingcontroller.cpp index bdc030f2c..9e2f87d50 100644 --- a/src/zenutil/chunkingcontroller.cpp +++ b/src/zenutil/chunkingcontroller.cpp @@ -39,9 +39,9 @@ namespace { class BasicChunkingController : public ChunkingController { public: - BasicChunkingController(std::span ExcludeExtensions, - uint64_t ChunkFileSizeLimit, - const ChunkedParams& ChunkingParams) + BasicChunkingController(eastl::span ExcludeExtensions, + uint64_t ChunkFileSizeLimit, + const ChunkedParams& ChunkingParams) : m_ChunkExcludeExtensions(ExcludeExtensions.begin(), ExcludeExtensions.end()) , m_ChunkFileSizeLimit(ChunkFileSizeLimit) , m_ChunkingParams(ChunkingParams) @@ -111,10 +111,10 @@ protected: class ChunkingControllerWithFixedChunking : public ChunkingController { public: - ChunkingControllerWithFixedChunking(std::span FixedChunkingExtensions, - uint64_t ChunkFileSizeLimit, - const ChunkedParams& ChunkingParams, - uint32_t FixedChunkingChunkSize) + ChunkingControllerWithFixedChunking(eastl::span FixedChunkingExtensions, + uint64_t ChunkFileSizeLimit, + const ChunkedParams& ChunkingParams, + uint32_t FixedChunkingChunkSize) : m_FixedChunkingExtensions(FixedChunkingExtensions.begin(), FixedChunkingExtensions.end()) , m_ChunkFileSizeLimit(ChunkFileSizeLimit) , m_ChunkingParams(ChunkingParams) @@ -225,9 +225,9 @@ protected: }; std::unique_ptr -CreateBasicChunkingController(std::span ExcludeExtensions, - uint64_t ChunkFileSizeLimit, - const ChunkedParams& ChunkingParams) +CreateBasicChunkingController(eastl::span ExcludeExtensions, + uint64_t ChunkFileSizeLimit, + const ChunkedParams& ChunkingParams) { return std::make_unique(ExcludeExtensions, ChunkFileSizeLimit, ChunkingParams); } @@ -238,10 +238,10 @@ CreateBasicChunkingController(CbObjectView Parameters) } std::unique_ptr -CreateChunkingControllerWithFixedChunking(std::span FixedChunkingExtensions, - uint64_t ChunkFileSizeLimit, - const ChunkedParams& ChunkingParams, - uint32_t FixedChunkingChunkSize) +CreateChunkingControllerWithFixedChunking(eastl::span FixedChunkingExtensions, + uint64_t ChunkFileSizeLimit, + const ChunkedParams& ChunkingParams, + uint32_t FixedChunkingChunkSize) { return std::make_unique(FixedChunkingExtensions, ChunkFileSizeLimit, diff --git a/src/zenutil/chunkrequests.cpp b/src/zenutil/chunkrequests.cpp index 49ac9e2f5..ccbe06888 100644 --- a/src/zenutil/chunkrequests.cpp +++ b/src/zenutil/chunkrequests.cpp @@ -79,7 +79,7 @@ ParseChunkBatchRequest(const IoBuffer& Payload) } eastl::vector -BuildChunkBatchResponse(const eastl::vector& Requests, std::span Chunks) +BuildChunkBatchResponse(const eastl::vector& Requests, eastl::span Chunks) { ZEN_ASSERT(Requests.size() == Chunks.size()); size_t ChunkCount = Requests.size(); diff --git a/src/zenutil/filebuildstorage.cpp b/src/zenutil/filebuildstorage.cpp index 37bf82afe..cee9cbfc4 100644 --- a/src/zenutil/filebuildstorage.cpp +++ b/src/zenutil/filebuildstorage.cpp @@ -450,7 +450,7 @@ public: return Result; } - virtual eastl::vector GetBlockMetadata(const Oid& BuildId, std::span BlockHashes) override + virtual eastl::vector GetBlockMetadata(const Oid& BuildId, eastl::span BlockHashes) override { ZEN_UNUSED(BuildId); SimulateLatency(0, 0); diff --git a/src/zenutil/include/zenutil/buildstorage.h b/src/zenutil/include/zenutil/buildstorage.h index 5eddd2da7..7b88b355e 100644 --- a/src/zenutil/include/zenutil/buildstorage.h +++ b/src/zenutil/include/zenutil/buildstorage.h @@ -47,9 +47,9 @@ public: uint64_t ChunkSize, std::function&& Receiver) = 0; - virtual void PutBlockMetadata(const Oid& BuildId, const IoHash& BlockRawHash, const CbObject& MetaData) = 0; - virtual eastl::vector FindBlocks(const Oid& BuildId) = 0; - virtual eastl::vector GetBlockMetadata(const Oid& BuildId, std::span BlockHashes) = 0; + virtual void PutBlockMetadata(const Oid& BuildId, const IoHash& BlockRawHash, const CbObject& MetaData) = 0; + virtual eastl::vector FindBlocks(const Oid& BuildId) = 0; + virtual eastl::vector GetBlockMetadata(const Oid& BuildId, eastl::span BlockHashes) = 0; }; } // namespace zen diff --git a/src/zenutil/include/zenutil/cache/cachepolicy.h b/src/zenutil/include/zenutil/cache/cachepolicy.h index 7773cd3d1..b68be18ce 100644 --- a/src/zenutil/include/zenutil/cache/cachepolicy.h +++ b/src/zenutil/include/zenutil/cache/cachepolicy.h @@ -8,8 +8,8 @@ #include #include +#include #include -#include namespace zen::Private { class ICacheRecordPolicyShared; } @@ -104,9 +104,9 @@ struct CacheValuePolicy class Private::ICacheRecordPolicyShared : public RefCounted { public: - virtual ~ICacheRecordPolicyShared() = default; - virtual void AddValuePolicy(const CacheValuePolicy& Policy) = 0; - virtual std::span GetValuePolicies() const = 0; + virtual ~ICacheRecordPolicyShared() = default; + virtual void AddValuePolicy(const CacheValuePolicy& Policy) = 0; + virtual eastl::span GetValuePolicies() const = 0; }; /** @@ -144,9 +144,9 @@ public: CachePolicy GetValuePolicy(const Oid& Id) const; /** Returns the array of cache policy overrides for values, sorted by ID. */ - inline std::span GetValuePolicies() const + inline eastl::span GetValuePolicies() const { - return Shared ? Shared->GetValuePolicies() : std::span(); + return Shared ? Shared->GetValuePolicies() : eastl::span(); } /** Saves the cache record policy to a compact binary object. */ diff --git a/src/zenutil/include/zenutil/cache/cacherequests.h b/src/zenutil/include/zenutil/cache/cacherequests.h index 351245d75..4a9e46399 100644 --- a/src/zenutil/include/zenutil/cache/cacherequests.h +++ b/src/zenutil/include/zenutil/cache/cacherequests.h @@ -115,8 +115,8 @@ namespace cacherequests { bool Parse(const CbPackage& RpcRequest); bool Parse(const CbObjectView& RpcRequest); - bool Format(CbPackage& OutPackage, const std::span OptionalRecordFilter = {}) const; - bool Format(CbObjectWriter& Writer, const std::span OptionalRecordFilter = {}) const; + bool Format(CbPackage& OutPackage, const eastl::span OptionalRecordFilter = {}) const; + bool Format(CbObjectWriter& Writer, const eastl::span OptionalRecordFilter = {}) const; }; struct GetCacheRecordResultValue @@ -137,7 +137,7 @@ namespace cacherequests { { eastl::vector> Results; - bool Parse(const CbPackage& Package, const std::span OptionalRecordResultIndexes = {}); + bool Parse(const CbPackage& Package, const eastl::span OptionalRecordResultIndexes = {}); bool Format(CbPackage& OutPackage) const; }; @@ -190,7 +190,7 @@ namespace cacherequests { eastl::vector Requests; bool Parse(const CbObjectView& BatchObject); - bool Format(CbPackage& OutPackage, const std::span OptionalValueFilter = {}) const; + bool Format(CbPackage& OutPackage, const eastl::span OptionalValueFilter = {}) const; }; struct CacheValueResult @@ -206,7 +206,7 @@ namespace cacherequests { { eastl::vector Results; - bool Parse(const CbPackage& Package, const std::span OptionalValueResultIndexes = {}); + bool Parse(const CbPackage& Package, const eastl::span OptionalValueResultIndexes = {}); bool Format(CbPackage& OutPackage) const; }; diff --git a/src/zenutil/include/zenutil/chunkedcontent.h b/src/zenutil/include/zenutil/chunkedcontent.h index 931127c6d..e6ec13179 100644 --- a/src/zenutil/include/zenutil/chunkedcontent.h +++ b/src/zenutil/include/zenutil/chunkedcontent.h @@ -97,8 +97,8 @@ struct ChunkedFolderContent void SaveChunkedFolderContentToCompactBinary(const ChunkedFolderContent& Content, CbWriter& Output); ChunkedFolderContent LoadChunkedFolderContentToCompactBinary(CbObjectView Input); -ChunkedFolderContent MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span Overlays); -ChunkedFolderContent DeletePathsFromChunkedContent(const ChunkedFolderContent& Base, std::span DeletedPaths); +ChunkedFolderContent MergeChunkedFolderContents(const ChunkedFolderContent& Base, eastl::span Overlays); +ChunkedFolderContent DeletePathsFromChunkedContent(const ChunkedFolderContent& Base, eastl::span DeletedPaths); struct ChunkingStatistics { @@ -146,11 +146,11 @@ GetChunkSequenceLocationRange(const ChunkedContentLookup& Lookup, uint32_t Chunk return std::make_pair(Lookup.ChunkSequenceLocationOffset[ChunkIndex], Lookup.ChunkSequenceLocationCounts[ChunkIndex]); } -inline std::span +inline eastl::span GetChunkSequenceLocations(const ChunkedContentLookup& Lookup, uint32_t ChunkIndex) { std::pair Range = GetChunkSequenceLocationRange(Lookup, ChunkIndex); - return std::span(Lookup.ChunkSequenceLocations).subspan(Range.first, Range.second); + return eastl::span(Lookup.ChunkSequenceLocations).subspan(Range.first, Range.second); } inline uint32_t @@ -180,7 +180,7 @@ GetFirstPathIndexForRawHash(const ChunkedContentLookup& Lookup, const IoHash& Ra namespace compactbinary_helpers { template - void WriteArray(std::span Values, std::string_view ArrayName, CbWriter& Output) + void WriteArray(eastl::span Values, std::string_view ArrayName, CbWriter& Output) { Output.BeginArray(ArrayName); for (const Type Value : Values) @@ -193,11 +193,11 @@ namespace compactbinary_helpers { template void WriteArray(const eastl::vector& Values, std::string_view ArrayName, CbWriter& Output) { - WriteArray(std::span(Values), ArrayName, Output); + WriteArray(eastl::span(Values), ArrayName, Output); } template<> - inline void WriteArray(std::span Values, std::string_view ArrayName, CbWriter& Output) + inline void WriteArray(eastl::span Values, std::string_view ArrayName, CbWriter& Output) { Output.BeginArray(ArrayName); for (const std::filesystem::path& Path : Values) @@ -210,10 +210,10 @@ namespace compactbinary_helpers { template<> inline void WriteArray(const eastl::vector& Values, std::string_view ArrayName, CbWriter& Output) { - WriteArray(std::span(Values), ArrayName, Output); + WriteArray(eastl::span(Values), ArrayName, Output); } - inline void WriteBinaryAttachmentArray(std::span Values, std::string_view ArrayName, CbWriter& Output) + inline void WriteBinaryAttachmentArray(eastl::span Values, std::string_view ArrayName, CbWriter& Output) { Output.BeginArray(ArrayName); for (const IoHash& Hash : Values) @@ -225,7 +225,7 @@ namespace compactbinary_helpers { inline void WriteBinaryAttachmentArray(const eastl::vector& Values, std::string_view ArrayName, CbWriter& Output) { - WriteArray(std::span(Values), ArrayName, Output); + WriteArray(eastl::span(Values), ArrayName, Output); } inline void ReadArray(std::string_view ArrayName, CbObjectView Input, eastl::vector& Result) diff --git a/src/zenutil/include/zenutil/chunkingcontroller.h b/src/zenutil/include/zenutil/chunkingcontroller.h index ffdf453e5..ad77b8638 100644 --- a/src/zenutil/include/zenutil/chunkingcontroller.h +++ b/src/zenutil/include/zenutil/chunkingcontroller.h @@ -39,16 +39,16 @@ public: }; std::unique_ptr CreateBasicChunkingController( - std::span ExcludeExtensions = DefaultChunkingExcludeExtensions, - uint64_t ChunkFileSizeLimit = DefaultChunkingFileSizeLimit, - const ChunkedParams& ChunkingParams = DefaultChunkedParams); + eastl::span ExcludeExtensions = DefaultChunkingExcludeExtensions, + uint64_t ChunkFileSizeLimit = DefaultChunkingFileSizeLimit, + const ChunkedParams& ChunkingParams = DefaultChunkedParams); std::unique_ptr CreateBasicChunkingController(CbObjectView Parameters); std::unique_ptr CreateChunkingControllerWithFixedChunking( - std::span ExcludeExtensions = DefaultChunkingExcludeExtensions, - uint64_t ChunkFileSizeLimit = DefaultChunkingFileSizeLimit, - const ChunkedParams& ChunkingParams = DefaultChunkedParams, - uint32_t FixedChunkingChunkSize = DefaultFixedChunkingChunkSize); + eastl::span ExcludeExtensions = DefaultChunkingExcludeExtensions, + uint64_t ChunkFileSizeLimit = DefaultChunkingFileSizeLimit, + const ChunkedParams& ChunkingParams = DefaultChunkedParams, + uint32_t FixedChunkingChunkSize = DefaultFixedChunkingChunkSize); std::unique_ptr CreateChunkingControllerWithFixedChunking(CbObjectView Parameters); std::unique_ptr CreateChunkingController(std::string_view Name, CbObjectView Parameters); diff --git a/src/zenutil/include/zenutil/chunkrequests.h b/src/zenutil/include/zenutil/chunkrequests.h index 91e23ec07..65385c346 100644 --- a/src/zenutil/include/zenutil/chunkrequests.h +++ b/src/zenutil/include/zenutil/chunkrequests.h @@ -4,9 +4,9 @@ #include +#include #include #include -#include namespace zen { class IoBuffer; @@ -22,6 +22,6 @@ struct RequestChunkEntry eastl::vector ParseChunkBatchResponse(const IoBuffer& Buffer); IoBuffer BuildChunkBatchRequest(const eastl::vector& Entries); std::optional> ParseChunkBatchRequest(const IoBuffer& Payload); -eastl::vector BuildChunkBatchResponse(const eastl::vector& Requests, std::span Chunks); +eastl::vector BuildChunkBatchResponse(const eastl::vector& Requests, eastl::span Chunks); } // namespace zen diff --git a/src/zenutil/include/zenutil/referencemetadata.h b/src/zenutil/include/zenutil/referencemetadata.h index f10eb1453..9377828b4 100644 --- a/src/zenutil/include/zenutil/referencemetadata.h +++ b/src/zenutil/include/zenutil/referencemetadata.h @@ -56,10 +56,10 @@ static_assert(sizeof(ReferenceMetaDataHeader) == 32); template CompositeBuffer -BuildReferenceMetaData(uint32_t HeaderMagic, - std::span Keys, - std::span AttachmentCounts, - std::span Attachments) +BuildReferenceMetaData(uint32_t HeaderMagic, + eastl::span Keys, + eastl::span AttachmentCounts, + eastl::span Attachments) { uint32_t KeyCount = gsl::narrow(Keys.size()); @@ -73,11 +73,11 @@ BuildReferenceMetaData(uint32_t HeaderMagic, template bool -GetAttachmentsFromMetaData(const IoBuffer& MetaData, - const uint32_t ExpectedHeaderMagic, - std::function Keys, - std::span AttachmentCounts, - std::span Attachments)>&& Parser) +GetAttachmentsFromMetaData(const IoBuffer& MetaData, + const uint32_t ExpectedHeaderMagic, + std::function Keys, + eastl::span AttachmentCounts, + eastl::span Attachments)>&& Parser) { MemoryView PayloadView = MetaData.GetView(); if (PayloadView.GetSize() >= sizeof(ReferenceMetaDataHeader)) @@ -89,12 +89,12 @@ GetAttachmentsFromMetaData(const IoBuffer& MetaData, ReferenceMetaDataHeader::ExpectedSize(Header->EntryCount, Header->AttachmentCount)) { PayloadView.MidInline(sizeof(ReferenceMetaDataHeader)); - std::span PayloadKeys = {(const KeyType*)PayloadView.GetData(), Header->EntryCount}; + eastl::span PayloadKeys = {(const KeyType*)PayloadView.GetData(), Header->EntryCount}; PayloadView.MidInline(sizeof(KeyType) * Header->EntryCount); - std::span PayloadAttachmentCounts = {(const uint32_t*)PayloadView.GetData(), Header->EntryCount}; + eastl::span PayloadAttachmentCounts = {(const uint32_t*)PayloadView.GetData(), Header->EntryCount}; PayloadView.MidInline(sizeof(uint32_t) * Header->EntryCount); - std::span PayloadAttachments = {(const AttachmentType*)PayloadView.GetData(), - Header->AttachmentCount}; + eastl::span PayloadAttachments = {(const AttachmentType*)PayloadView.GetData(), + Header->AttachmentCount}; PayloadView.MidInline(sizeof(AttachmentType) * Header->AttachmentCount); ZEN_ASSERT(PayloadView.GetSize() == 0); diff --git a/src/zenutil/jupiter/jupiterbuildstorage.cpp b/src/zenutil/jupiter/jupiterbuildstorage.cpp index bedbbd0a0..35a20366e 100644 --- a/src/zenutil/jupiter/jupiterbuildstorage.cpp +++ b/src/zenutil/jupiter/jupiterbuildstorage.cpp @@ -302,7 +302,7 @@ public: return ParseChunkBlockDescriptionList(PayloadToJson("Failed fetching known blocks"sv, FindResult.Response)); } - virtual eastl::vector GetBlockMetadata(const Oid& BuildId, std::span BlockHashes) override + virtual eastl::vector GetBlockMetadata(const Oid& BuildId, eastl::span BlockHashes) override { ZEN_TRACE_CPU("Jupiter::GetBlockMetadata"); -- cgit v1.2.3