aboutsummaryrefslogtreecommitdiff
path: root/zenserver
diff options
context:
space:
mode:
authorMatt Peters <[email protected]>2022-01-10 10:57:59 -0700
committerMatt Peters <[email protected]>2022-01-10 10:57:59 -0700
commit4a12683b27adb31bde9eb8f7df3b9e9cc8ec680a (patch)
treec8b2939d400dd4bccae73d2782b15c65d30db19d /zenserver
parentAdd WaitForQuiescence RPC (diff)
parentTwo missing override keywords (diff)
downloadzen-wait_for_quiescence.tar.xz
zen-wait_for_quiescence.zip
Merge branch 'main' into wait_for_quiescencewait_for_quiescence
Diffstat (limited to 'zenserver')
-rw-r--r--zenserver/admin/admin.cpp4
-rw-r--r--zenserver/cache/cachetracking.cpp7
-rw-r--r--zenserver/cache/structuredcache.cpp44
-rw-r--r--zenserver/cache/structuredcachestore.cpp20
-rw-r--r--zenserver/compute/apply.cpp18
-rw-r--r--zenserver/config.cpp6
-rw-r--r--zenserver/diag/diagsvcs.cpp2
-rw-r--r--zenserver/projectstore.cpp21
-rw-r--r--zenserver/testing/httptest.cpp26
-rw-r--r--zenserver/testing/launch.cpp4
-rw-r--r--zenserver/upstream/jupiter.cpp1
-rw-r--r--zenserver/upstream/upstreamapply.cpp17
-rw-r--r--zenserver/upstream/upstreamcache.cpp22
-rw-r--r--zenserver/zenserver.cpp15
14 files changed, 80 insertions, 127 deletions
diff --git a/zenserver/admin/admin.cpp b/zenserver/admin/admin.cpp
index 01c35a1d8..676e9a830 100644
--- a/zenserver/admin/admin.cpp
+++ b/zenserver/admin/admin.cpp
@@ -16,7 +16,7 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler) : m_GcScheduler(Sched
m_Router.RegisterRoute(
"health",
- [this](HttpRouterRequest& Req) {
+ [](HttpRouterRequest& Req) {
CbObjectWriter Obj;
Obj.AddBool("ok", true);
Req.ServerRequest().WriteResponse(HttpResponseCode::OK, Obj.Save());
@@ -64,7 +64,7 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler) : m_GcScheduler(Sched
m_Router.RegisterRoute(
"",
- [this](HttpRouterRequest& Req) {
+ [](HttpRouterRequest& Req) {
CbObject Payload = Req.ServerRequest().ReadPayloadObject();
CbObjectWriter Obj;
diff --git a/zenserver/cache/cachetracking.cpp b/zenserver/cache/cachetracking.cpp
index ae132f37f..9119e3122 100644
--- a/zenserver/cache/cachetracking.cpp
+++ b/zenserver/cache/cachetracking.cpp
@@ -26,8 +26,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
-using namespace fmt::literals;
-
namespace rocksdb = ROCKSDB_NAMESPACE;
static constinit auto Epoch = std::chrono::time_point<std::chrono::system_clock>{};
@@ -180,14 +178,14 @@ struct ZenCacheTracker::Impl
}
else
{
- throw std::runtime_error("column family iteration failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error(fmt::format("column family iteration failed for '{}': '{}'", RocksdbPath, Status.getState()).c_str());
}
Status = rocksdb::DB::Open(Options, RocksdbPath, ColumnDescriptors, &m_RocksDbColumnHandles, &Db);
if (!Status.ok())
{
- throw std::runtime_error("database open failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error(fmt::format("database open failed for '{}': '{}'", RocksdbPath, Status.getState()).c_str());
}
m_RocksDb.reset(Db);
@@ -297,7 +295,6 @@ ZenCacheTracker::IterateSnapshots(std::function<void(uint64_t TimeStamp, CbObjec
TEST_CASE("z$.tracker")
{
- using namespace fmt::literals;
using namespace std::literals;
const uint64_t t0 = GetCurrentCacheTimeStamp();
diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp
index 8639ed1c8..6078f892e 100644
--- a/zenserver/cache/structuredcache.cpp
+++ b/zenserver/cache/structuredcache.cpp
@@ -152,19 +152,16 @@ HttpStructuredCacheService::HandleRequest(HttpServerRequest& Request)
void
HttpStructuredCacheService::HandleCacheBucketRequest(HttpServerRequest& Request, std::string_view Bucket)
{
- ZEN_UNUSED(Request, Bucket);
switch (Request.RequestVerb())
{
- using enum HttpVerb;
-
- case kHead:
- case kGet:
+ case HttpVerb::kHead:
+ case HttpVerb::kGet:
{
// Query stats
}
break;
- case kDelete:
+ case HttpVerb::kDelete:
// Drop bucket
if (m_CacheStore.DropBucket(Bucket))
@@ -187,16 +184,14 @@ HttpStructuredCacheService::HandleCacheRecordRequest(HttpServerRequest& Request,
{
switch (Request.RequestVerb())
{
- using enum HttpVerb;
-
- case kHead:
- case kGet:
+ case HttpVerb::kHead:
+ case HttpVerb::kGet:
{
HandleGetCacheRecord(Request, Ref, Policy);
}
break;
- case kPut:
+ case HttpVerb::kPut:
HandlePutCacheRecord(Request, Ref, Policy);
break;
default:
@@ -228,7 +223,7 @@ HttpStructuredCacheService::HandleGetCacheRecord(zen::HttpServerRequest& Request
if (!SkipAttachments)
{
- CacheRecord.IterateAttachments([this, &Ref, &Package, &AttachmentCount, &ValidCount](CbFieldView AttachmentHash) {
+ CacheRecord.IterateAttachments([this, &Package, &AttachmentCount, &ValidCount](CbFieldView AttachmentHash) {
if (IoBuffer Chunk = m_CidStore.FindChunkByCid(AttachmentHash.AsHash()))
{
Package.AddAttachment(CbAttachment(CompressedBuffer::FromCompressed(SharedBuffer(Chunk))));
@@ -588,15 +583,13 @@ HttpStructuredCacheService::HandleCachePayloadRequest(HttpServerRequest& Request
{
switch (Request.RequestVerb())
{
- using enum HttpVerb;
-
- case kHead:
- case kGet:
+ case HttpVerb::kHead:
+ case HttpVerb::kGet:
{
HandleGetCachePayload(Request, Ref, Policy);
}
break;
- case kPut:
+ case HttpVerb::kPut:
HandlePutCachePayload(Request, Ref, Policy);
break;
default:
@@ -772,9 +765,7 @@ HttpStructuredCacheService::HandleRpcRequest(zen::HttpServerRequest& Request)
{
switch (Request.RequestVerb())
{
- using enum HttpVerb;
-
- case kPost:
+ case HttpVerb::kPost:
{
const HttpContentType ContentType = Request.RequestContentType();
const HttpContentType AcceptType = Request.AcceptContentType();
@@ -817,8 +808,6 @@ HttpStructuredCacheService::HandleRpcGetCacheRecords(zen::HttpServerRequest& Req
{
ZEN_TRACE_CPU("Z$::RpcGetCacheRecords");
- using namespace fmt::literals;
-
CbPackage RpcResponse;
CacheRecordPolicy Policy;
CbObjectView Params = RpcRequest["Params"sv].AsObjectView();
@@ -906,7 +895,7 @@ HttpStructuredCacheService::HandleRpcGetCacheRecords(zen::HttpServerRequest& Req
if (!UpstreamRequests.empty() && m_UpstreamCache)
{
const auto OnCacheRecordGetComplete =
- [this, &CacheKeys, &CacheValues, &RpcResponse, PartialOnError, SkipAttachments](CacheRecordGetCompleteParams&& Params) {
+ [this, &CacheValues, &RpcResponse, PartialOnError, SkipAttachments](CacheRecordGetCompleteParams&& Params) {
ZEN_ASSERT(Params.KeyIndex < CacheValues.size());
IoBuffer CacheValue;
@@ -1015,8 +1004,6 @@ HttpStructuredCacheService::HandleRpcGetCachePayloads(zen::HttpServerRequest& Re
{
ZEN_TRACE_CPU("Z$::RpcGetCachePayloads");
- using namespace fmt::literals;
-
ZEN_ASSERT(RpcRequest["Method"sv].AsString() == "GetCachePayloads"sv);
std::vector<CacheChunkRequest> ChunkRequests;
@@ -1035,7 +1022,10 @@ HttpStructuredCacheService::HandleRpcGetCachePayloads(zen::HttpServerRequest& Re
const uint64_t RawSize = RequestObject["RawSize"sv].AsUInt64();
const uint32_t ChunkPolicy = RequestObject["Policy"sv].AsUInt32();
- ChunkRequests.emplace_back(Key, ChunkId, PayloadId, RawOffset, RawSize, static_cast<CachePolicy>(ChunkPolicy));
+ // Note we could use emplace_back here but [Apple] LLVM-12's C++ library
+ // can't infer a constructor like other platforms (or can't handle an
+ // initializer list like others do).
+ ChunkRequests.push_back({Key, ChunkId, PayloadId, RawOffset, RawSize, static_cast<CachePolicy>(ChunkPolicy)});
}
if (ChunkRequests.empty())
@@ -1153,7 +1143,7 @@ HttpStructuredCacheService::HandleRpcGetCachePayloads(zen::HttpServerRequest& Re
if (!UpstreamRequests.empty() && m_UpstreamCache)
{
- const auto OnCachePayloadGetComplete = [this, &ChunkRequests, &Chunks](CachePayloadGetCompleteParams&& Params) {
+ const auto OnCachePayloadGetComplete = [this, &Chunks](CachePayloadGetCompleteParams&& Params) {
if (CompressedBuffer Compressed = CompressedBuffer::FromCompressed(SharedBuffer(Params.Payload)))
{
m_CidStore.AddChunk(Compressed);
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index e74becb3a..68b7e2a48 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -26,8 +26,6 @@
#endif
#include <concepts>
-#include <memory_resource>
-#include <ranges>
ZEN_THIRD_PARTY_INCLUDES_START
#include <fmt/core.h>
@@ -38,7 +36,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
-using namespace fmt::literals;
namespace fs = std::filesystem;
static CbObject
@@ -1066,14 +1063,14 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c
if (Ec)
{
- throw std::system_error(Ec, "Failed to open temporary file for put at '{}'"_format(m_BucketDir));
+ throw std::system_error(Ec, fmt::format("Failed to open temporary file for put at '{}'", m_BucketDir));
}
DataFile.WriteAll(Value.Value, Ec);
if (Ec)
{
- throw std::system_error(Ec, "Failed to write payload ({} bytes) to file"_format(NiceBytes(Value.Value.Size())));
+ throw std::system_error(Ec, fmt::format("Failed to write payload ({} bytes) to file", NiceBytes(Value.Value.Size())));
}
// Move file into place (atomically)
@@ -1113,7 +1110,7 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c
if (Ec)
{
- throw std::system_error(Ec, "Failed to finalize file '{}'"_format(DataFilePath.ToUtf8()));
+ throw std::system_error(Ec, fmt::format("Failed to finalize file '{}'", DataFilePath.ToUtf8()));
}
}
@@ -1396,7 +1393,6 @@ ZenCacheDiskLayer::TotalSize() const
#if ZEN_WITH_TESTS
using namespace std::literals;
-using namespace fmt::literals;
namespace testutils {
IoHash CreateKey(size_t KeyValue) { return IoHash::HashBuffer(&KeyValue, sizeof(size_t)); }
@@ -1483,7 +1479,7 @@ TEST_CASE("z$.size")
for (size_t Key = 0; Key < Count; ++Key)
{
const size_t Bucket = Key % 4;
- Zcs.Put("test_bucket-{}"_format(Bucket), IoHash::HashBuffer(&Key, sizeof(uint32_t)), {.Value = Buffer});
+ Zcs.Put(fmt::format("test_bucket-{}", Bucket), IoHash::HashBuffer(&Key, sizeof(uint32_t)), {.Value = Buffer});
}
CacheSize = Zcs.StorageSize();
@@ -1501,7 +1497,7 @@ TEST_CASE("z$.size")
for (size_t Bucket = 0; Bucket < 4; ++Bucket)
{
- Zcs.DropBucket("test_bucket-{}"_format(Bucket));
+ Zcs.DropBucket(fmt::format("test_bucket-{}", Bucket));
}
CHECK_EQ(0, Zcs.StorageSize().DiskSize);
}
@@ -1526,7 +1522,7 @@ TEST_CASE("z$.size")
for (size_t Key = 0; Key < Count; ++Key)
{
const size_t Bucket = Key % 4;
- Zcs.Put("test_bucket-{}"_format(Bucket), IoHash::HashBuffer(&Key, sizeof(uint32_t)), {.Value = Buffer});
+ Zcs.Put(fmt::format("test_bucket-{}", Bucket), IoHash::HashBuffer(&Key, sizeof(uint32_t)), {.Value = Buffer});
}
CacheSize = Zcs.StorageSize();
@@ -1544,7 +1540,7 @@ TEST_CASE("z$.size")
for (size_t Bucket = 0; Bucket < 4; ++Bucket)
{
- Zcs.DropBucket("test_bucket-{}"_format(Bucket));
+ Zcs.DropBucket(fmt::format("test_bucket-{}", Bucket));
}
CHECK_EQ(0, Zcs.StorageSize().DiskSize);
}
@@ -1585,7 +1581,7 @@ TEST_CASE("z$.gc")
for (size_t Idx = 0; auto& Cid : Cids)
{
- Record.AddBinaryAttachment("attachment-{}"_format(Idx++), Cid);
+ Record.AddBinaryAttachment(fmt::format("attachment-{}", Idx++), Cid);
}
IoBuffer Buffer = Record.Save().GetBuffer().AsIoBuffer();
diff --git a/zenserver/compute/apply.cpp b/zenserver/compute/apply.cpp
index d483fd4f7..95902a752 100644
--- a/zenserver/compute/apply.cpp
+++ b/zenserver/compute/apply.cpp
@@ -61,8 +61,6 @@ BasicFunctionJob::~BasicFunctionJob()
bool
BasicFunctionJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLine)
{
- using namespace fmt::literals;
-
STARTUPINFOEX StartupInfo = {sizeof(STARTUPINFOEX)};
PROCESS_INFORMATION ProcessInfo{};
@@ -82,7 +80,7 @@ BasicFunctionJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLi
if (!Created)
{
- throw std::system_error(::GetLastError(), std::system_category(), "Failed to create process '{}'"_format(ExePath).c_str());
+ throw std::system_error(::GetLastError(), std::system_category(), fmt::format("Failed to create process '{}'", ExePath).c_str());
}
m_ProcessId = ProcessInfo.dwProcessId;
@@ -714,7 +712,6 @@ CbPackage
HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
{
using namespace std::literals;
- using namespace fmt::literals;
std::filesystem::path SandboxPath = CreateNewSandbox();
@@ -735,12 +732,12 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
if (!DataBuffer)
{
- throw std::runtime_error("worker CAS chunk '{}' missing"_format(ChunkHash));
+ throw std::runtime_error(fmt::format("worker CAS chunk '{}' missing", ChunkHash));
}
if (DataBuffer.Size() != Size)
{
- throw std::runtime_error("worker CAS chunk '{}' size: {}, action spec expected {}"_format(ChunkHash, DataBuffer.Size(), Size));
+ throw std::runtime_error(fmt::format("worker CAS chunk '{}' size: {}, action spec expected {}", ChunkHash, DataBuffer.Size(), Size));
}
zen::WriteFile(FilePath, DataBuffer);
@@ -766,12 +763,12 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
if (!DataBuffer)
{
- throw std::runtime_error("worker CAS chunk '{}' missing"_format(ChunkHash));
+ throw std::runtime_error(fmt::format("worker CAS chunk '{}' missing", ChunkHash));
}
if (DataBuffer.Size() != Size)
{
- throw std::runtime_error("worker CAS chunk '{}' size: {}, action spec expected {}"_format(ChunkHash, DataBuffer.Size(), Size));
+ throw std::runtime_error(fmt::format("worker CAS chunk '{}' size: {}, action spec expected {}", ChunkHash, DataBuffer.Size(), Size));
}
zen::WriteFile(FilePath, DataBuffer);
@@ -790,7 +787,7 @@ HttpFunctionService::ExecAction(const WorkerDesc& Worker, CbObject Action)
if (!DataBuffer)
{
- throw std::runtime_error("input CID chunk '{}' missing"_format(Cid));
+ throw std::runtime_error(fmt::format("input CID chunk '{}' missing", Cid));
}
zen::WriteFile(FilePath, DataBuffer);
@@ -942,11 +939,10 @@ HttpFunctionService::ExecActionUpstream(const WorkerDesc& Worker, CbObject Actio
HttpResponseCode
HttpFunctionService::ExecActionUpstreamResult(const IoHash& WorkerId, const IoHash& ActionId, CbPackage& Package)
{
- using namespace fmt::literals;
auto Status = m_UpstreamApply->GetStatus(WorkerId, ActionId);
if (!Status.Success)
{
- // throw std::runtime_error("Action {}/{} not found"_format(WorkerId.ToHexString(), ActionId.ToHexString()).c_str());
+ // throw std::runtime_error(fmt::format("Action {}/{} not found", WorkerId.ToHexString(), ActionId.ToHexString()).c_str());
return HttpResponseCode::NotFound;
}
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 722bc3b97..9fd4bfa69 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -394,8 +394,6 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
void
ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptions)
{
- using namespace fmt::literals;
-
zen::IoBuffer LuaScript = zen::IoBufferBuilder::MakeFromFile(Path);
if (LuaScript)
@@ -433,14 +431,14 @@ ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptio
std::string ErrorString = sol::to_string(config.status());
- throw std::runtime_error("{} error: {}"_format(ErrorString, err.what()));
+ throw std::runtime_error(fmt::format("{} error: {}", ErrorString, err.what()));
}
config();
}
catch (std::exception& e)
{
- throw std::runtime_error("failed to load config script ('{}'): {}"_format(Path, e.what()).c_str());
+ throw std::runtime_error(fmt::format("failed to load config script ('{}'): {}", Path, e.what()).c_str());
}
if (sol::optional<sol::table> ServerConfig = lua["server"])
diff --git a/zenserver/diag/diagsvcs.cpp b/zenserver/diag/diagsvcs.cpp
index eed23dff2..ef2baa1b4 100644
--- a/zenserver/diag/diagsvcs.cpp
+++ b/zenserver/diag/diagsvcs.cpp
@@ -44,7 +44,7 @@ HttpHealthService::HttpHealthService()
{
m_Router.RegisterRoute(
"",
- [this](HttpRouterRequest& RoutedReq) {
+ [](HttpRouterRequest& RoutedReq) {
HttpServerRequest& HttpReq = RoutedReq.ServerRequest();
HttpReq.WriteResponse(HttpResponseCode::OK, HttpContentType::kText, u8"OK!"sv);
},
diff --git a/zenserver/projectstore.cpp b/zenserver/projectstore.cpp
index 4f9897e07..42d785126 100644
--- a/zenserver/projectstore.cpp
+++ b/zenserver/projectstore.cpp
@@ -42,8 +42,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
-using namespace fmt::literals;
-
#if USE_ROCKSDB
namespace rocksdb = ROCKSDB_NAMESPACE;
#endif
@@ -154,14 +152,14 @@ struct ProjectStore::OplogStorage : public RefCounted
}
else
{
- throw std::runtime_error("column family iteration failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error(fmt::format("column family iteration failed for '{}': '{}'", RocksdbPath, Status.getState()).c_str());
}
Status = rocksdb::DB::Open(Options, RocksdbPath, ColumnDescriptors, &m_RocksDbColumnHandles, &Db);
if (!Status.ok())
{
- throw std::runtime_error("database open failed for '{}': '{}'"_format(RocksdbPath, Status.getState()).c_str());
+ throw std::runtime_error(fmt::format("database open failed for '{}': '{}'", RocksdbPath, Status.getState()).c_str());
}
m_RocksDb.reset(Db);
@@ -1560,7 +1558,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
if (!legacy::TryLoadCbPackage(Package, Payload, &UniqueBuffer::Alloc, &Resolver))
{
std::filesystem::path BadPackagePath =
- Oplog.TempPath() / "bad_packages" / "session{}_request{}"_format(HttpReq.SessionId(), HttpReq.RequestId());
+ Oplog.TempPath() / "bad_packages" / fmt::format("session{}_request{}", HttpReq.SessionId(), HttpReq.RequestId());
ZEN_ERROR("Received malformed package! Saving payload to '{}'", BadPackagePath);
@@ -1600,7 +1598,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
m_Router.RegisterRoute(
"{project}/oplog/{log}/{op}",
- [this](HttpRouterRequest& Req) {
+ [](HttpRouterRequest& Req) {
HttpServerRequest& HttpReq = Req.ServerRequest();
// TODO: look up op and respond with the payload!
@@ -1609,8 +1607,6 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
},
HttpVerb::kGet);
- using namespace fmt::literals;
-
m_Router.RegisterRoute(
"{project}/oplog/{log}",
[this](HttpRouterRequest& Req) {
@@ -1623,7 +1619,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
{
return Req.ServerRequest().WriteResponse(HttpResponseCode::NotFound,
HttpContentType::kText,
- "project {} not found"_format(ProjectId));
+ fmt::format("project {} not found", ProjectId));
}
ProjectStore::Project& Prj = *ProjectIt;
@@ -1638,7 +1634,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
{
return Req.ServerRequest().WriteResponse(HttpResponseCode::NotFound,
HttpContentType::kText,
- "oplog {} not found in project {}"_format(OplogId, ProjectId));
+ fmt::format("oplog {} not found in project {}", OplogId, ProjectId));
}
ProjectStore::Oplog& Log = *OplogIt;
@@ -1777,7 +1773,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
{
return Req.ServerRequest().WriteResponse(HttpResponseCode::NotFound,
HttpContentType::kText,
- "project {} not found"_format(ProjectId));
+ fmt::format("project {} not found", ProjectId));
}
const ProjectStore::Project& Prj = *ProjectIt;
@@ -1801,7 +1797,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
{
return Req.ServerRequest().WriteResponse(HttpResponseCode::NotFound,
HttpContentType::kText,
- "project {} not found"_format(ProjectId));
+ fmt::format("project {} not found", ProjectId));
}
m_ProjectStore->DeleteProject(ProjectId);
@@ -2142,7 +2138,6 @@ LocalProjectService::~LocalProjectService()
TEST_CASE("prj.store")
{
- using namespace fmt::literals;
using namespace std::literals;
ScopedTemporaryDirectory TempDir;
diff --git a/zenserver/testing/httptest.cpp b/zenserver/testing/httptest.cpp
index 924546762..230d5d6c5 100644
--- a/zenserver/testing/httptest.cpp
+++ b/zenserver/testing/httptest.cpp
@@ -8,51 +8,49 @@
namespace zen {
-using namespace fmt::literals;
-
HttpTestingService::HttpTestingService()
{
m_Router.RegisterRoute(
"hello",
- [this](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponse(HttpResponseCode::OK); },
+ [](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponse(HttpResponseCode::OK); },
HttpVerb::kGet);
m_Router.RegisterRoute(
"hello_slow",
- [this](HttpRouterRequest& Req) {
- Req.ServerRequest().WriteResponseAsync([this](HttpServerRequest& Request) {
+ [](HttpRouterRequest& Req) {
+ Req.ServerRequest().WriteResponseAsync([](HttpServerRequest& Request) {
Stopwatch Timer;
Sleep(1000);
Request.WriteResponse(HttpResponseCode::OK,
HttpContentType::kText,
- "hello, took me {}"_format(NiceTimeSpanMs(Timer.GetElapsedTimeMs())));
+ fmt::format("hello, took me {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())));
});
},
HttpVerb::kGet);
m_Router.RegisterRoute(
"hello_veryslow",
- [this](HttpRouterRequest& Req) {
- Req.ServerRequest().WriteResponseAsync([this](HttpServerRequest& Request) {
+ [](HttpRouterRequest& Req) {
+ Req.ServerRequest().WriteResponseAsync([](HttpServerRequest& Request) {
Stopwatch Timer;
Sleep(60000);
Request.WriteResponse(HttpResponseCode::OK,
HttpContentType::kText,
- "hello, took me {}"_format(NiceTimeSpanMs(Timer.GetElapsedTimeMs())));
+ fmt::format("hello, took me {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())));
});
},
HttpVerb::kGet);
m_Router.RegisterRoute(
"hello_throw",
- [this](HttpRouterRequest& Req) {
- Req.ServerRequest().WriteResponseAsync([this](HttpServerRequest&) { throw std::runtime_error("intentional error"); });
+ [](HttpRouterRequest& Req) {
+ Req.ServerRequest().WriteResponseAsync([](HttpServerRequest&) { throw std::runtime_error("intentional error"); });
},
HttpVerb::kGet);
m_Router.RegisterRoute(
"hello_noresponse",
- [this](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponseAsync([this](HttpServerRequest&) {}); },
+ [](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponseAsync([](HttpServerRequest&) {}); },
HttpVerb::kGet);
m_Router.RegisterRoute(
@@ -84,7 +82,7 @@ HttpTestingService::HttpTestingService()
m_Router.RegisterRoute(
"echo",
- [this](HttpRouterRequest& Req) {
+ [](HttpRouterRequest& Req) {
IoBuffer Body = Req.ServerRequest().ReadPayload();
Req.ServerRequest().WriteResponse(HttpResponseCode::OK, HttpContentType::kBinary, Body);
},
@@ -92,7 +90,7 @@ HttpTestingService::HttpTestingService()
m_Router.RegisterRoute(
"package",
- [this](HttpRouterRequest& Req) {
+ [](HttpRouterRequest& Req) {
CbPackage Pkg = Req.ServerRequest().ReadPayloadPackage();
Req.ServerRequest().WriteResponse(HttpResponseCode::OK, Pkg);
},
diff --git a/zenserver/testing/launch.cpp b/zenserver/testing/launch.cpp
index 706594b10..f315ec1b4 100644
--- a/zenserver/testing/launch.cpp
+++ b/zenserver/testing/launch.cpp
@@ -55,8 +55,6 @@ BasicJob::~BasicJob()
bool
BasicJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLine)
{
- using namespace fmt::literals;
-
STARTUPINFOEX StartupInfo = {sizeof(STARTUPINFOEX)};
PROCESS_INFORMATION ProcessInfo{};
@@ -76,7 +74,7 @@ BasicJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLine)
if (!Created)
{
- throw std::system_error(::GetLastError(), std::system_category(), "Failed to create process '{}'"_format(ExePath).c_str());
+ throw std::system_error(::GetLastError(), std::system_category(), fmt::format("Failed to create process '{}'", ExePath).c_str());
}
m_ProcessId = ProcessInfo.dwProcessId;
diff --git a/zenserver/upstream/jupiter.cpp b/zenserver/upstream/jupiter.cpp
index ffb9b1cbf..c952d8e10 100644
--- a/zenserver/upstream/jupiter.cpp
+++ b/zenserver/upstream/jupiter.cpp
@@ -25,7 +25,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
#include <json11.hpp>
using namespace std::literals;
-using namespace fmt::literals;
namespace zen {
diff --git a/zenserver/upstream/upstreamapply.cpp b/zenserver/upstream/upstreamapply.cpp
index f8a8c3e62..fe7f7d9c8 100644
--- a/zenserver/upstream/upstreamapply.cpp
+++ b/zenserver/upstream/upstreamapply.cpp
@@ -53,10 +53,9 @@ namespace detail {
, m_CasStore(CasStore)
, m_CidStore(CidStore)
{
- using namespace fmt::literals;
- m_DisplayName = "Horde - '{}'"_format(Options.ServiceUrl);
+ m_DisplayName = fmt::format("Horde - '{}'", Options.ServiceUrl);
m_Client = new CloudCacheClient(Options);
- m_ChannelId = "zen-{}"_format(zen::GetSessionIdString());
+ m_ChannelId = fmt::format("zen-{}", zen::GetSessionIdString());
}
virtual ~HordeUpstreamApplyEndpoint() = default;
@@ -442,14 +441,13 @@ namespace detail {
if (Outcome != ComputeTaskOutcome::Success)
{
- using namespace fmt::literals;
const std::string_view Detail = TaskStatus["d"sv].AsString();
if (!Detail.empty())
{
return {.Error{.ErrorCode = -1,
- .Reason = "Task {}: {}"_format(ComputeTaskOutcomeToString(Outcome), std::string(Detail))}};
+ .Reason = fmt::format("Task {}: {}", ComputeTaskOutcomeToString(Outcome), std::string(Detail))}};
}
- return {.Error{.ErrorCode = -1, .Reason = "Task {}"_format(ComputeTaskOutcomeToString(Outcome))}};
+ return {.Error{.ErrorCode = -1, .Reason = fmt::format("Task {}", ComputeTaskOutcomeToString(Outcome))}};
}
const IoHash TaskId = TaskStatus["h"sv].AsObjectAttachment();
@@ -713,8 +711,6 @@ namespace detail {
[[nodiscard]] bool ProcessApplyKey(const UpstreamApplyRecord& ApplyRecord, UpstreamData& Data)
{
- using namespace fmt::literals;
-
std::string ExecutablePath;
std::map<std::string, std::string> Environment;
std::set<std::filesystem::path> InputFiles;
@@ -749,7 +745,7 @@ namespace detail {
for (auto& It : ApplyRecord.WorkerDescriptor["dirs"sv])
{
std::string_view Directory = It.AsString();
- std::string DummyFile = "{}/.zen_empty_file"_format(Directory);
+ std::string DummyFile = fmt::format("{}/.zen_empty_file", Directory);
InputFiles.insert(DummyFile);
Data.Blobs[EmptyBufferId] = EmptyBuffer;
InputFileHashes[DummyFile] = EmptyBufferId;
@@ -816,7 +812,6 @@ namespace detail {
Data.Objects[SandboxHash] = std::move(Sandbox);
{
- using namespace fmt::literals;
std::string_view HostPlatform = ApplyRecord.WorkerDescriptor["host"sv].AsString();
if (HostPlatform.empty())
{
@@ -829,7 +824,7 @@ namespace detail {
bool Exclusive = ApplyRecord.WorkerDescriptor["exclusive"sv].AsBool();
// TODO: Remove override when Horde accepts the UE style Host Platforms (Win64, Linux, Mac)
- std::string Condition = "Platform == '{}'"_format(HostPlatform);
+ std::string Condition = fmt::format("Platform == '{}'", HostPlatform);
if (HostPlatform == "Win64")
{
Condition += " && Pool == 'Win-RemoteExec'";
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp
index 2ed74cdd4..1a35f7283 100644
--- a/zenserver/upstream/upstreamcache.cpp
+++ b/zenserver/upstream/upstreamcache.cpp
@@ -48,7 +48,7 @@ namespace detail {
virtual ~JupiterUpstreamEndpoint() = default;
- virtual const UpstreamEndpointInfo& GetEndpointInfo() const { return m_Info; }
+ virtual const UpstreamEndpointInfo& GetEndpointInfo() const override { return m_Info; }
virtual UpstreamEndpointHealth Initialize() override { return CheckHealth(); }
@@ -270,8 +270,6 @@ namespace detail {
{
ZEN_TRACE_CPU("Upstream::Horde::PutCacheRecord");
- using namespace fmt::literals;
-
ZEN_ASSERT(CacheRecord.PayloadIds.size() == Payloads.size());
const int32_t MaxAttempts = 3;
@@ -313,7 +311,7 @@ namespace detail {
if (It == std::end(CacheRecord.PayloadIds))
{
- OutReason = "payload '{}' MISSING from local cache"_format(PayloadId);
+ OutReason = fmt::format("payload '{}' MISSING from local cache", PayloadId);
return false;
}
@@ -329,7 +327,7 @@ namespace detail {
if (!BlobResult.Success)
{
- OutReason = "upload payload '{}' FAILED, reason '{}'"_format(PayloadId, BlobResult.Reason);
+ OutReason = fmt::format("upload payload '{}' FAILED, reason '{}'", PayloadId, BlobResult.Reason);
return false;
}
@@ -350,7 +348,7 @@ namespace detail {
if (!RefResult.Success)
{
- return {.Reason = "upload cache record '{}/{}' FAILED, reason '{}'"_format(CacheRecord.Key.Bucket,
+ return {.Reason = fmt::format("upload cache record '{}/{}' FAILED, reason '{}'", CacheRecord.Key.Bucket,
CacheRecord.Key.Hash,
RefResult.Reason),
.Success = false};
@@ -371,7 +369,7 @@ namespace detail {
if (!FinalizeResult.Success)
{
- return {.Reason = "finalize cache record '{}/{}' FAILED, reason '{}'"_format(CacheRecord.Key.Bucket,
+ return {.Reason = fmt::format("finalize cache record '{}/{}' FAILED, reason '{}'", CacheRecord.Key.Bucket,
CacheRecord.Key.Hash,
FinalizeResult.Reason),
.Success = false};
@@ -389,7 +387,7 @@ namespace detail {
if (!FinalizeResult.Success)
{
- return {.Reason = "finalize '{}/{}' FAILED, reason '{}'"_format(CacheRecord.Key.Bucket,
+ return {.Reason = fmt::format("finalize '{}/{}' FAILED, reason '{}'", CacheRecord.Key.Bucket,
CacheRecord.Key.Hash,
FinalizeResult.Reason),
.Success = false};
@@ -403,7 +401,7 @@ namespace detail {
Sb << MissingHash.ToHexString() << ",";
}
- return {.Reason = "finalize '{}/{}' FAILED, still needs payload(s) '{}'"_format(CacheRecord.Key.Bucket,
+ return {.Reason = fmt::format("finalize '{}/{}' FAILED, still needs payload(s) '{}'", CacheRecord.Key.Bucket,
CacheRecord.Key.Hash,
Sb.ToString()),
.Success = false};
@@ -476,12 +474,10 @@ namespace detail {
~ZenUpstreamEndpoint() = default;
- virtual const UpstreamEndpointInfo& GetEndpointInfo() const { return m_Info; }
+ virtual const UpstreamEndpointInfo& GetEndpointInfo() const override { return m_Info; }
virtual UpstreamEndpointHealth Initialize() override
{
- using namespace fmt::literals;
-
const ZenEndpoint& Ep = GetEndpoint();
if (Ep.Ok)
{
@@ -500,8 +496,6 @@ namespace detail {
virtual UpstreamEndpointHealth CheckHealth() override
{
- using namespace fmt::literals;
-
try
{
if (m_Client.IsNull())
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index 6e5d2fe93..40d40e908 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -114,7 +114,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
using namespace std::literals;
-using namespace fmt::literals;
namespace utils {
asio::error_code ResolveHostname(asio::io_context& Ctx,
@@ -139,7 +138,7 @@ namespace utils {
{
for (const asio::ip::tcp::endpoint Ep : Endpoints)
{
- OutEndpoints.push_back("http://{}:{}"_format(Ep.address().to_string(), Ep.port()));
+ OutEndpoints.push_back(fmt::format("http://{}:{}", Ep.address().to_string(), Ep.port()));
}
}
@@ -152,8 +151,6 @@ class ZenServer : public IHttpStatusProvider
public:
void Initialize(const ZenServerOptions& ServerOptions, ZenServerState::ZenServerEntry* ServerEntry)
{
- using namespace fmt::literals;
-
m_ServerEntry = ServerEntry;
m_DebugOptionForcedCrash = ServerOptions.ShouldCrash;
const int ParentPid = ServerOptions.OwnerPid;
@@ -180,11 +177,11 @@ public:
// Initialize/check mutex based on base port
- std::string MutexName = "zen_{}"_format(ServerOptions.BasePort);
+ std::string MutexName = fmt::format("zen_{}", ServerOptions.BasePort);
if (zen::NamedMutex::Exists(MutexName) || ((m_ServerMutex.Create(MutexName) == false)))
{
- throw std::runtime_error("Failed to create mutex '{}' - is another instance already running?"_format(MutexName).c_str());
+ throw std::runtime_error(fmt::format("Failed to create mutex '{}' - is another instance already running?", MutexName).c_str());
}
InitializeState(ServerOptions);
@@ -585,7 +582,7 @@ ZenServer::InitializeState(const ZenServerOptions& ServerOptions)
else
{
WipeState = true;
- WipeReason = "No manifest present at '{}'"_format(ManifestPath);
+ WipeReason = fmt::format("No manifest present at '{}'", ManifestPath);
}
}
else
@@ -598,7 +595,7 @@ ZenServer::InitializeState(const ZenServerOptions& ServerOptions)
ZEN_ERROR("Manifest validation failed: {}, state will be wiped", ValidationResult);
WipeState = true;
- WipeReason = "Validation of manifest at '{}' failed: {}"_format(ManifestPath, ValidationResult);
+ WipeReason = fmt::format("Validation of manifest at '{}' failed: {}", ManifestPath, ValidationResult);
}
else
{
@@ -609,7 +606,7 @@ ZenServer::InitializeState(const ZenServerOptions& ServerOptions)
if (ManifestVersion != ZEN_CFG_SCHEMA_VERSION)
{
WipeState = true;
- WipeReason = "Manifest schema version: {}, differs from required: {}"_format(ManifestVersion, ZEN_CFG_SCHEMA_VERSION);
+ WipeReason = fmt::format("Manifest schema version: {}, differs from required: {}", ManifestVersion, ZEN_CFG_SCHEMA_VERSION);
}
}
}