aboutsummaryrefslogtreecommitdiff
path: root/zenstore
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2022-01-11 10:31:34 +0100
committerPer Larsson <[email protected]>2022-01-11 10:31:34 +0100
commitfa40b11e35f9791bd6ca472ef7bfc246eecbd696 (patch)
tree058c1dcef54eb3c15eedc12b29f24d72db239d52 /zenstore
parentAdded option to disable Sentry crash handler. (diff)
parentNot all toolchains support C++20's atomic<double>::fetch_add() (diff)
downloadzen-fa40b11e35f9791bd6ca472ef7bfc246eecbd696.tar.xz
zen-fa40b11e35f9791bd6ca472ef7bfc246eecbd696.zip
Merged main.
Diffstat (limited to 'zenstore')
-rw-r--r--zenstore/basicfile.cpp8
-rw-r--r--zenstore/cas.cpp2
-rw-r--r--zenstore/caslog.cpp8
-rw-r--r--zenstore/compactcas.cpp2
-rw-r--r--zenstore/filecas.cpp16
-rw-r--r--zenstore/gc.cpp4
6 files changed, 14 insertions, 26 deletions
diff --git a/zenstore/basicfile.cpp b/zenstore/basicfile.cpp
index 41d296cbb..dcd9a8575 100644
--- a/zenstore/basicfile.cpp
+++ b/zenstore/basicfile.cpp
@@ -23,8 +23,6 @@
namespace zen {
-using namespace fmt::literals;
-
BasicFile::~BasicFile()
{
Close();
@@ -38,7 +36,7 @@ BasicFile::Open(std::filesystem::path FileName, bool IsCreate)
if (Ec)
{
- throw std::system_error(Ec, "failed to open file '{}'"_format(FileName));
+ throw std::system_error(Ec, fmt::format("failed to open file '{}'", FileName));
}
}
@@ -133,7 +131,7 @@ BasicFile::Read(void* Data, uint64_t BytesToRead, uint64_t FileOffset)
if (!Success)
{
- ThrowLastError("Failed to read from file '{}'"_format(zen::PathFromHandle(m_FileHandle)));
+ ThrowLastError(fmt::format("Failed to read from file '{}'", zen::PathFromHandle(m_FileHandle)));
}
BytesToRead -= NumberOfBytesToRead;
@@ -239,7 +237,7 @@ BasicFile::Write(const void* Data, uint64_t Size, uint64_t Offset)
if (Ec)
{
- throw std::system_error(Ec, "Failed to write to file '{}'"_format(zen::PathFromHandle(m_FileHandle)));
+ throw std::system_error(Ec, fmt::format("Failed to write to file '{}'", zen::PathFromHandle(m_FileHandle)));
}
}
diff --git a/zenstore/cas.cpp b/zenstore/cas.cpp
index 1fd01ff0c..7b58111db 100644
--- a/zenstore/cas.cpp
+++ b/zenstore/cas.cpp
@@ -201,7 +201,7 @@ CasImpl::OpenOrCreateManifest()
}
else
{
- ZEN_ERROR("Store manifest validation failed: {:#x}, will generate new manifest to recover", ValidationResult);
+ ZEN_ERROR("Store manifest validation failed: {:#x}, will generate new manifest to recover", uint32_t(ValidationResult));
}
if (ManifestIsOk)
diff --git a/zenstore/caslog.cpp b/zenstore/caslog.cpp
index dc4891e9f..055e3feda 100644
--- a/zenstore/caslog.cpp
+++ b/zenstore/caslog.cpp
@@ -24,8 +24,6 @@
namespace zen {
-using namespace fmt::literals;
-
uint32_t
CasLogFile::FileHeader::ComputeChecksum()
{
@@ -50,7 +48,7 @@ CasLogFile::Open(std::filesystem::path FileName, size_t RecordSize, bool IsCreat
if (Ec)
{
- throw std::system_error(Ec, "Failed to open log file '{}'"_format(FileName));
+ throw std::system_error(Ec, fmt::format("Failed to open log file '{}'", FileName));
}
uint64_t AppendOffset = 0;
@@ -76,7 +74,7 @@ CasLogFile::Open(std::filesystem::path FileName, size_t RecordSize, bool IsCreat
if ((0 != memcmp(Header.Magic, FileHeader::MagicSequence, sizeof Header.Magic)) || (Header.Checksum != Header.ComputeChecksum()))
{
- throw std::runtime_error("Mangled log header (invalid header magic) in '{}'"_format(FileName));
+ throw std::runtime_error(fmt::format("Mangled log header (invalid header magic) in '{}'", FileName));
}
AppendOffset = m_File.FileSize();
@@ -153,7 +151,7 @@ CasLogFile::Append(const void* DataPointer, uint64_t DataSize)
if (Ec)
{
- throw std::system_error(Ec, "Failed to write to log file '{}'"_format(PathFromHandle(m_File.Handle())));
+ throw std::system_error(Ec, fmt::format("Failed to write to log file '{}'", PathFromHandle(m_File.Handle())));
}
}
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp
index aa60ec37b..3bf0c70df 100644
--- a/zenstore/compactcas.cpp
+++ b/zenstore/compactcas.cpp
@@ -31,8 +31,6 @@
namespace zen {
-using namespace fmt::literals;
-
CasContainerStrategy::CasContainerStrategy(const CasStoreConfiguration& Config, CasGc& Gc)
: GcStorage(Gc)
, m_Config(Config)
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp
index fb0f80436..533c99569 100644
--- a/zenstore/filecas.cpp
+++ b/zenstore/filecas.cpp
@@ -35,8 +35,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
-using namespace fmt::literals;
-
FileCasStrategy::ShardingHelper::ShardingHelper(const std::filesystem::path& RootPath, const IoHash& ChunkHash)
{
ShardedPath.Append(RootPath.c_str());
@@ -241,7 +239,7 @@ FileCasStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash)
if (FAILED(hRes))
{
- ThrowSystemException(hRes, "Failed to open shard directory '{}'"_format(FilePath));
+ ThrowSystemException(hRes, fmt::format("Failed to open shard directory '{}'", FilePath));
}
// Retry rename/move
@@ -386,7 +384,7 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize
if (FAILED(hRes))
{
- ThrowSystemException(hRes, "Failed to open shard file '{}'"_format(Name.ShardedPath.ToUtf8()));
+ ThrowSystemException(hRes, fmt::format("Failed to open shard file '{}'", Name.ShardedPath.ToUtf8()));
}
#else
// Attempt to exclusively create the file.
@@ -409,10 +407,10 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize
break;
}
}
- ThrowLastError("Failed creating shard directory '{}'"_format(Name.ShardedPath));
+ ThrowLastError(fmt::format("Failed creating shard directory '{}'", Name.ShardedPath));
default:
- ThrowLastError("Unexpected error occurred opening shard file '{}'"_format(Name.ShardedPath));
+ ThrowLastError(fmt::format("Unexpected error occurred opening shard file '{}'", Name.ShardedPath));
}
}
@@ -723,8 +721,6 @@ FileCasStrategy::CollectGarbage(GcContext& GcCtx)
TEST_CASE("cas.file.move")
{
- using namespace fmt::literals;
-
// specifying an absolute path here can be helpful when using procmon to dig into things
ScopedTemporaryDirectory TempDir; // {"d:\\filecas_testdir"};
@@ -769,7 +765,7 @@ TEST_CASE("cas.file.move")
*reinterpret_cast<int*>(Payload.MutableData()) = i;
PayloadHashes.push_back(IoHash::HashBuffer(Payload));
- std::filesystem::path PayloadPath{TempDir.Path() / "payload_{}_{}"_format(w, i)};
+ std::filesystem::path PayloadPath{TempDir.Path() / fmt::format("payload_{}_{}", w, i)};
WriteFile(PayloadPath, Payload);
}
}
@@ -781,7 +777,7 @@ TEST_CASE("cas.file.move")
for (int i = 0; i < kItemCount; ++i)
{
- std::filesystem::path PayloadPath{TempDir.Path() / "payload_{}_{}"_format(w, i)};
+ std::filesystem::path PayloadPath{TempDir.Path() / fmt::format("payload_{}_{}", w, i)};
IoBuffer Payload = IoBufferBuilder::MakeFromTemporaryFile(PayloadPath);
Buffers.push_back(Payload);
Sync.arrive_and_wait();
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index 92942b09f..0e93f1c3d 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -429,8 +429,6 @@ GcScheduler::Trigger(const GcScheduler::TriggerParams& Params)
void
GcScheduler::SchedulerThread()
{
- using namespace fmt::literals;
-
std::chrono::seconds WaitTime = m_Config.MonitorInterval;
for (;;)
@@ -474,7 +472,7 @@ GcScheduler::SchedulerThread()
NiceBytes(Space.Free),
NiceBytes(Space.Total),
m_Config.Interval.count()
- ? "{} until next GC"_format(NiceTimeSpanMs(uint64_t(std::chrono::milliseconds(RemaingTime).count())))
+ ? fmt::format("{} until next GC", NiceTimeSpanMs(uint64_t(std::chrono::milliseconds(RemaingTime).count())))
: std::string("next scheduled GC no set"));
// TODO: Trigger GC if max disk usage water mark is reached