diff options
77 files changed, 631 insertions, 628 deletions
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<typename T> - std::string FormatArray(std::span<const T> Items, std::string_view Prefix) + std::string FormatArray(eastl::span<const T> 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<const std::string_view> ExcludeDirectories) + void CleanDirectory(const std::filesystem::path& Path, eastl::span<const std::string_view> 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<const SharedBuffer> Segments = Buffer.GetSegments(); + eastl::span<const SharedBuffer> Segments = Buffer.GetSegments(); ZEN_ASSERT(Buffer.GetSegments().size() > 0); IoBufferFileReference FileRef; if (Segments.back().GetFileReference(FileRef)) @@ -505,11 +505,11 @@ namespace { } }; - eastl::vector<uint32_t> CalculateAbsoluteChunkOrders(const std::span<const IoHash> LocalChunkHashes, - const std::span<const uint32_t> LocalChunkOrder, + eastl::vector<uint32_t> CalculateAbsoluteChunkOrders(const eastl::span<const IoHash> LocalChunkHashes, + const eastl::span<const uint32_t> LocalChunkOrder, const tsl::robin_map<IoHash, uint32_t, IoHash::Hasher>& ChunkHashToLocalChunkIndex, - const std::span<const uint32_t>& LooseChunkIndexes, - const std::span<const ChunkBlockDescription>& BlockDescriptions) + const eastl::span<const uint32_t>& LooseChunkIndexes, + const eastl::span<const ChunkBlockDescription>& BlockDescriptions) { ZEN_TRACE_CPU("CalculateAbsoluteChunkOrders"); @@ -571,13 +571,13 @@ namespace { return AbsoluteChunkOrder; } - void CalculateLocalChunkOrders(const std::span<const uint32_t>& AbsoluteChunkOrders, - const std::span<const IoHash> LooseChunkHashes, - const std::span<const uint64_t> LooseChunkRawSizes, - const std::span<const ChunkBlockDescription>& BlockDescriptions, - eastl::vector<IoHash>& OutLocalChunkHashes, - eastl::vector<uint64_t>& OutLocalChunkRawSizes, - eastl::vector<uint32_t>& OutLocalChunkOrders) + void CalculateLocalChunkOrders(const eastl::span<const uint32_t>& AbsoluteChunkOrders, + const eastl::span<const IoHash> LooseChunkHashes, + const eastl::span<const uint64_t> LooseChunkRawSizes, + const eastl::span<const ChunkBlockDescription>& BlockDescriptions, + eastl::vector<IoHash>& OutLocalChunkHashes, + eastl::vector<uint64_t>& OutLocalChunkRawSizes, + eastl::vector<uint32_t>& OutLocalChunkOrders) { ZEN_TRACE_CPU("CalculateLocalChunkOrders"); @@ -641,19 +641,19 @@ namespace { #endif // EXTRA_VERIFY } - void WriteBuildContentToCompactBinary(CbObjectWriter& PartManifestWriter, - const SourcePlatform Platform, - std::span<const std::filesystem::path> Paths, - std::span<const IoHash> RawHashes, - std::span<const uint64_t> RawSizes, - std::span<const uint32_t> Attributes, - std::span<const IoHash> SequenceRawHashes, - std::span<const uint32_t> ChunkCounts, - std::span<const IoHash> LocalChunkHashes, - std::span<const uint64_t> LocalChunkRawSizes, - eastl::vector<uint32_t> AbsoluteChunkOrders, - const std::span<const uint32_t> LooseLocalChunkIndexes, - const std::span<IoHash> BlockHashes) + void WriteBuildContentToCompactBinary(CbObjectWriter& PartManifestWriter, + const SourcePlatform Platform, + eastl::span<const std::filesystem::path> Paths, + eastl::span<const IoHash> RawHashes, + eastl::span<const uint64_t> RawSizes, + eastl::span<const uint32_t> Attributes, + eastl::span<const IoHash> SequenceRawHashes, + eastl::span<const uint32_t> ChunkCounts, + eastl::span<const IoHash> LocalChunkHashes, + eastl::span<const uint64_t> LocalChunkRawSizes, + eastl::vector<uint32_t> AbsoluteChunkOrders, + const eastl::span<const uint32_t> LooseLocalChunkIndexes, + const eastl::span<IoHash> 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<uint32_t> AbsoluteChunkOrder = - std::span<uint32_t>(LegacyAbsoluteChunkOrders).subspan(OrderIndexOffset, LegacyChunkCount); + eastl::span<uint32_t> AbsoluteChunkOrder = + eastl::span<uint32_t>(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<std::pair<Oid, std::string>> AllBuildParts, - std::span<const ChunkedFolderContent> PartContents, + eastl::span<const ChunkedFolderContent> 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<const ChunkedContentLookup::ChunkSequenceLocation> ChunkLocations = GetChunkSequenceLocations(Lookup, ChunkIndex); + uint32_t ChunkIndex = It->second; + eastl::span<const ChunkedContentLookup::ChunkSequenceLocation> 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<IoHash> RawHashes, + eastl::span<IoHash> RawHashes, const eastl::vector<eastl::vector<uint32_t>>& NewBlockChunks, GeneratedBlocks& NewBlocks, - std::span<const uint32_t> LooseChunkIndexes, + eastl::span<const uint32_t> LooseChunkIndexes, const std::uint64_t LargeAttachmentSize, DiskStatistics& DiskStats, UploadStatistics& UploadStats, @@ -2076,8 +2076,8 @@ namespace { } eastl::vector<size_t> FindReuseBlocks(const eastl::vector<ChunkBlockDescription>& KnownBlocks, - std::span<const IoHash> ChunkHashes, - std::span<const uint32_t> ChunkIndexes, + eastl::span<const IoHash> ChunkHashes, + eastl::span<const uint32_t> ChunkIndexes, uint8_t MinPercentLimit, eastl::vector<uint32_t>& OutUnusedChunkIndexes, FindBlocksStatistics& FindBlocksStats) @@ -2806,7 +2806,7 @@ namespace { PutBuildPartResult.second.size()); IoHash PartHash = PutBuildPartResult.first; - auto UploadAttachments = [&](std::span<IoHash> RawHashes) { + auto UploadAttachments = [&](eastl::span<IoHash> RawHashes) { if (!AbortFlag) { ZEN_CONSOLE_VERBOSE("Uploading attachments: {}", FormatArray<IoHash>(RawHashes, "\n "sv)); @@ -3339,11 +3339,11 @@ namespace { }; eastl::vector<const ChunkedContentLookup::ChunkSequenceLocation*> GetRemainingChunkTargets( - std::span<const std::atomic<uint32_t>> SequenceIndexChunksLeftToWriteCounters, - const ChunkedContentLookup& Lookup, - uint32_t ChunkIndex) + eastl::span<const std::atomic<uint32_t>> SequenceIndexChunksLeftToWriteCounters, + const ChunkedContentLookup& Lookup, + uint32_t ChunkIndex) { - std::span<const ChunkedContentLookup::ChunkSequenceLocation> ChunkSources = GetChunkSequenceLocations(Lookup, ChunkIndex); + eastl::span<const ChunkedContentLookup::ChunkSequenceLocation> ChunkSources = GetChunkSequenceLocations(Lookup, ChunkIndex); eastl::vector<const ChunkedContentLookup::ChunkSequenceLocation*> ChunkTargetPtrs; if (!ChunkSources.empty()) { @@ -3359,14 +3359,14 @@ namespace { return ChunkTargetPtrs; }; - bool WriteBlockToDisk(const std::filesystem::path& CacheFolderPath, - const ChunkedFolderContent& RemoteContent, - std::span<std::atomic<uint32_t>> SequenceIndexChunksLeftToWriteCounters, - const CompositeBuffer& DecompressedBlockBuffer, - const ChunkedContentLookup& Lookup, - std::atomic<bool>* RemoteChunkIndexNeedsCopyFromSourceFlags, - std::atomic<uint32_t>& OutChunksComplete, - std::atomic<uint64_t>& OutBytesWritten) + bool WriteBlockToDisk(const std::filesystem::path& CacheFolderPath, + const ChunkedFolderContent& RemoteContent, + eastl::span<std::atomic<uint32_t>> SequenceIndexChunksLeftToWriteCounters, + const CompositeBuffer& DecompressedBlockBuffer, + const ChunkedContentLookup& Lookup, + std::atomic<bool>* RemoteChunkIndexNeedsCopyFromSourceFlags, + std::atomic<uint32_t>& OutChunksComplete, + std::atomic<uint64_t>& 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<const ChunkedContentLookup::ChunkSequenceLocation* const> ChunkTargets, - const CompositeBuffer& ChunkData, - WriteFileCache& OpenFileCache, - std::atomic<uint64_t>& OutBytesWritten) + void WriteChunkToDisk(const std::filesystem::path& CacheFolderPath, + const ChunkedFolderContent& Content, + const ChunkedContentLookup& Lookup, + eastl::span<const ChunkedContentLookup::ChunkSequenceLocation* const> ChunkTargets, + const CompositeBuffer& ChunkData, + WriteFileCache& OpenFileCache, + std::atomic<uint64_t>& OutBytesWritten) { ZEN_TRACE_CPU("WriteChunkToDisk"); @@ -3628,7 +3628,7 @@ namespace { const IoHash& ChunkHash, const std::uint64_t PreferredMultipartChunkSize, const eastl::vector<const ChunkedContentLookup::ChunkSequenceLocation*>& ChunkTargetPtrs, - std::span<std::atomic<uint32_t>> SequenceIndexChunksLeftToWriteCounters, + eastl::span<std::atomic<uint32_t>> SequenceIndexChunksLeftToWriteCounters, ParallellWork& Work, WorkerThreadPool& WritePool, WorkerThreadPool& NetworkPool, @@ -4171,8 +4171,8 @@ namespace { { uint64_t CacheLocalFileBytesRead = 0; - size_t TargetStart = 0; - const std::span<const ChunkedContentLookup::ChunkSequenceLocation* const> AllTargets( + size_t TargetStart = 0; + const eastl::span<const ChunkedContentLookup::ChunkSequenceLocation* const> AllTargets( CopyData.TargetChunkLocationPtrs); struct WriteOp @@ -4187,7 +4187,7 @@ namespace { for (const CacheCopyData::ChunkTarget& ChunkTarget : CopyData.ChunkTargets) { - std::span<const ChunkedContentLookup::ChunkSequenceLocation* const> TargetRange = + eastl::span<const ChunkedContentLookup::ChunkSequenceLocation* const> TargetRange = AllTargets.subspan(TargetStart, ChunkTarget.TargetChunkLocationCount); for (const ChunkedContentLookup::ChunkSequenceLocation* Target : TargetRange) { @@ -4648,11 +4648,11 @@ namespace { } } - eastl::vector<std::pair<Oid, std::string>> ResolveBuildPartNames(BuildStorage& Storage, - const Oid& BuildId, - const eastl::vector<Oid>& BuildPartIds, - std::span<const std::string> BuildPartNames, - std::uint64_t& OutPreferredMultipartChunkSize) + eastl::vector<std::pair<Oid, std::string>> ResolveBuildPartNames(BuildStorage& Storage, + const Oid& BuildId, + const eastl::vector<Oid>& BuildPartIds, + eastl::span<const std::string> BuildPartNames, + std::uint64_t& OutPreferredMultipartChunkSize) { eastl::vector<std::pair<Oid, std::string>> Result; { @@ -4920,7 +4920,7 @@ namespace { } RemoteContent = - MergeChunkedFolderContents(OutPartContents[0], std::span<const ChunkedFolderContent>(OutPartContents).subspan(1)); + MergeChunkedFolderContents(OutPartContents[0], eastl::span<const ChunkedFolderContent>(OutPartContents).subspan(1)); { tsl::robin_set<IoHash> AllBlockHashes; for (const ChunkBlockDescription& Description : OutBlockDescriptions) @@ -5039,7 +5039,7 @@ namespace { { LocalContent = MergeChunkedFolderContents(SavedPartContents[0], - std::span<const ChunkedFolderContent>(SavedPartContents).subspan(1)); + eastl::span<const ChunkedFolderContent>(SavedPartContents).subspan(1)); } if (!LocalFolderState.AreKnownFilesEqual(CurrentLocalFolderContent)) @@ -5181,14 +5181,14 @@ namespace { return LocalContent; } - void DownloadFolder(BuildStorage& Storage, - const Oid& BuildId, - const eastl::vector<Oid>& BuildPartIds, - std::span<const std::string> BuildPartNames, - const std::filesystem::path& Path, - bool AllowMultiparts, - bool WipeTargetFolder, - bool PostDownloadVerify) + void DownloadFolder(BuildStorage& Storage, + const Oid& BuildId, + const eastl::vector<Oid>& BuildPartIds, + eastl::span<const std::string> 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<std::uint64_t> BatchSizes, uint64_t RequestIndex) { + auto GeneratePutCacheValueRequest([this, &KeyDistribution, &Generator](eastl::span<std::uint64_t> 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<std::uint64_t> BatchSizes, uint64_t RequestIndex) { + auto GeneratePutCacheRecordRequest([this, &KeyDistribution, &Generator](eastl::span<std::uint64_t> 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<uint64_t> BatchSizes = std::span<uint64_t>(Sizes).subspan(Offset, Min(Max(SizeCount, 1u), Sizes.size() - Offset)); + size_t SizeCount = SizeCountDistribution(Generator); + eastl::span<uint64_t> BatchSizes = eastl::span<uint64_t>(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<const CbAttachment> Attachments = Package.GetAttachments(); + CbObject Object = Package.GetObject(); + eastl::span<const CbAttachment> 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<const std::string> ChunkIds) -> std::vector<std::string> { + auto ChunksToOidStrings = [](HttpClient& Http, + std::string_view WorkspaceId, + std::string_view ShareId, + eastl::span<const std::string> ChunkIds) -> std::vector<std::string> { std::vector<std::string> Oids; Oids.reserve(ChunkIds.size()); eastl::vector<size_t> 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<cxxopts::Options*> SubOptions, - cxxopts::Options*& OutSubOption, - eastl::vector<char*>& OutSubCommandArguments) + int argc, + char** argv, + eastl::span<cxxopts::Options*> SubOptions, + cxxopts::Options*& OutSubOption, + eastl::vector<char*>& 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<cxxopts::Options*> SubOptions, - cxxopts::Options*& OutSubOption, - eastl::vector<char*>& OutSubCommandArguments); + static int GetSubCommand(cxxopts::Options& Options, + int argc, + char** argv, + eastl::span<cxxopts::Options*> SubOptions, + cxxopts::Options*& OutSubOption, + eastl::vector<char*>& 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<const CbAttachment> InAttachments) +CbPackage::AddAttachments(eastl::span<const CbAttachment> 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<uint32_t const> CompressedBlockSizes(reinterpret_cast<const uint32_t*>(BlockSizeView.GetData()), Header.BlockCount); + eastl::span<uint32_t const> CompressedBlockSizes(reinterpret_cast<const uint32_t*>(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<uint32_t const> CompressedBlockSizes(reinterpret_cast<const uint32_t*>(BlockSizeView.GetData()), Header.BlockCount); + eastl::span<uint32_t const> CompressedBlockSizes(reinterpret_cast<const uint32_t*>(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<uint32_t const> CompressedBlockSizes(reinterpret_cast<const uint32_t*>(BlockSizeView.GetData()), Header.BlockCount); + MemoryView BlockSizeView = HeaderRawData.Mid(sizeof(Header), Header.BlockCount * sizeof(uint32_t)); + eastl::span<uint32_t const> CompressedBlockSizes(reinterpret_cast<const uint32_t*>(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<uint32_t const> CompressedBlockSizes(reinterpret_cast<const uint32_t*>(BlockSizeView.GetData()), Header.BlockCount); + MemoryView BlockSizeView = HeaderRawData.Mid(sizeof(Header), Header.BlockCount * sizeof(uint32_t)); + eastl::span<uint32_t const> CompressedBlockSizes(reinterpret_cast<const uint32_t*>(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<uint64_t const> Values, std::span<uint64_t const> ExpectedValues, uint64_t Offset) { + auto ValidateData = [](eastl::span<uint64_t const> Values, eastl::span<uint64_t const> 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<uint64_t>& ExpectedValues) { SharedBuffer Uncompressed = Compressed.Decompress(OffsetCount * sizeof(uint64_t), Count * sizeof(uint64_t)); CHECK(Uncompressed.GetSize() == Count * sizeof(uint64_t)); - std::span<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t> 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<uint64_t const> 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<uint64_t> 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<uint64_t const> 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<uint64_t> 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<uint64_t const> 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<uint64_t> 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<uint64_t const> 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<uint64_t const> 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<uint64_t const> 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<uint64_t const> 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<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); - std::span<uint64_t const> Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), - RawSize / sizeof(uint64_t)); + SharedBuffer Uncompressed = Compressed.CopyRange(RawOffset, RawSize).Decompress(); + eastl::span<uint64_t const> AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); - std::span<uint64_t const> Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), - RawSize / sizeof(uint64_t)); + SharedBuffer Uncompressed = Compressed.CopyRange(RawOffset, RawSize).Decompress(); + eastl::span<uint64_t const> AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); - std::span<uint64_t const> Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), - RawSize / sizeof(uint64_t)); + SharedBuffer Uncompressed = Compressed.GetRange(RawOffset, RawSize).Decompress(); + eastl::span<uint64_t const> AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); - std::span<uint64_t const> Values((const uint64_t*)(((const uint8_t*)(Uncompressed.GetData()) + FirstBlockOffset)), - RawSize / sizeof(uint64_t)); + SharedBuffer Uncompressed = Compressed.GetRange(RawOffset, RawSize).Decompress(); + eastl::span<uint64_t const> AllValues((const uint64_t*)Uncompressed.GetData(), RawSize / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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<uint64_t const> Values((const uint64_t*)Uncompressed.GetData(), Uncompressed.GetSize() / sizeof(uint64_t)); + eastl::span<uint64_t const> 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 <zencore/compress.h> #include <zencore/iohash.h> +#include <EASTL/span.h> #include <functional> -#include <span> #include <variant> #include <EASTL/fixed_vector.h> @@ -267,9 +267,9 @@ public: } /** Returns the attachments in this package. */ - inline std::span<const CbAttachment> GetAttachments() const + inline eastl::span<const CbAttachment> GetAttachments() const { - return std::span<const CbAttachment>(begin(Attachments), end(Attachments)); + return eastl::span<const CbAttachment>(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<const CbAttachment> Attachments); + void AddAttachments(eastl::span<const CbAttachment> 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 <zencore/sharedbuffer.h> #include <zencore/zencore.h> +#include <EASTL/span.h> #include <EASTL/vector.h> #include <functional> -#include <span> #include <EASTL/fixed_vector.h> @@ -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<const SharedBuffer> GetSegments() const + [[nodiscard]] inline eastl::span<const SharedBuffer> GetSegments() const { - return std::span<const SharedBuffer>{begin(m_Segments), end(m_Segments)}; + return eastl::span<const SharedBuffer>{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<IoBuffer>&& Container) { return Container.size(); } - inline void AppendBuffers(std::span<IoBuffer>&& Container) + static inline size_t GetBufferCount(eastl::span<IoBuffer>&& Container) { return Container.size(); } + inline void AppendBuffers(eastl::span<IoBuffer>&& 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 <zencore/intmath.h> #include <zencore/thread.h> +#include <EASTL/span.h> #include <EASTL/vector.h> #include <cstddef> #include <cstring> -#include <span> namespace zen { @@ -307,7 +307,7 @@ template<ContiguousRange R> [[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<ContiguousRange R> [[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 <EASTL/span.h> #include <stdint.h> #include <string.h> #include <charconv> @@ -12,9 +13,7 @@ #include <compare> #include <concepts> #include <optional> -#include <span> #include <string_view> - #include <type_traits> 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<char> Buffer, uint64_t Num); -ZENCORE_API bool ToString(std::span<char> Buffer, int64_t Num); +ZENCORE_API bool ToString(eastl::span<char> Buffer, uint64_t Num); +ZENCORE_API bool ToString(eastl::span<char> 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<char> Buffer); -ZENCORE_API size_t NiceBytesToBuffer(uint64_t Num, std::span<char> Buffer); -ZENCORE_API size_t NiceByteRateToBuffer(uint64_t Num, uint64_t ms, std::span<char> Buffer); -ZENCORE_API size_t NiceLatencyNsToBuffer(uint64_t NanoSeconds, std::span<char> Buffer); -ZENCORE_API size_t NiceTimeSpanMsToBuffer(uint64_t Milliseconds, std::span<char> Buffer); +ZENCORE_API size_t NiceNumToBuffer(uint64_t Num, eastl::span<char> Buffer); +ZENCORE_API size_t NiceBytesToBuffer(uint64_t Num, eastl::span<char> Buffer); +ZENCORE_API size_t NiceByteRateToBuffer(uint64_t Num, uint64_t ms, eastl::span<char> Buffer); +ZENCORE_API size_t NiceLatencyNsToBuffer(uint64_t NanoSeconds, eastl::span<char> Buffer); +ZENCORE_API size_t NiceTimeSpanMsToBuffer(uint64_t Milliseconds, eastl::span<char> 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<char> BufferSpan(Buffer, sizeof(Buffer) - 8); + eastl::span<char> 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<std::string> Strings, std::string_view Delimiter) -> std::string { + auto Join = [](eastl::span<std::string> 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 <zencore/trace.h> # include <atomic> -# include <span> +# include <EASTL/span.h> # include <zencore/windows.h> @@ -396,7 +396,7 @@ FBacktracer::FBacktracer(FMalloc* InMalloc) //////////////////////////////////////////////////////////////////////////////// FBacktracer::~FBacktracer() { - std::span<FModule> ModulesView(Modules, ModulesNum); + eastl::span<FModule> 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<FFunction> 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<FFunction> 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<char> Buffer, uint64_t Num) +ToString(eastl::span<char> Buffer, uint64_t Num) { snprintf(Buffer.data(), Buffer.size(), "%" PRIu64, Num); return true; } bool -ToString(std::span<char> Buffer, int64_t Num) +ToString(eastl::span<char> 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<char> Buffer, NicenumFormat Format) +NiceNumGeneral(uint64_t Num, eastl::span<char> Buffer, NicenumFormat Format) { switch (Format) { @@ -351,19 +351,19 @@ NiceNumGeneral(uint64_t Num, std::span<char> Buffer, NicenumFormat Format) } size_t -NiceNumToBuffer(uint64_t Num, std::span<char> Buffer) +NiceNumToBuffer(uint64_t Num, eastl::span<char> Buffer) { return NiceNumGeneral(Num, Buffer, kNicenum1024); } size_t -NiceBytesToBuffer(uint64_t Num, std::span<char> Buffer) +NiceBytesToBuffer(uint64_t Num, eastl::span<char> Buffer) { return NiceNumGeneral(Num, Buffer, kNicenumBytes); } size_t -NiceByteRateToBuffer(uint64_t Num, uint64_t ElapsedMs, std::span<char> Buffer) +NiceByteRateToBuffer(uint64_t Num, uint64_t ElapsedMs, eastl::span<char> Buffer) { size_t n = 0; @@ -385,13 +385,13 @@ NiceByteRateToBuffer(uint64_t Num, uint64_t ElapsedMs, std::span<char> Buffer) } size_t -NiceLatencyNsToBuffer(uint64_t Nanos, std::span<char> Buffer) +NiceLatencyNsToBuffer(uint64_t Nanos, eastl::span<char> Buffer) { return NiceNumGeneral(Nanos, Buffer, kNicenumTime); } size_t -NiceTimeSpanMsToBuffer(uint64_t Millis, std::span<char> Buffer) +NiceTimeSpanMsToBuffer(uint64_t Millis, eastl::span<char> 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<IoHash> AttachmentsToSend; - std::span<const CbAttachment> Attachments = Package.GetAttachments(); + eastl::vector<IoHash> AttachmentsToSend; + eastl::span<const CbAttachment> 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 <zencore/thread.h> #include <zenhttp/packageformat.h> +#include <EASTL/span.h> #include <charconv> #include <mutex> -#include <span> #include <string_view> #include <EASTL/fixed_vector.h> @@ -529,7 +529,7 @@ HttpServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType void HttpServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, CompositeBuffer& Payload) { - std::span<const SharedBuffer> Segments = Payload.GetSegments(); + eastl::span<const SharedBuffer> Segments = Payload.GetSegments(); eastl::fixed_vector<IoBuffer, 64> Buffers; Buffers.reserve(Segments.size()); @@ -539,7 +539,7 @@ HttpServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType Buffers.push_back(Segment.AsIoBuffer()); } - WriteResponse(ResponseCode, ContentType, std::span<IoBuffer>(begin(Buffers), end(Buffers))); + WriteResponse(ResponseCode, ContentType, eastl::span<IoBuffer>(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<std::pair<std::string_view, std::string_view>>&& List) : Entries(List.begin(), List.end()) {} + KeyValueMap(eastl::span<std::pair<std::string_view, std::string_view>>&& List) : Entries(List.begin(), List.end()) {} KeyValueMap(std::initializer_list<std::pair<std::string_view, std::string_view>>&& 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 <zencore/uid.h> #include <zenhttp/httpcommon.h> +#include <EASTL/span.h> #include <functional> #include <gsl/gsl-lite.hpp> #include <list> #include <map> #include <regex> -#include <span> #include <unordered_map> 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<IoBuffer> Blobs) = 0; + virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span<IoBuffer> 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<CbAttachment>& GetAttachments() { return m_Attachments; } CbObject GetRootObject() { return m_RootObject; } - std::span<IoBuffer> GetPayloadBuffers() { return m_PayloadBuffers; } + eastl::span<IoBuffer> 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 <zencore/testutils.h> #include <zencore/trace.h> +#include <EASTL/span.h> #include <EASTL/vector.h> -#include <span> #include <EASTL/fixed_vector.h> @@ -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<const CbAttachment>& Attachments = Data.GetAttachments(); - IoBufferVec_t ResponseBuffers; + const eastl::span<const CbAttachment>& 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<const SharedBuffer> Segments = Compressed.GetSegments(); + eastl::span<const SharedBuffer> 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<const SharedBuffer> Segments = AttachmentBinary.GetSegments(); + eastl::span<const SharedBuffer> 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<IoBuffer> Blobs) override; + virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span<IoBuffer> Blobs) override; virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::u8string_view ResponseString) override; virtual void WriteResponseAsync(std::function<void(HttpServerRequest&)>&& 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<IoBuffer> BlobList) + void InitializeForPayload(uint16_t ResponseCode, eastl::span<IoBuffer> BlobList) { ZEN_MEMSCOPE(GetHttpasioTag()); @@ -920,7 +920,7 @@ HttpAsioServerRequest::WriteResponse(HttpResponseCode ResponseCode) } void -HttpAsioServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::span<IoBuffer> Blobs) +HttpAsioServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span<IoBuffer> 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<IoBuffer> Blobs) override; + virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span<IoBuffer> Blobs) override; virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::u8string_view ResponseString) override; virtual void WriteResponseAsync(std::function<void(HttpServerRequest&)>&& 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<IoBuffer> BlobList); + void InitializeForPayload(uint16_t ResponseCode, eastl::span<IoBuffer> 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<IoBuffer> BlobList) +HttpPluginResponse::InitializeForPayload(uint16_t ResponseCode, eastl::span<IoBuffer> 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<IoBuffer> Blobs) +HttpPluginServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span<IoBuffer> 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<IoBuffer> Blobs) override; + virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span<IoBuffer> Blobs) override; virtual void WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::u8string_view ResponseString) override; virtual void WriteResponseAsync(std::function<void(HttpServerRequest&)>&& 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<IoBuffer> Blobs); + HttpMessageResponseRequest(HttpSysTransaction& InRequest, + uint16_t ResponseCode, + HttpContentType ContentType, + eastl::span<IoBuffer> Blobs); ~HttpMessageResponseRequest(); virtual void IssueRequest(std::error_code& ErrorCode) override final; @@ -392,7 +392,7 @@ private: HttpContentType m_ContentType = HttpContentType::kBinary; eastl::fixed_vector<IoBuffer, 16> m_DataBuffers; - void InitializeForPayload(uint16_t ResponseCode, std::span<IoBuffer> Blobs); + void InitializeForPayload(uint16_t ResponseCode, eastl::span<IoBuffer> 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<IoBuffer> BlobList) +HttpMessageResponseRequest::HttpMessageResponseRequest(HttpSysTransaction& InRequest, + uint16_t ResponseCode, + HttpContentType ContentType, + eastl::span<IoBuffer> BlobList) : HttpSysRequestHandler(InRequest) , m_ContentType(ContentType) { @@ -442,7 +442,7 @@ HttpMessageResponseRequest::~HttpMessageResponseRequest() } void -HttpMessageResponseRequest::InitializeForPayload(uint16_t ResponseCode, std::span<IoBuffer> BlobList) +HttpMessageResponseRequest::InitializeForPayload(uint16_t ResponseCode, eastl::span<IoBuffer> BlobList) { ZEN_TRACE_CPU("httpsys::InitializeForPayload"); @@ -1747,7 +1747,7 @@ HttpSysServerRequest::WriteResponse(HttpResponseCode ResponseCode) } void -HttpSysServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, std::span<IoBuffer> Blobs) +HttpSysServerRequest::WriteResponse(HttpResponseCode ResponseCode, HttpContentType ContentType, eastl::span<IoBuffer> 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<const IoBuffer> Payload) +HttpServerTracer::WriteDebugPayload(std::string_view Filename, const eastl::span<const IoBuffer> Payload) { uint64_t PayloadSize = 0; eastl::vector<const IoBuffer*> 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<const IoBuffer> Payload); + void WriteDebugPayload(std::string_view Filename, const eastl::span<const IoBuffer> 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 <EASTL/span.h> #include <atomic> #include <filesystem> #include <map> #include <random> -#include <span> #include <thread> #include <typeindex> #include <unordered_map> @@ -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<uint16_t> UpstreamPorts, bool Debug) + static ZenConfig NewWithThreadedUpstreams(uint16_t NewPort, eastl::span<uint16_t> UpstreamPorts, bool Debug) { std::string Args = Debug ? "--debug" : ""; for (uint16_t Port : UpstreamPorts) @@ -598,7 +598,7 @@ namespace utils { return Value; }; - eastl::vector<std::pair<Oid, CompressedBuffer>> CreateAttachments(const std::span<const size_t>& Sizes) + eastl::vector<std::pair<Oid, CompressedBuffer>> CreateAttachments(const eastl::span<const size_t>& Sizes) { eastl::vector<std::pair<Oid, CompressedBuffer>> Result; Result.reserve(Sizes.size()); @@ -610,7 +610,7 @@ namespace utils { return Result; } - eastl::vector<std::pair<Oid, CompressedBuffer>> CreateSemiRandomAttachments(const std::span<const size_t>& Sizes) + eastl::vector<std::pair<Oid, CompressedBuffer>> CreateSemiRandomAttachments(const eastl::span<const size_t>& Sizes) { eastl::vector<std::pair<Oid, CompressedBuffer>> Result; Result.reserve(Sizes.size()); @@ -746,8 +746,8 @@ TEST_CASE("zcache.cbpackage") }; auto IsEqual = [](zen::CbPackage Lhs, zen::CbPackage Rhs) -> bool { - std::span<const zen::CbAttachment> LhsAttachments = Lhs.GetAttachments(); - std::span<const zen::CbAttachment> RhsAttachments = Rhs.GetAttachments(); + eastl::span<const zen::CbAttachment> LhsAttachments = Lhs.GetAttachments(); + eastl::span<const zen::CbAttachment> 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<zen::CacheKey> 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<zen::CacheKey> Keys, + zen::CachePolicy Policy, + zen::RpcAcceptOptions AcceptOptions = zen::RpcAcceptOptions::kNone, + int Pid = 0) -> GetCacheRecordResult { cacherequests::GetCacheRecordsRequest Request = {.AcceptMagic = kCbPkgMagic, .AcceptOptions = static_cast<uint16_t>(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<zen::CacheKey> Keys, - zen::CachePolicy Policy) -> GetCacheRecordResult { + auto GetCacheRecords = [](std::string_view BaseUri, + std::string_view Namespace, + eastl::span<zen::CacheKey> 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<const std::pair<Oid, CompressedBuffer>>& Attachments) +CreateOplogPackage(const Oid& Id, const eastl::span<const std::pair<Oid, CompressedBuffer>>& 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<std::string> Buckets) +ParseBucketConfigs(eastl::span<std::string> 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<const OplogEntryAddress> Addresses) const + uint64_t GetEffectiveBlobsSize(eastl::span<const OplogEntryAddress> Addresses) const { uint64_t EffectiveSize = 0; for (const OplogEntryAddress& Address : Addresses) @@ -583,7 +583,7 @@ struct ProjectStore::OplogStorage : public RefCounted } void Compact( - std::span<const uint32_t> LSNs, + eastl::span<const uint32_t> LSNs, std::function<void(const Oid& OpKeyHash, uint32_t OldLSN, uint32_t NewLSN, const OplogEntryAddress& NewAddress)>&& Callback, bool RetainLSNs, bool DryRun) @@ -901,7 +901,7 @@ struct ProjectStore::OplogStorage : public RefCounted InvalidEntries); } - void ReplayLogEntries(const std::span<OplogEntryAddress> Entries, std::function<void(CbObjectView)>&& Handler) + void ReplayLogEntries(const eastl::span<OplogEntryAddress> Entries, std::function<void(CbObjectView)>&& Handler) { ZEN_MEMSCOPE(GetProjectstoreTag()); ZEN_TRACE_CPU("Store::OplogStorage::ReplayLogEntries"); @@ -993,7 +993,7 @@ struct ProjectStore::OplogStorage : public RefCounted return Entry; } - eastl::vector<OplogEntry> AppendOps(std::span<const AppendOpData> Ops) + eastl::vector<OplogEntry> AppendOps(eastl::span<const AppendOpData> Ops) { ZEN_MEMSCOPE(GetProjectstoreTag()); ZEN_TRACE_CPU("Store::OplogStorage::AppendOps"); @@ -2087,7 +2087,7 @@ ProjectStore::Oplog::GetChunkByRawHash(const IoHash& RawHash) } bool -ProjectStore::Oplog::IterateChunks(std::span<IoHash> RawHashes, +ProjectStore::Oplog::IterateChunks(eastl::span<IoHash> RawHashes, bool IncludeModTag, const std::function<bool(size_t Index, const IoBuffer& Payload, uint64_t ModTag)>& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, @@ -2103,7 +2103,7 @@ ProjectStore::Oplog::IterateChunks(std::span<IoHash> RawHashes, } bool -ProjectStore::Oplog::IterateChunks(std::span<Oid> ChunkIds, +ProjectStore::Oplog::IterateChunks(eastl::span<Oid> ChunkIds, bool IncludeModTag, const std::function<bool(size_t Index, const IoBuffer& Payload, uint64_t ModTag)>& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, @@ -2368,13 +2368,13 @@ ProjectStore::Oplog::IterateOplog(std::function<void(CbObjectView)>&& Handler, c } template<typename ContainerElement> -std::span<ContainerElement> +eastl::span<ContainerElement> CreateSpanFromPaging(eastl::vector<ContainerElement>& Container, const ProjectStore::Oplog::Paging& Paging) { - std::span<ContainerElement> Span(Container); - int32_t Size = int32_t(Container.size()); - int32_t Start = std::clamp(Paging.Start, 0, Size); - int32_t End = Paging.Count < 0 ? Size : (Start + std::min<int32_t>(Paging.Count, Size - Start)); + eastl::span<ContainerElement> Span(Container); + int32_t Size = int32_t(Container.size()); + int32_t Start = std::clamp(Paging.Start, 0, Size); + int32_t End = Paging.Count < 0 ? Size : (Start + std::min<int32_t>(Paging.Count, Size - Start)); return Span.subspan(Start, End - Start); } @@ -2403,7 +2403,7 @@ ProjectStore::Oplog::IterateOplogLocked(std::function<void(CbObjectView)>&& Hand return Lhs.Offset < Rhs.Offset; }); - std::span<OplogEntryAddress> EntrySpan = CreateSpanFromPaging(Entries, EntryPaging); + eastl::span<OplogEntryAddress> EntrySpan = CreateSpanFromPaging(Entries, EntryPaging); m_Storage->ReplayLogEntries(EntrySpan, [&](CbObjectView Op) { Handler(Op); }); } @@ -2428,7 +2428,7 @@ ProjectStore::Oplog::GetAttachmentsLocked(eastl::vector<IoHash>& OutAttachments, if (GetAttachmentsFromMetaData<Oid, IoHash>( MetadataPayload, OplogMetaDataExpectedMagic, - [&](std::span<const Oid> Keys, std::span<const uint32_t> AttachmentCounts, std::span<const IoHash> Attachments) { + [&](eastl::span<const Oid> Keys, eastl::span<const uint32_t> AttachmentCounts, eastl::span<const IoHash> Attachments) { ZEN_UNUSED(Keys); ZEN_UNUSED(AttachmentCounts); OutAttachments.insert(OutAttachments.end(), Attachments.begin(), Attachments.end()); @@ -2463,7 +2463,7 @@ ProjectStore::Oplog::GetAttachmentsLocked(eastl::vector<IoHash>& OutAttachments, IoBuffer MetaPayload = BuildReferenceMetaData<Oid>(OplogMetaDataExpectedMagic, Keys, AttachmentCounts, - std::span<const IoHash>(FirstAttachment, AttachmentCount)) + eastl::span<const IoHash>(FirstAttachment, AttachmentCount)) .Flatten() .AsIoBuffer(); @@ -2559,8 +2559,8 @@ ProjectStore::Oplog::IterateOplogWithKey(std::function<void(uint32_t, const Oid& } } - std::span<OplogEntryAddress> EntrySpan = CreateSpanFromPaging(SortedEntries, EntryPaging); - size_t EntryIndex = EntrySpan.empty() ? 0 : static_cast<size_t>(&EntrySpan.front() - &SortedEntries.front()); + eastl::span<OplogEntryAddress> EntrySpan = CreateSpanFromPaging(SortedEntries, EntryPaging); + size_t EntryIndex = EntrySpan.empty() ? 0 : static_cast<size_t>(&EntrySpan.front() - &SortedEntries.front()); m_Storage->ReplayLogEntries(EntrySpan, [&](CbObjectView Op) { Handler(SortedLSNs[EntryIndex], SortedKeys[EntryIndex], Op); EntryIndex++; @@ -2630,7 +2630,7 @@ ProjectStore::Oplog::AddChunkMappings(const std::unordered_map<Oid, IoHash, Oid: } void -ProjectStore::Oplog::CaptureAddedAttachments(std::span<const IoHash> AttachmentHashes) +ProjectStore::Oplog::CaptureAddedAttachments(eastl::span<const IoHash> AttachmentHashes) { ZEN_MEMSCOPE(GetProjectstoreTag()); @@ -2717,7 +2717,7 @@ ProjectStore::Oplog::GetCapturedAttachmentsLocked() } eastl::vector<IoHash> -ProjectStore::Oplog::CheckPendingChunkReferences(std::span<const IoHash> ChunkHashes, const GcClock::Duration& RetainTime) +ProjectStore::Oplog::CheckPendingChunkReferences(eastl::span<const IoHash> ChunkHashes, const GcClock::Duration& RetainTime) { ZEN_MEMSCOPE(GetProjectstoreTag()); @@ -2749,7 +2749,7 @@ ProjectStore::Oplog::CheckPendingChunkReferences(std::span<const IoHash> ChunkHa } void -ProjectStore::Oplog::RemovePendingChunkReferences(std::span<const IoHash> ChunkHashes) +ProjectStore::Oplog::RemovePendingChunkReferences(eastl::span<const IoHash> ChunkHashes) { ZEN_MEMSCOPE(GetProjectstoreTag()); @@ -3060,7 +3060,7 @@ ProjectStore::Oplog::AppendNewOplogEntry(CbObjectView Core) } eastl::vector<uint32_t> -ProjectStore::Oplog::AppendNewOplogEntries(std::span<CbObjectView> Cores) +ProjectStore::Oplog::AppendNewOplogEntries(eastl::span<CbObjectView> Cores) { ZEN_MEMSCOPE(GetProjectstoreTag()); ZEN_TRACE_CPU("Store::Oplog::AppendNewOplogEntries"); @@ -5269,7 +5269,7 @@ ProjectStore::WriteOplog(const std::string_view ProjectId, const std::string_vie auto OnChunkedAttachment = [](const ChunkedInfo&) {}; - auto OnReferencedAttachments = [&Oplog](std::span<IoHash> RawHashes) { Oplog->CaptureAddedAttachments(RawHashes); }; + auto OnReferencedAttachments = [&Oplog](eastl::span<IoHash> RawHashes) { Oplog->CaptureAddedAttachments(RawHashes); }; // Make sure we retain any attachments we download before writing the oplog Oplog->EnableUpdateCapture(); auto _ = MakeGuard([&Oplog]() { Oplog->DisableUpdateCapture(); }); @@ -5527,7 +5527,7 @@ ProjectStore::Rpc(HttpServerRequest& HttpReq, return true; } - std::span<const CbAttachment> Attachments = Package.GetAttachments(); + eastl::span<const CbAttachment> Attachments = Package.GetAttachments(); if (!Attachments.empty()) { eastl::vector<IoBuffer> WriteAttachmentBuffers; @@ -6268,7 +6268,7 @@ public: FilterReferences(Ctx, fmt::format("projectstore [LOCKSTATE] '{}'", "projectstore"), m_References); } - virtual std::span<IoHash> GetUnusedReferences(GcCtx& Ctx, std::span<IoHash> IoCids) override + virtual eastl::span<IoHash> GetUnusedReferences(GcCtx& Ctx, eastl::span<IoHash> IoCids) override { ZEN_TRACE_CPU("Store::GetUnusedReferences"); @@ -6290,8 +6290,8 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); + UsedCount = IoCids.size() - UnusedReferences.size(); return UnusedReferences; } @@ -6452,7 +6452,7 @@ public: FilterReferences(Ctx, fmt::format("projectstore [LOCKSTATE] '{}'", m_OplogBasePath), m_AddedReferences); } - virtual std::span<IoHash> GetUnusedReferences(GcCtx& Ctx, std::span<IoHash> IoCids) override + virtual eastl::span<IoHash> GetUnusedReferences(GcCtx& Ctx, eastl::span<IoHash> IoCids) override { ZEN_TRACE_CPU("Store::Oplog::GetUnusedReferences"); @@ -6476,9 +6476,9 @@ public: m_OplogId); }); - std::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); - UnusedReferences = KeepUnusedReferences(m_AddedReferences, UnusedReferences); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); + UnusedReferences = KeepUnusedReferences(m_AddedReferences, UnusedReferences); + UsedCount = IoCids.size() - UnusedReferences.size(); return UnusedReferences; } @@ -6736,7 +6736,7 @@ namespace testutils { return OidStringBuilder.ToString(); } - CbPackage CreateBulkDataOplogPackage(const Oid& Id, const std::span<const std::pair<Oid, CompressedBuffer>>& Attachments) + CbPackage CreateBulkDataOplogPackage(const Oid& Id, const eastl::span<const std::pair<Oid, CompressedBuffer>>& Attachments) { CbPackage Package; CbObjectWriter Object; @@ -6762,9 +6762,9 @@ namespace testutils { return Package; }; - CbPackage CreateFilesOplogPackage(const Oid& Id, - const std::filesystem::path ProjectRootDir, - const std::span<const std::pair<Oid, std::filesystem::path>>& Attachments) + CbPackage CreateFilesOplogPackage(const Oid& Id, + const std::filesystem::path ProjectRootDir, + const eastl::span<const std::pair<Oid, std::filesystem::path>>& Attachments) { CbPackage Package; CbObjectWriter Object; @@ -6789,9 +6789,9 @@ namespace testutils { }; eastl::vector<std::pair<Oid, CompressedBuffer>> CreateAttachments( - const std::span<const size_t>& Sizes, - OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, - uint64_t BlockSize = 0) + const eastl::span<const size_t>& Sizes, + OodleCompressionLevel CompressionLevel = OodleCompressionLevel::VeryFast, + uint64_t BlockSize = 0) { eastl::vector<std::pair<Oid, CompressedBuffer>> Result; Result.reserve(Sizes.size()); 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<IoHash> RawHashes, + bool IterateChunks(eastl::span<IoHash> RawHashes, bool IncludeModTag, const std::function<bool(size_t Index, const IoBuffer& Payload, uint64_t ModTag)>& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit); - bool IterateChunks(std::span<Oid> ChunkIds, + bool IterateChunks(eastl::span<Oid> ChunkIds, bool IncludeModTag, const std::function<bool(size_t Index, const IoBuffer& Payload, uint64_t ModTag)>& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, @@ -141,7 +141,7 @@ public: uint32_t AppendNewOplogEntry(CbPackage Op); uint32_t AppendNewOplogEntry(CbObjectView Core); - eastl::vector<uint32_t> AppendNewOplogEntries(std::span<CbObjectView> Cores); + eastl::vector<uint32_t> AppendNewOplogEntries(eastl::span<CbObjectView> Cores); enum UpdateType { @@ -173,10 +173,10 @@ public: void EnableUpdateCapture(); void DisableUpdateCapture(); - void CaptureAddedAttachments(std::span<const IoHash> AttachmentHashes); + void CaptureAddedAttachments(eastl::span<const IoHash> AttachmentHashes); eastl::vector<IoHash> GetCapturedAttachmentsLocked(); - eastl::vector<IoHash> CheckPendingChunkReferences(std::span<const IoHash> ChunkHashes, const GcClock::Duration& RetainTime); - void RemovePendingChunkReferences(std::span<const IoHash> ChunkHashes); + eastl::vector<IoHash> CheckPendingChunkReferences(eastl::span<const IoHash> ChunkHashes, const GcClock::Duration& RetainTime); + void RemovePendingChunkReferences(eastl::span<const IoHash> ChunkHashes); eastl::vector<IoHash> 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<ThinChunkBlockDescription> -GetBlocksFromOplog(CbObjectView ContainerObject, std::span<const IoHash> IncludeBlockHashes) +GetBlocksFromOplog(CbObjectView ContainerObject, eastl::span<const IoHash> IncludeBlockHashes) { using namespace std::literals; eastl::vector<ThinChunkBlockDescription> Result; @@ -1650,7 +1650,7 @@ BuildContainer(CidStore& ChunkStore, CompositeBuffer Decompressed = Compressed.DecompressToComposite(); if (Decompressed) { - std::span<const SharedBuffer> Segments = Decompressed.GetSegments(); + eastl::span<const SharedBuffer> 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<void(std::span<IoHash> RawHashes)>& OnReferencedAttachments, + const std::function<void(eastl::span<IoHash> RawHashes)>& OnReferencedAttachments, const std::function<bool(const IoHash& RawHash)>& HasAttachment, const std::function<void(const IoHash& BlockHash, eastl::vector<IoHash>&& Chunks)>& OnNeedBlock, const std::function<void(const IoHash& RawHash)>& OnNeedAttachment, @@ -2778,7 +2778,7 @@ ParseOplogContainer(const CbObject& ContainerObject, RemoteProjectStore::Result SaveOplogContainer(ProjectStore::Oplog& Oplog, const CbObject& ContainerObject, - const std::function<void(std::span<IoHash> RawHashes)>& OnReferencedAttachments, + const std::function<void(eastl::span<IoHash> RawHashes)>& OnReferencedAttachments, const std::function<bool(const IoHash& RawHash)>& HasAttachment, const std::function<void(const IoHash& BlockHash, eastl::vector<IoHash>&& Chunks)>& OnNeedBlock, const std::function<void(const IoHash& RawHash)>& OnNeedAttachment, @@ -2975,7 +2975,7 @@ LoadOplog(CidStore& ChunkStore, } }; - auto OnReferencedAttachments = [&Oplog](std::span<IoHash> RawHashes) { Oplog.CaptureAddedAttachments(RawHashes); }; + auto OnReferencedAttachments = [&Oplog](eastl::span<IoHash> RawHashes) { Oplog.CaptureAddedAttachments(RawHashes); }; // Make sure we retain any attachments we download before writing the oplog Oplog.EnableUpdateCapture(); 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<void(std::span<IoHash> RawHashes)>& OnReferencedAttachments, + const std::function<void(eastl::span<IoHash> RawHashes)>& OnReferencedAttachments, const std::function<bool(const IoHash& RawHash)>& HasAttachment, const std::function<void(const IoHash& BlockHash, eastl::vector<IoHash>&& Chunks)>& OnNeedBlock, const std::function<void(const IoHash& RawHash)>& OnNeedAttachment, @@ -168,6 +168,6 @@ RemoteProjectStore::Result LoadOplog(CidStore& ChunkStore, JobContext* OptionalContext); eastl::vector<IoHash> GetBlockHashesFromOplog(CbObjectView ContainerObject); -eastl::vector<ThinChunkBlockDescription> GetBlocksFromOplog(CbObjectView ContainerObject, std::span<const IoHash> IncludeBlockHashes); +eastl::vector<ThinChunkBlockDescription> GetBlocksFromOplog(CbObjectView ContainerObject, eastl::span<const IoHash> 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<const CbAttachment> Attachments = Package.GetAttachments(); + CbPackage Package = Response.AsPackage(); + eastl::span<const CbAttachment> 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<CacheKeyRequest*> Requests, - OnCacheRecordGetComplete&& OnComplete) override + virtual GetUpstreamCacheResult GetCacheRecords(std::string_view Namespace, + eastl::span<CacheKeyRequest*> 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<CacheChunkRequest*> CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) override final + virtual GetUpstreamCacheResult GetCacheChunks(std::string_view Namespace, + eastl::span<CacheChunkRequest*> 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<CacheValueRequest*> CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) override final + virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, + eastl::span<CacheValueRequest*> 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<IoBuffer const> Values) override + virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, + IoBuffer RecordValue, + eastl::span<IoBuffer const> 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<IoHash> ValueContentIds, std::string& OutReason) -> bool { + const auto PutBlobs = [&](eastl::span<IoHash> 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<CacheKeyRequest*> Requests, - OnCacheRecordGetComplete&& OnComplete) override + virtual GetUpstreamCacheResult GetCacheRecords(std::string_view Namespace, + eastl::span<CacheKeyRequest*> 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<CacheValueRequest*> CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) override final + virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, + eastl::span<CacheValueRequest*> 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<CacheChunkRequest*> CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) override final + virtual GetUpstreamCacheResult GetCacheChunks(std::string_view Namespace, + eastl::span<CacheChunkRequest*> 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<IoBuffer const> Values) override + virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, + IoBuffer RecordValue, + eastl::span<IoBuffer const> Values) override { ZEN_TRACE_CPU("Upstream::Zen::PutCacheRecord"); @@ -1586,9 +1586,9 @@ public: return {}; } - virtual void GetCacheRecords(std::string_view Namespace, - std::span<CacheKeyRequest*> Requests, - OnCacheRecordGetComplete&& OnComplete) override final + virtual void GetCacheRecords(std::string_view Namespace, + eastl::span<CacheKeyRequest*> Requests, + OnCacheRecordGetComplete&& OnComplete) override final { ZEN_TRACE_CPU("Upstream::GetCacheRecords"); @@ -1654,9 +1654,9 @@ public: } } - virtual void GetCacheChunks(std::string_view Namespace, - std::span<CacheChunkRequest*> CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) override final + virtual void GetCacheChunks(std::string_view Namespace, + eastl::span<CacheChunkRequest*> 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<CacheValueRequest*> CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) override final + virtual void GetCacheValues(std::string_view Namespace, + eastl::span<CacheValueRequest*> 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<CacheKeyRequest*> Requests, - OnCacheRecordGetComplete&& OnComplete) = 0; + virtual GetUpstreamCacheResult GetCacheRecords(std::string_view Namespace, + eastl::span<CacheKeyRequest*> Requests, + OnCacheRecordGetComplete&& OnComplete) = 0; - virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, - std::span<CacheValueRequest*> CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) = 0; + virtual GetUpstreamCacheResult GetCacheValues(std::string_view Namespace, + eastl::span<CacheValueRequest*> 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<CacheChunkRequest*> CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) = 0; + virtual GetUpstreamCacheResult GetCacheChunks(std::string_view Namespace, + eastl::span<CacheChunkRequest*> CacheChunkRequests, + OnCacheChunksGetComplete&& OnComplete) = 0; - virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, - IoBuffer RecordValue, - std::span<IoBuffer const> Payloads) = 0; + virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, + IoBuffer RecordValue, + eastl::span<IoBuffer const> 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<std::string const> Urls; - std::chrono::milliseconds ConnectTimeout{}; - std::chrono::milliseconds Timeout{}; + std::string_view Name; + std::string_view Url; + eastl::span<std::string const> 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<IoBuffer> Datas, uint32_t Alignment, const WriteChunksCallback& Callback) +BlockStore::WriteChunks(eastl::span<IoBuffer> 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<const BlockStoreLocation> ChunkLocations, - std::span<const size_t> InChunkIndexes, +BlockStore::IterateBlock(eastl::span<const BlockStoreLocation> ChunkLocations, + eastl::span<const size_t> InChunkIndexes, const IterateChunksSmallSizeCallback& SmallSizeCallback, const IterateChunksLargeSizeCallback& LargeSizeCallback, uint64_t LargeSizeLimit) @@ -752,10 +752,10 @@ BlockStore::IterateBlock(std::span<const BlockStoreLocation> ChunkLocations, return ChunkLocations[IndexA].Offset < ChunkLocations[IndexB].Offset; }); - auto GetNextRange = [LargeSizeLimit, - IterateSmallChunkWindowSize, - IterateSmallChunkMaxGapSize, - &ChunkLocations](uint64_t BlockFileSize, std::span<const size_t> ChunkIndexes, size_t StartIndexOffset) -> size_t { + auto GetNextRange = [LargeSizeLimit, IterateSmallChunkWindowSize, IterateSmallChunkMaxGapSize, &ChunkLocations]( + uint64_t BlockFileSize, + eastl::span<const size_t> 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<const BlockStoreLocation> ChunkLocations, } bool -BlockStore::IterateChunks(const std::span<const BlockStoreLocation>& ChunkLocations, const IterateChunksCallback& Callback) +BlockStore::IterateChunks(const eastl::span<const BlockStoreLocation>& ChunkLocations, const IterateChunksCallback& Callback) { ZEN_MEMSCOPE(GetBlocksTag()); ZEN_TRACE_CPU("BlockStore::IterateChunks"); @@ -903,9 +903,9 @@ BlockStore::IterateChunks(const std::span<const BlockStoreLocation>& 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<size_t> ChunkIndexRange(ChunkOrder); + size_t RangeStart = 0; + size_t RangeEnd = 0; + const eastl::span<size_t> 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<BlockStoreLocation> InLocations) { + Store.WriteChunks(MultiChunkData, 4, [&](eastl::span<BlockStoreLocation> 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<BlockStoreLocation> InLocations) { + Store.WriteChunks(MultiChunkData, 4, [&](eastl::span<BlockStoreLocation> 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<const size_t> ChunkIndexes) -> bool { + Store.IterateChunks(Locations, [&](uint32_t, eastl::span<const size_t> ChunkIndexes) -> bool { WorkLatch.AddCount(1); WorkerPool.ScheduleWork([&, ChunkIndexes = eastl::vector<size_t>(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<BlockStoreLocation> Locations) { + m_BlockStore.WriteChunks(Batch->Buffers, m_Configuration.PayloadAlignment, [&](eastl::span<BlockStoreLocation> Locations) { ZEN_MEMSCOPE(GetCacheDiskTag()); eastl::vector<DiskIndexEntry> 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<const size_t> ChunkIndexes) -> bool { + eastl::span{begin(InlineBlockLocations), end(InlineBlockLocations)}, + [&](uint32_t, eastl::span<const size_t> 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<IoHash> References, + eastl::span<IoHash> 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<const size_t> ChunkIndexes) { + m_BlockStore.IterateChunks(ChunkLocations, [&](uint32_t, eastl::span<const size_t> 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<IoHash> References) +ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, eastl::span<IoHash> 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<IoHash> References, + eastl::span<IoHash> 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<const IoHash> InlineKeys, - std::span<const std::size_t> ChunkIndexes, - eastl::vector<IoHash>& OutReferences) const +ZenCacheDiskLayer::CacheBucket::ReadAttachmentsFromMetaData(uint32_t BlockIndex, + eastl::span<const IoHash> InlineKeys, + eastl::span<const std::size_t> ChunkIndexes, + eastl::vector<IoHash>& 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<IoHash, IoHash>( MetaDataPayload, cache::impl::BlockMetaDataExpectedMagic, - [&](std::span<const IoHash> Keys, std::span<const uint32_t> AttachmentCounts, std::span<const IoHash> Attachments) { + [&](eastl::span<const IoHash> Keys, eastl::span<const uint32_t> AttachmentCounts, eastl::span<const IoHash> 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<const IoHash>(OutReferences) + eastl::span<const IoHash>(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<IoHash> GetUnusedReferences(GcCtx& Ctx, std::span<IoHash> IoCids) override + virtual eastl::span<IoHash> GetUnusedReferences(GcCtx& Ctx, eastl::span<IoHash> IoCids) override { ZEN_TRACE_CPU("Z$::Bucket::GetUnusedReferences"); @@ -3443,9 +3443,9 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span<IoHash> UnusedReferences = KeepUnusedReferences(m_PrecachedReferences, IoCids); - UnusedReferences = KeepUnusedReferences(m_AddedReferences, UnusedReferences); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span<IoHash> 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<IoHash> References, + eastl::span<IoHash> 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<IoHash> References, + eastl::span<IoHash> 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<IoHash> References, + eastl::span<IoHash> 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<IoHash> GetUnusedReferences(GcCtx& Ctx, std::span<IoHash> IoCids) override + virtual eastl::span<IoHash> GetUnusedReferences(GcCtx& Ctx, eastl::span<IoHash> IoCids) override { ZEN_TRACE_CPU("Z$::GetUnusedReferences"); @@ -1252,8 +1252,8 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); - UsedCount = IoCids.size() - UnusedReferences.size(); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(m_References, IoCids); + UsedCount = IoCids.size() - UnusedReferences.size(); return UnusedReferences; } @@ -1307,7 +1307,7 @@ namespace testutils { std::pair<Oid, IoBuffer> CreateBinaryBlob(size_t Size) { return {Oid::NewOid(), CreateRandomBlob(Size)}; } - eastl::vector<std::pair<Oid, CompressedBuffer>> CreateCompressedAttachment(CidStore& Store, const std::span<const size_t>& Sizes) + eastl::vector<std::pair<Oid, CompressedBuffer>> CreateCompressedAttachment(CidStore& Store, const eastl::span<const size_t>& Sizes) { eastl::vector<std::pair<Oid, CompressedBuffer>> Result; Result.reserve(Sizes.size()); @@ -1321,7 +1321,7 @@ namespace testutils { return Result; } - std::pair<IoHash, IoBuffer> CreateRecord(std::span<std::pair<Oid, CompressedBuffer>> Attachments) + std::pair<IoHash, IoBuffer> CreateRecord(eastl::span<std::pair<Oid, CompressedBuffer>> Attachments) { Oid Id = Oid::NewOid(); IoHash Key = ToIoHash(Id); @@ -2103,27 +2103,29 @@ TEST_CASE("cachestore.newgc.basics") std::unordered_map<IoHash, CacheEntry> CacheEntries; - auto CreateCacheRecord = - [&](ZenCacheNamespace& Zcs, CidStore& CidStore, std::string_view Bucket, std::span<std::pair<Oid, CompressedBuffer>> Attachments) { - eastl::vector<IoHash> 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<std::pair<Oid, CompressedBuffer>> Attachments) { + eastl::vector<IoHash> 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<Oid, IoBuffer> 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<InsertResult> InsertChunks(std::span<IoBuffer> Data, - std::span<IoHash> ChunkHashes, - InsertMode Mode = InsertMode::kMayBeMovedInPlace) override; + virtual eastl::vector<InsertResult> InsertChunks(eastl::span<IoBuffer> Data, + eastl::span<IoHash> 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<IoHash> DecompressedIds, + virtual bool IterateChunks(eastl::span<IoHash> DecompressedIds, const std::function<bool(size_t Index, const IoBuffer& Payload)>& 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<IoBuffer> Data, - std::span<IoHash> ChunkHashes, - std::span<size_t> Indexes, + eastl::span<IoBuffer> Data, + eastl::span<IoHash> ChunkHashes, + eastl::span<size_t> Indexes, eastl::vector<CasStore::InsertResult> Results) { const size_t Count = Indexes.size(); @@ -294,9 +294,9 @@ GetCompactCasResults(CasContainerStrategy& Strategy, static void GetFileCasResults(FileCasStrategy& Strategy, CasStore::InsertMode Mode, - std::span<IoBuffer> Data, - std::span<IoHash> ChunkHashes, - std::span<size_t> Indexes, + eastl::span<IoBuffer> Data, + eastl::span<IoHash> ChunkHashes, + eastl::span<size_t> Indexes, eastl::vector<CasStore::InsertResult> Results) { for (size_t Index : Indexes) @@ -306,7 +306,7 @@ GetFileCasResults(FileCasStrategy& Strategy, }; eastl::vector<CasStore::InsertResult> -CasImpl::InsertChunks(std::span<IoBuffer> Data, std::span<IoHash> ChunkHashes, CasStore::InsertMode Mode) +CasImpl::InsertChunks(eastl::span<IoBuffer> Data, eastl::span<IoHash> 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<IoHash> DecompressedIds, +CasImpl::IterateChunks(eastl::span<IoHash> DecompressedIds, const std::function<bool(size_t Index, const IoBuffer& Payload)>& 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<InsertResult> InsertChunks(std::span<IoBuffer> Data, - std::span<IoHash> ChunkHashes, - InsertMode Mode = InsertMode::kMayBeMovedInPlace) = 0; + virtual eastl::vector<InsertResult> InsertChunks(eastl::span<IoBuffer> Data, + eastl::span<IoHash> 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<IoHash> DecompressedIds, + virtual bool IterateChunks(eastl::span<IoHash> DecompressedIds, const std::function<bool(size_t Index, const IoBuffer& Payload)>& 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<CidStore::InsertResult> AddChunks(std::span<IoBuffer> ChunkDatas, std::span<IoHash> RawHashes, CidStore::InsertMode Mode) + eastl::vector<CidStore::InsertResult> AddChunks(eastl::span<IoBuffer> ChunkDatas, + eastl::span<IoHash> 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<IoHash> DecompressedIds, + bool IterateChunks(eastl::span<IoHash> DecompressedIds, const std::function<bool(size_t Index, const IoBuffer& Payload)>& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit) @@ -198,7 +200,7 @@ CidStore::AddChunk(const IoBuffer& ChunkData, const IoHash& RawHash, InsertMode } eastl::vector<CidStore::InsertResult> -CidStore::AddChunks(std::span<IoBuffer> ChunkDatas, std::span<IoHash> RawHashes, InsertMode Mode) +CidStore::AddChunks(eastl::span<IoBuffer> ChunkDatas, eastl::span<IoHash> RawHashes, InsertMode Mode) { return m_Impl->AddChunks(ChunkDatas, RawHashes, Mode); } @@ -216,7 +218,7 @@ CidStore::ContainsChunk(const IoHash& DecompressedId) } bool -CidStore::IterateChunks(std::span<IoHash> DecompressedIds, +CidStore::IterateChunks(eastl::span<IoHash> DecompressedIds, const std::function<bool(size_t Index, const IoBuffer& Payload)>& 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<CasStore::InsertResult> -CasContainerStrategy::InsertChunks(std::span<IoBuffer> Chunks, std::span<IoHash> ChunkHashes) +CasContainerStrategy::InsertChunks(eastl::span<IoBuffer> Chunks, eastl::span<IoHash> ChunkHashes) { ZEN_MEMSCOPE(GetCasContainerTag()); @@ -263,7 +263,7 @@ CasContainerStrategy::InsertChunks(std::span<IoBuffer> Chunks, std::span<IoHash> } size_t ChunkOffset = 0; - m_BlockStore.WriteChunks(Datas, m_PayloadAlignment, [&](std::span<BlockStoreLocation> Locations) { + m_BlockStore.WriteChunks(Datas, m_PayloadAlignment, [&](eastl::span<BlockStoreLocation> Locations) { ZEN_MEMSCOPE(GetCasContainerTag()); eastl::vector<CasDiskIndexEntry> IndexEntries; for (const BlockStoreLocation& Location : Locations) @@ -323,7 +323,7 @@ CasContainerStrategy::FilterChunks(HashKeySet& InOutChunks) } bool -CasContainerStrategy::IterateChunks(std::span<IoHash> ChunkHashes, +CasContainerStrategy::IterateChunks(eastl::span<IoHash> ChunkHashes, const std::function<bool(size_t Index, const IoBuffer& Payload)>& AsyncCallback, WorkerThreadPool* OptionalWorkerPool, uint64_t LargeSizeLimit) @@ -360,7 +360,7 @@ CasContainerStrategy::IterateChunks(std::span<IoHash> ChunkHashes, return true; } - auto DoOneBlock = [&](std::span<const size_t> ChunkIndexes) { + auto DoOneBlock = [&](eastl::span<const size_t> ChunkIndexes) { if (ChunkIndexes.size() < 4) { for (size_t ChunkIndex : ChunkIndexes) @@ -391,7 +391,7 @@ CasContainerStrategy::IterateChunks(std::span<IoHash> ChunkHashes, Latch WorkLatch(1); std::atomic_bool AsyncContinue = true; - bool Continue = m_BlockStore.IterateChunks(FoundChunkLocations, [&](uint32_t BlockIndex, std::span<const size_t> ChunkIndexes) { + bool Continue = m_BlockStore.IterateChunks(FoundChunkLocations, [&](uint32_t BlockIndex, eastl::span<const size_t> 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<const size_t> ChunkIndexes) { + m_BlockStore.IterateChunks(ChunkLocations, [&](uint32_t, eastl::span<const size_t> ChunkIndexes) { return m_BlockStore.IterateBlock(ChunkLocations, ChunkIndexes, ValidateSmallChunk, ValidateLargeChunk, 0); }); } @@ -767,9 +767,9 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span<IoHash> UnusedCids = GetUnusedReferences(m_Cids); - Stats.CheckedCount = m_Cids.size(); - Stats.FoundCount = UnusedCids.size(); + eastl::span<IoHash> 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<IoHash> References) -> std::span<IoHash> { + Pruner->RemoveUnreferencedData(Ctx, Stats, [&](eastl::span<IoHash> References) -> eastl::span<IoHash> { eastl::vector<IoHash> 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<CasStore::InsertResult> InsertChunks(std::span<IoBuffer> Chunks, std::span<IoHash> ChunkHashes); + eastl::vector<CasStore::InsertResult> InsertChunks(eastl::span<IoBuffer> Chunks, eastl::span<IoHash> ChunkHashes); IoBuffer FindChunk(const IoHash& ChunkHash); bool HaveChunk(const IoHash& ChunkHash); void FilterChunks(HashKeySet& InOutChunks); - bool IterateChunks(std::span<IoHash> ChunkHashes, + bool IterateChunks(eastl::span<IoHash> ChunkHashes, const std::function<bool(size_t Index, const IoBuffer& Payload)>& 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<IoHash> ChunkHashes, +FileCasStrategy::IterateChunks(eastl::span<IoHash> ChunkHashes, const std::function<bool(size_t Index, const IoBuffer& Payload)>& AsyncCallback, WorkerThreadPool* OptionalWorkerPool) { @@ -1388,9 +1388,9 @@ public: NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - std::span<IoHash> UnusedCids = GetUnusedReferences(m_Cids); - Stats.CheckedCount = m_Cids.size(); - Stats.FoundCount = UnusedCids.size(); + eastl::span<IoHash> 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<IoHash> ChunkHashes, + bool IterateChunks(eastl::span<IoHash> ChunkHashes, const std::function<bool(size_t Index, const IoBuffer& Payload)>& 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<IoHash>& In return true; } -std::span<IoHash> -KeepUnusedReferences(std::span<const IoHash> SortedUsedReferences, std::span<IoHash> SortedReferences) +eastl::span<IoHash> +KeepUnusedReferences(eastl::span<const IoHash> SortedUsedReferences, eastl::span<IoHash> 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<IoHash> References) -> std::span<IoHash> { - std::span<IoHash> UnusedCids(References); + const auto GetUnusedReferences = [&ReferenceCheckers, &Ctx](eastl::span<IoHash> References) -> eastl::span<IoHash> { + eastl::span<IoHash> 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<IoHash> UsedReferences; eastl::vector<IoHash> References; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.empty()); } { eastl::vector<IoHash> UsedReferences{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; eastl::vector<IoHash> References; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.empty()); } { eastl::vector<IoHash> UsedReferences{}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 5); } { eastl::vector<IoHash> UsedReferences{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.empty()); } { eastl::vector<IoHash> UsedReferences{Hashes[0], Hashes[2], Hashes[4]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> 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<IoHash> UsedReferences{Hashes[2], Hashes[3], Hashes[4]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> 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<IoHash> UsedReferences{Hashes[0], Hashes[1], Hashes[2]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> 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<IoHash> UsedReferences{Hashes[0], Hashes[1], Hashes[2], Hashes[4]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); CHECK(UnusedReferences.size() == 1); CHECK(UnusedReferences[0] == Hashes[3]); } @@ -2915,7 +2915,7 @@ TEST_CASE("gc.keepunusedreferences") { eastl::vector<IoHash> UsedReferences{Hashes[1], Hashes[3]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> 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<IoHash> UsedReferences{Hashes[0]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> 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<IoHash> UsedReferences{Hashes[1]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> 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<IoHash> UsedReferences{Hashes[3]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> 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<IoHash> UsedReferences{Hashes[4]}; eastl::vector<IoHash> References{Hashes[0], Hashes[1], Hashes[2], Hashes[3], Hashes[4]}; - std::span<IoHash> UnusedReferences = KeepUnusedReferences(UsedReferences, References); + eastl::span<IoHash> 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<const IoHash> HashesToAdd) +HashKeySet::AddHashesToSet(eastl::span<const IoHash> 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<bool(size_t ChunkIndex, const void* Data, uint64_t Size)> IterateChunksSmallSizeCallback; typedef std::function<bool(size_t ChunkIndex, BlockStoreFile& File, uint64_t Offset, uint64_t Size)> IterateChunksLargeSizeCallback; typedef std::function<void(const BlockStoreLocation& Location)> WriteChunkCallback; - typedef std::function<bool(uint32_t BlockIndex, std::span<const size_t> ChunkIndexes)> IterateChunksCallback; + typedef std::function<bool(uint32_t BlockIndex, eastl::span<const size_t> 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<void(std::span<BlockStoreLocation> Locations)> WriteChunksCallback; - void WriteChunks(std::span<IoBuffer> Datas, uint32_t Alignment, const WriteChunksCallback& Callback); + typedef std::function<void(eastl::span<BlockStoreLocation> Locations)> WriteChunksCallback; + void WriteChunks(eastl::span<IoBuffer> Datas, uint32_t Alignment, const WriteChunksCallback& Callback); IoBuffer TryGetChunk(const BlockStoreLocation& Location) const; void Flush(bool ForceNewBlock); - bool IterateChunks(const std::span<const BlockStoreLocation>& ChunkLocations, const IterateChunksCallback& Callback); + bool IterateChunks(const eastl::span<const BlockStoreLocation>& ChunkLocations, const IterateChunksCallback& Callback); - bool IterateBlock(std::span<const BlockStoreLocation> ChunkLocations, - std::span<const size_t> ChunkIndexes, + bool IterateBlock(eastl::span<const BlockStoreLocation> ChunkLocations, + eastl::span<const size_t> 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<IoHash> References, + eastl::span<IoHash> References, PutBatchHandle* OptionalBatchHandle); bool Drop(); bool DropBucket(std::string_view Bucket); @@ -234,11 +234,11 @@ public: struct PutBatchHandle; PutBatchHandle* BeginPutBatch(eastl::vector<bool>& OutResult); void EndPutBatch(PutBatchHandle* Batch) noexcept; - void Put(const IoHash& HashKey, const ZenCacheValue& Value, std::span<IoHash> 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<IoHash> 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<IoHash>& OutReferences, ReferencesStats* OptionalOutReferencesStats); - bool ReadAttachmentsFromMetaData(uint32_t BlockIndex, - std::span<const IoHash> InlineKeys, - std::span<const std::size_t> ChunkIndexes, - eastl::vector<IoHash>& OutReferences) const; + bool ReadAttachmentsFromMetaData(uint32_t BlockIndex, + eastl::span<const IoHash> InlineKeys, + eastl::span<const std::size_t> ChunkIndexes, + eastl::vector<IoHash>& OutReferences) const; inline GcStorageSize StorageSize() const { @@ -381,11 +381,11 @@ public: virtual eastl::vector<GcReferenceValidator*> CreateReferenceValidators(GcCtx& Ctx) override; void BuildPath(PathBuilderBase& Path, const IoHash& HashKey) const; - void PutStandaloneCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, std::span<IoHash> References); + void PutStandaloneCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, eastl::span<IoHash> References); IoBuffer GetStandaloneCacheValue(const DiskLocation& Loc, const IoHash& HashKey) const; void PutInlineCacheValue(const IoHash& HashKey, const ZenCacheValue& Value, - std::span<IoHash> References, + eastl::span<IoHash> 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<IoHash> References, + eastl::span<IoHash> 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<IoHash> References, + eastl::span<IoHash> 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<CacheValueRequest*> CacheValueRequests, - OnCacheValueGetComplete&& OnComplete) = 0; + virtual void GetCacheValues(std::string_view Namespace, + eastl::span<CacheValueRequest*> CacheValueRequests, + OnCacheValueGetComplete&& OnComplete) = 0; - virtual void GetCacheRecords(std::string_view Namespace, - std::span<CacheKeyRequest*> Requests, - OnCacheRecordGetComplete&& OnComplete) = 0; + virtual void GetCacheRecords(std::string_view Namespace, + eastl::span<CacheKeyRequest*> Requests, + OnCacheRecordGetComplete&& OnComplete) = 0; - virtual void GetCacheChunks(std::string_view Namespace, - std::span<CacheChunkRequest*> CacheChunkRequests, - OnCacheChunksGetComplete&& OnComplete) = 0; + virtual void GetCacheChunks(std::string_view Namespace, + eastl::span<CacheChunkRequest*> 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<T>& Records) { CasLogFile::Append(Records.data(), sizeof(T) * Records.size()); } + void Append(const eastl::span<T>& 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<InsertResult> AddChunks(std::span<IoBuffer> ChunkDatas, - std::span<IoHash> RawHashes, - InsertMode Mode = InsertMode::kMayBeMovedInPlace); + eastl::vector<InsertResult> AddChunks(eastl::span<IoBuffer> ChunkDatas, + eastl::span<IoHash> RawHashes, + InsertMode Mode = InsertMode::kMayBeMovedInPlace); virtual IoBuffer FindChunkByCid(const IoHash& DecompressedId) override; - bool IterateChunks(std::span<IoHash> DecompressedIds, + bool IterateChunks(eastl::span<IoHash> DecompressedIds, const std::function<bool(size_t Index, const IoBuffer& Payload)>& 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 <fmt/format.h> ZEN_THIRD_PARTY_INCLUDES_END +#include <EASTL/span.h> #include <atomic> #include <chrono> #include <condition_variable> #include <filesystem> #include <functional> #include <optional> -#include <span> #include <thread> 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<IoHash> GetUnusedReferences(GcCtx& Ctx, std::span<IoHash> IoCids) = 0; + virtual eastl::span<IoHash> GetUnusedReferences(GcCtx& Ctx, eastl::span<IoHash> IoCids) = 0; }; -std::span<IoHash> KeepUnusedReferences(std::span<const IoHash> SortedUsedReferences, std::span<IoHash> SortedReferences); -bool FilterReferences(GcCtx& Ctx, std::string_view Context, eastl::vector<IoHash>& InOutReferences); +eastl::span<IoHash> KeepUnusedReferences(eastl::span<const IoHash> SortedUsedReferences, eastl::span<IoHash> SortedReferences); +bool FilterReferences(GcCtx& Ctx, std::string_view Context, eastl::vector<IoHash>& 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<IoHash>(std::span<IoHash> References)> GetUnusedReferencesFunc; + typedef std::function<eastl::span<IoHash>(eastl::span<IoHash> 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<const IoHash> HashesToAdd); + void AddHashesToSet(eastl::span<const IoHash> HashesToAdd); void RemoveHashesIf(std::function<bool(const IoHash& CandidateHash)>&& Predicate); void IterateHashes(std::function<void(const IoHash& Hash)>&& 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<const IoHash> Candidates, Invocable<const IoHash&> auto MatchFunc) const + inline void FilterHashes(eastl::span<const IoHash> Candidates, Invocable<const IoHash&> auto MatchFunc) const { for (const IoHash& Candidate : Candidates) { @@ -36,7 +36,7 @@ public: } } - inline void FilterHashes(std::span<const IoHash> Candidates, Invocable<const IoHash&, bool> auto MatchFunc) const + inline void FilterHashes(eastl::span<const IoHash> Candidates, Invocable<const IoHash&, bool> 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<IoHash> BadCasChunks); + void ReportBadCidChunks(eastl::span<IoHash> 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<IoBuffer> GetWorkspaceShareChunks(const Oid& WorkspaceId, - const Oid& ShareId, - const std::span<const ChunkRequest> ChunkRequests, - WorkerThreadPool& WorkerPool); + eastl::vector<IoBuffer> GetWorkspaceShareChunks(const Oid& WorkspaceId, + const Oid& ShareId, + const eastl::span<const ChunkRequest> ChunkRequests, + WorkerThreadPool& WorkerPool); eastl::vector<Oid> GetWorkspaces() const; std::optional<WorkspaceConfiguration> 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<IoHash> BadCasChunks) +ScrubContext::ReportBadCidChunks(eastl::span<IoHash> 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<const Workspaces::WorkspaceConfiguration> Workspaces) + std::string WorkspacesToJson(eastl::span<const Workspaces::WorkspaceConfiguration> Workspaces) { using namespace std::literals; @@ -84,7 +84,7 @@ namespace { return {}; } - std::string WorkspaceSharesToJson(std::span<const Workspaces::WorkspaceShareConfiguration> WorkspaceShares) + std::string WorkspaceSharesToJson(eastl::span<const Workspaces::WorkspaceShareConfiguration> WorkspaceShares) { using namespace std::literals; @@ -569,10 +569,10 @@ Workspaces::GetWorkspaceShareChunkInfo(const Oid& WorkspaceId, const Oid& ShareI } eastl::vector<IoBuffer> -Workspaces::GetWorkspaceShareChunks(const Oid& WorkspaceId, - const Oid& ShareId, - const std::span<const ChunkRequest> ChunkRequests, - WorkerThreadPool& WorkerPool) +Workspaces::GetWorkspaceShareChunks(const Oid& WorkspaceId, + const Oid& ShareId, + const eastl::span<const ChunkRequest> 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<const CacheValuePolicy> GetValuePolicies() const final { return Values; } + inline eastl::span<const CacheValuePolicy> GetValuePolicies() const final { return Values; } private: eastl::vector<CacheValuePolicy> Values; @@ -174,8 +174,8 @@ CacheRecordPolicy::GetValuePolicy(const Oid& Id) const { if (Shared) { - const std::span<const CacheValuePolicy> Values = Shared->GetValuePolicies(); - const auto Iter = + const eastl::span<const CacheValuePolicy> 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<const CacheValuePolicy> Values = Shared->GetValuePolicies(); - Policy.RecordPolicy = BasePolicy; + const eastl::span<const CacheValuePolicy> 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<const size_t> OptionalRecordFilter) const + bool GetCacheRecordsRequest::Format(CbObjectWriter& Writer, const eastl::span<const size_t> OptionalRecordFilter) const { Writer << "Method" << "GetCacheRecords"; @@ -422,7 +422,7 @@ namespace cacherequests { return true; } - bool GetCacheRecordsRequest::Format(CbPackage& OutPackage, const std::span<const size_t> OptionalRecordFilter) const + bool GetCacheRecordsRequest::Format(CbPackage& OutPackage, const eastl::span<const size_t> 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<const size_t> OptionalRecordResultIndexes) + bool GetCacheRecordsResult::Parse(const CbPackage& Package, const eastl::span<const size_t> 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<const size_t> OptionalValueFilter) const + bool GetCacheValuesRequest::Format(CbPackage& OutPackage, const eastl::span<const size_t> OptionalValueFilter) const { CbObjectWriter Writer; Writer << "Method" @@ -757,7 +757,7 @@ namespace cacherequests { return true; } - bool CacheValuesResult::Parse(const CbPackage& Package, const std::span<const size_t> OptionalValueResultIndexes) + bool CacheValuesResult::Parse(const CbPackage& Package, const eastl::span<const size_t> 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<const zen::CacheValuePolicy>& Lhs, const std::span<const zen::CacheValuePolicy>& Rhs) + static bool operator==(const eastl::span<const zen::CacheValuePolicy>& Lhs, const eastl::span<const zen::CacheValuePolicy>& 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<std::pair<IoHash, FetchChunkFunc>>&& FetchChunk { std::pair<uint64_t, CompressedBuffer> Chunk = It.second(It.first); uint64_t ChunkSize = 0; - std::span<const SharedBuffer> Segments = Chunk.second.GetCompressed().GetSegments(); + eastl::span<const SharedBuffer> 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<IoHash, uint32_t, IoHash::Hasher>& ChunkHashToChunkIndex, const IoHash& RawHash, - std::span<const uint32_t> ChunkSequence, - std::span<const IoHash> ChunkHashes, - std::span<const uint64_t> ChunkRawSizes) + eastl::span<const uint32_t> ChunkSequence, + eastl::span<const IoHash> ChunkHashes, + eastl::span<const uint64_t> ChunkRawSizes) { ZEN_ASSERT(ChunkHashes.size() == ChunkRawSizes.size()); InOutChunkedContent.ChunkCounts.push_back(gsl::narrow<uint32_t>(ChunkSequence.size())); @@ -529,7 +529,7 @@ LoadChunkedFolderContentToCompactBinary(CbObjectView Input) } ChunkedFolderContent -MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span<const ChunkedFolderContent> Overlays) +MergeChunkedFolderContents(const ChunkedFolderContent& Base, eastl::span<const ChunkedFolderContent> Overlays) { ZEN_TRACE_CPU("MergeChunkedFolderContents"); @@ -564,7 +564,7 @@ MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span<const Chu tsl::robin_map<IoHash, uint32_t, IoHash::Hasher> RawHashToSequenceRawHashIndex; - auto BuildOverlayPaths = [](std::span<const ChunkedFolderContent> Overlays) -> tsl::robin_set<std::string> { + auto BuildOverlayPaths = [](eastl::span<const ChunkedFolderContent> Overlays) -> tsl::robin_set<std::string> { tsl::robin_set<std::string> Result; for (const ChunkedFolderContent& OverlayContent : Overlays) { @@ -581,7 +581,7 @@ MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span<const Chu tsl::robin_map<IoHash, uint32_t, IoHash::Hasher>& ChunkHashToChunkIndex, tsl::robin_map<IoHash, uint32_t, IoHash::Hasher>& RawHashToSequenceRawHashIndex, const tsl::robin_map<std::string, std::filesystem::path>& GenericPathToActualPath, - std::span<const ChunkedFolderContent> Overlays) { + eastl::span<const ChunkedFolderContent> Overlays) { const ChunkedContentLookup OverlayLookup = BuildChunkedContentLookup(OverlayContent); tsl::robin_set<std::string> BaseOverlayPaths = BuildOverlayPaths(Overlays); for (uint32_t PathIndex = 0; PathIndex < OverlayContent.Paths.size(); PathIndex++) @@ -604,12 +604,12 @@ MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span<const Chu { RawHashToSequenceRawHashIndex.insert( {RawHash, gsl::narrow<uint32_t>(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<const uint32_t> OriginalChunkOrder = - std::span<const uint32_t>(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<const uint32_t> OriginalChunkOrder = + eastl::span<const uint32_t>(OverlayContent.ChunkedContent.ChunkOrders).subspan(OrderIndexOffset, ChunkCount); AddChunkSequence(Stats, Result.ChunkedContent, ChunkHashToChunkIndex, @@ -639,7 +639,7 @@ MergeChunkedFolderContents(const ChunkedFolderContent& Base, std::span<const Chu } ChunkedFolderContent -DeletePathsFromChunkedContent(const ChunkedFolderContent& BaseContent, std::span<const std::filesystem::path> DeletedPaths) +DeletePathsFromChunkedContent(const ChunkedFolderContent& BaseContent, eastl::span<const std::filesystem::path> DeletedPaths) { ZEN_TRACE_CPU("DeletePathsFromChunkedContent"); @@ -674,12 +674,12 @@ DeletePathsFromChunkedContent(const ChunkedFolderContent& BaseContent, std::span { RawHashToSequenceRawHashIndex.insert( {RawHash, gsl::narrow<uint32_t>(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<const uint32_t> OriginalChunkOrder = - std::span<const uint32_t>(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<const uint32_t> OriginalChunkOrder = + eastl::span<const uint32_t>(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<const std::string_view> ExcludeExtensions, - uint64_t ChunkFileSizeLimit, - const ChunkedParams& ChunkingParams) + BasicChunkingController(eastl::span<const std::string_view> 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<const std::string_view> FixedChunkingExtensions, - uint64_t ChunkFileSizeLimit, - const ChunkedParams& ChunkingParams, - uint32_t FixedChunkingChunkSize) + ChunkingControllerWithFixedChunking(eastl::span<const std::string_view> 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<ChunkingController> -CreateBasicChunkingController(std::span<const std::string_view> ExcludeExtensions, - uint64_t ChunkFileSizeLimit, - const ChunkedParams& ChunkingParams) +CreateBasicChunkingController(eastl::span<const std::string_view> ExcludeExtensions, + uint64_t ChunkFileSizeLimit, + const ChunkedParams& ChunkingParams) { return std::make_unique<BasicChunkingController>(ExcludeExtensions, ChunkFileSizeLimit, ChunkingParams); } @@ -238,10 +238,10 @@ CreateBasicChunkingController(CbObjectView Parameters) } std::unique_ptr<ChunkingController> -CreateChunkingControllerWithFixedChunking(std::span<const std::string_view> FixedChunkingExtensions, - uint64_t ChunkFileSizeLimit, - const ChunkedParams& ChunkingParams, - uint32_t FixedChunkingChunkSize) +CreateChunkingControllerWithFixedChunking(eastl::span<const std::string_view> FixedChunkingExtensions, + uint64_t ChunkFileSizeLimit, + const ChunkedParams& ChunkingParams, + uint32_t FixedChunkingChunkSize) { return std::make_unique<ChunkingControllerWithFixedChunking>(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<IoBuffer> -BuildChunkBatchResponse(const eastl::vector<RequestChunkEntry>& Requests, std::span<IoBuffer> Chunks) +BuildChunkBatchResponse(const eastl::vector<RequestChunkEntry>& Requests, eastl::span<IoBuffer> 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<ChunkBlockDescription> GetBlockMetadata(const Oid& BuildId, std::span<const IoHash> BlockHashes) override + virtual eastl::vector<ChunkBlockDescription> GetBlockMetadata(const Oid& BuildId, eastl::span<const IoHash> 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<void(uint64_t Offset, const IoBuffer& Chunk, uint64_t BytesRemaining)>&& Receiver) = 0; - virtual void PutBlockMetadata(const Oid& BuildId, const IoHash& BlockRawHash, const CbObject& MetaData) = 0; - virtual eastl::vector<ChunkBlockDescription> FindBlocks(const Oid& BuildId) = 0; - virtual eastl::vector<ChunkBlockDescription> GetBlockMetadata(const Oid& BuildId, std::span<const IoHash> BlockHashes) = 0; + virtual void PutBlockMetadata(const Oid& BuildId, const IoHash& BlockRawHash, const CbObject& MetaData) = 0; + virtual eastl::vector<ChunkBlockDescription> FindBlocks(const Oid& BuildId) = 0; + virtual eastl::vector<ChunkBlockDescription> GetBlockMetadata(const Oid& BuildId, eastl::span<const IoHash> 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 <zencore/string.h> #include <zencore/uid.h> +#include <EASTL/span.h> #include <gsl/gsl-lite.hpp> -#include <span> 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<const CacheValuePolicy> GetValuePolicies() const = 0; + virtual ~ICacheRecordPolicyShared() = default; + virtual void AddValuePolicy(const CacheValuePolicy& Policy) = 0; + virtual eastl::span<const CacheValuePolicy> 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<const CacheValuePolicy> GetValuePolicies() const + inline eastl::span<const CacheValuePolicy> GetValuePolicies() const { - return Shared ? Shared->GetValuePolicies() : std::span<const CacheValuePolicy>(); + return Shared ? Shared->GetValuePolicies() : eastl::span<const CacheValuePolicy>(); } /** 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<const size_t> OptionalRecordFilter = {}) const; - bool Format(CbObjectWriter& Writer, const std::span<const size_t> OptionalRecordFilter = {}) const; + bool Format(CbPackage& OutPackage, const eastl::span<const size_t> OptionalRecordFilter = {}) const; + bool Format(CbObjectWriter& Writer, const eastl::span<const size_t> OptionalRecordFilter = {}) const; }; struct GetCacheRecordResultValue @@ -137,7 +137,7 @@ namespace cacherequests { { eastl::vector<std::optional<GetCacheRecordResult>> Results; - bool Parse(const CbPackage& Package, const std::span<const size_t> OptionalRecordResultIndexes = {}); + bool Parse(const CbPackage& Package, const eastl::span<const size_t> OptionalRecordResultIndexes = {}); bool Format(CbPackage& OutPackage) const; }; @@ -190,7 +190,7 @@ namespace cacherequests { eastl::vector<GetCacheValueRequest> Requests; bool Parse(const CbObjectView& BatchObject); - bool Format(CbPackage& OutPackage, const std::span<const size_t> OptionalValueFilter = {}) const; + bool Format(CbPackage& OutPackage, const eastl::span<const size_t> OptionalValueFilter = {}) const; }; struct CacheValueResult @@ -206,7 +206,7 @@ namespace cacherequests { { eastl::vector<CacheValueResult> Results; - bool Parse(const CbPackage& Package, const std::span<const size_t> OptionalValueResultIndexes = {}); + bool Parse(const CbPackage& Package, const eastl::span<const size_t> 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<const ChunkedFolderContent> Overlays); -ChunkedFolderContent DeletePathsFromChunkedContent(const ChunkedFolderContent& Base, std::span<const std::filesystem::path> DeletedPaths); +ChunkedFolderContent MergeChunkedFolderContents(const ChunkedFolderContent& Base, eastl::span<const ChunkedFolderContent> Overlays); +ChunkedFolderContent DeletePathsFromChunkedContent(const ChunkedFolderContent& Base, eastl::span<const std::filesystem::path> 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<const ChunkedContentLookup::ChunkSequenceLocation> +inline eastl::span<const ChunkedContentLookup::ChunkSequenceLocation> GetChunkSequenceLocations(const ChunkedContentLookup& Lookup, uint32_t ChunkIndex) { std::pair<size_t, uint32_t> Range = GetChunkSequenceLocationRange(Lookup, ChunkIndex); - return std::span<const ChunkedContentLookup::ChunkSequenceLocation>(Lookup.ChunkSequenceLocations).subspan(Range.first, Range.second); + return eastl::span<const ChunkedContentLookup::ChunkSequenceLocation>(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<typename Type> - void WriteArray(std::span<const Type> Values, std::string_view ArrayName, CbWriter& Output) + void WriteArray(eastl::span<const Type> Values, std::string_view ArrayName, CbWriter& Output) { Output.BeginArray(ArrayName); for (const Type Value : Values) @@ -193,11 +193,11 @@ namespace compactbinary_helpers { template<typename Type> void WriteArray(const eastl::vector<Type>& Values, std::string_view ArrayName, CbWriter& Output) { - WriteArray(std::span<const Type>(Values), ArrayName, Output); + WriteArray(eastl::span<const Type>(Values), ArrayName, Output); } template<> - inline void WriteArray(std::span<const std::filesystem::path> Values, std::string_view ArrayName, CbWriter& Output) + inline void WriteArray(eastl::span<const std::filesystem::path> 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<std::filesystem::path>& Values, std::string_view ArrayName, CbWriter& Output) { - WriteArray(std::span<const std::filesystem::path>(Values), ArrayName, Output); + WriteArray(eastl::span<const std::filesystem::path>(Values), ArrayName, Output); } - inline void WriteBinaryAttachmentArray(std::span<const IoHash> Values, std::string_view ArrayName, CbWriter& Output) + inline void WriteBinaryAttachmentArray(eastl::span<const IoHash> 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<IoHash>& Values, std::string_view ArrayName, CbWriter& Output) { - WriteArray(std::span<const IoHash>(Values), ArrayName, Output); + WriteArray(eastl::span<const IoHash>(Values), ArrayName, Output); } inline void ReadArray(std::string_view ArrayName, CbObjectView Input, eastl::vector<uint32_t>& 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<ChunkingController> CreateBasicChunkingController( - std::span<const std::string_view> ExcludeExtensions = DefaultChunkingExcludeExtensions, - uint64_t ChunkFileSizeLimit = DefaultChunkingFileSizeLimit, - const ChunkedParams& ChunkingParams = DefaultChunkedParams); + eastl::span<const std::string_view> ExcludeExtensions = DefaultChunkingExcludeExtensions, + uint64_t ChunkFileSizeLimit = DefaultChunkingFileSizeLimit, + const ChunkedParams& ChunkingParams = DefaultChunkedParams); std::unique_ptr<ChunkingController> CreateBasicChunkingController(CbObjectView Parameters); std::unique_ptr<ChunkingController> CreateChunkingControllerWithFixedChunking( - std::span<const std::string_view> ExcludeExtensions = DefaultChunkingExcludeExtensions, - uint64_t ChunkFileSizeLimit = DefaultChunkingFileSizeLimit, - const ChunkedParams& ChunkingParams = DefaultChunkedParams, - uint32_t FixedChunkingChunkSize = DefaultFixedChunkingChunkSize); + eastl::span<const std::string_view> ExcludeExtensions = DefaultChunkingExcludeExtensions, + uint64_t ChunkFileSizeLimit = DefaultChunkingFileSizeLimit, + const ChunkedParams& ChunkingParams = DefaultChunkedParams, + uint32_t FixedChunkingChunkSize = DefaultFixedChunkingChunkSize); std::unique_ptr<ChunkingController> CreateChunkingControllerWithFixedChunking(CbObjectView Parameters); std::unique_ptr<ChunkingController> 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 <zencore/uid.h> +#include <EASTL/span.h> #include <EASTL/vector.h> #include <optional> -#include <span> namespace zen { class IoBuffer; @@ -22,6 +22,6 @@ struct RequestChunkEntry eastl::vector<IoBuffer> ParseChunkBatchResponse(const IoBuffer& Buffer); IoBuffer BuildChunkBatchRequest(const eastl::vector<RequestChunkEntry>& Entries); std::optional<eastl::vector<RequestChunkEntry>> ParseChunkBatchRequest(const IoBuffer& Payload); -eastl::vector<IoBuffer> BuildChunkBatchResponse(const eastl::vector<RequestChunkEntry>& Requests, std::span<IoBuffer> Chunks); +eastl::vector<IoBuffer> BuildChunkBatchResponse(const eastl::vector<RequestChunkEntry>& Requests, eastl::span<IoBuffer> 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<typename KeyType, typename AttachmentType> CompositeBuffer -BuildReferenceMetaData(uint32_t HeaderMagic, - std::span<const KeyType> Keys, - std::span<const uint32_t> AttachmentCounts, - std::span<const AttachmentType> Attachments) +BuildReferenceMetaData(uint32_t HeaderMagic, + eastl::span<const KeyType> Keys, + eastl::span<const uint32_t> AttachmentCounts, + eastl::span<const AttachmentType> Attachments) { uint32_t KeyCount = gsl::narrow<uint32_t>(Keys.size()); @@ -73,11 +73,11 @@ BuildReferenceMetaData(uint32_t HeaderMagic, template<typename KeyType, typename AttachmentType> bool -GetAttachmentsFromMetaData(const IoBuffer& MetaData, - const uint32_t ExpectedHeaderMagic, - std::function<void(std::span<const KeyType> Keys, - std::span<const uint32_t> AttachmentCounts, - std::span<const AttachmentType> Attachments)>&& Parser) +GetAttachmentsFromMetaData(const IoBuffer& MetaData, + const uint32_t ExpectedHeaderMagic, + std::function<void(eastl::span<const KeyType> Keys, + eastl::span<const uint32_t> AttachmentCounts, + eastl::span<const AttachmentType> Attachments)>&& Parser) { MemoryView PayloadView = MetaData.GetView(); if (PayloadView.GetSize() >= sizeof(ReferenceMetaDataHeader)) @@ -89,12 +89,12 @@ GetAttachmentsFromMetaData(const IoBuffer& MetaData, ReferenceMetaDataHeader::ExpectedSize<KeyType, AttachmentType>(Header->EntryCount, Header->AttachmentCount)) { PayloadView.MidInline(sizeof(ReferenceMetaDataHeader)); - std::span<const KeyType> PayloadKeys = {(const KeyType*)PayloadView.GetData(), Header->EntryCount}; + eastl::span<const KeyType> PayloadKeys = {(const KeyType*)PayloadView.GetData(), Header->EntryCount}; PayloadView.MidInline(sizeof(KeyType) * Header->EntryCount); - std::span<const uint32_t> PayloadAttachmentCounts = {(const uint32_t*)PayloadView.GetData(), Header->EntryCount}; + eastl::span<const uint32_t> PayloadAttachmentCounts = {(const uint32_t*)PayloadView.GetData(), Header->EntryCount}; PayloadView.MidInline(sizeof(uint32_t) * Header->EntryCount); - std::span<const AttachmentType> PayloadAttachments = {(const AttachmentType*)PayloadView.GetData(), - Header->AttachmentCount}; + eastl::span<const AttachmentType> 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<ChunkBlockDescription> GetBlockMetadata(const Oid& BuildId, std::span<const IoHash> BlockHashes) override + virtual eastl::vector<ChunkBlockDescription> GetBlockMetadata(const Oid& BuildId, eastl::span<const IoHash> BlockHashes) override { ZEN_TRACE_CPU("Jupiter::GetBlockMetadata"); |