diff options
| author | Dan Engelbrecht <[email protected]> | 2023-08-11 16:39:45 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-11 16:39:45 +0200 |
| commit | bf4738df5cad0eaa61f4e24b8db7611e378f9f80 (patch) | |
| tree | 6f0ada74fc5c49b71b64f7731c0681ef544bea65 /src | |
| parent | 0.2.16-pre0 (diff) | |
| download | zen-bf4738df5cad0eaa61f4e24b8db7611e378f9f80.tar.xz zen-bf4738df5cad0eaa61f4e24b8db7611e378f9f80.zip | |
update vcpkg dependencies (#356)
* bump vcpkg version
* fmt lib 10 fixes
* xmake dependencies (with linux workarounds)
* changelog
Diffstat (limited to 'src')
| -rw-r--r-- | src/zen/cmds/status.cpp | 3 | ||||
| -rw-r--r-- | src/zen/cmds/top.cpp | 7 | ||||
| -rw-r--r-- | src/zen/zen.cpp | 2 | ||||
| -rw-r--r-- | src/zencore/include/zencore/fmtutils.h | 11 | ||||
| -rw-r--r-- | src/zencore/include/zencore/string.h | 32 | ||||
| -rw-r--r-- | src/zencore/thread.cpp | 1 | ||||
| -rw-r--r-- | src/zenserver-test/zenserver-test.cpp | 15 | ||||
| -rw-r--r-- | src/zenserver/cache/httpstructuredcache.cpp | 3 | ||||
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 4 | ||||
| -rw-r--r-- | src/zenserver/xmake.lua | 5 | ||||
| -rw-r--r-- | src/zenserver/zenserver.cpp | 6 | ||||
| -rw-r--r-- | src/zenstore/filecas.cpp | 2 | ||||
| -rw-r--r-- | src/zenutil/zenserverprocess.cpp | 2 |
13 files changed, 76 insertions, 17 deletions
diff --git a/src/zen/cmds/status.cpp b/src/zen/cmds/status.cpp index 23c27f9f9..1afe191b7 100644 --- a/src/zen/cmds/status.cpp +++ b/src/zen/cmds/status.cpp @@ -2,6 +2,7 @@ #include "status.h" +#include <zencore/fmtutils.h> #include <zencore/logging.h> #include <zencore/string.h> #include <zencore/uid.h> @@ -32,7 +33,7 @@ StatusCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) State.Snapshot([&](const ZenServerState::ZenServerEntry& Entry) { StringBuilder<25> SessionStringBuilder; Entry.GetSessionId().ToString(SessionStringBuilder); - ZEN_CONSOLE("{:>5} {:>6} {:>24}", Entry.EffectiveListenPort, Entry.Pid, SessionStringBuilder.ToString()); + ZEN_CONSOLE("{:>5} {:>6} {:>24}", Entry.EffectiveListenPort.load(), Entry.Pid.load(), SessionStringBuilder); }); return 0; diff --git a/src/zen/cmds/top.cpp b/src/zen/cmds/top.cpp index 4fe8c9cdf..6aed6fe1b 100644 --- a/src/zen/cmds/top.cpp +++ b/src/zen/cmds/top.cpp @@ -45,7 +45,7 @@ TopCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) State.Snapshot([&](const ZenServerState::ZenServerEntry& Entry) { StringBuilder<25> SessionStringBuilder; Entry.GetSessionId().ToString(SessionStringBuilder); - ZEN_CONSOLE("{:>5} {:>6} {:>24}", Entry.EffectiveListenPort, Entry.Pid, SessionStringBuilder.ToString()); + ZEN_CONSOLE("{:>5} {:>6} {:>24}", Entry.EffectiveListenPort.load(), Entry.Pid.load(), SessionStringBuilder); }); zen::Sleep(1000); @@ -80,8 +80,9 @@ PsCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) return 0; } - State.Snapshot( - [&](const ZenServerState::ZenServerEntry& Entry) { ZEN_CONSOLE("Port {} : pid {}", Entry.EffectiveListenPort, Entry.Pid); }); + State.Snapshot([&](const ZenServerState::ZenServerEntry& Entry) { + ZEN_CONSOLE("Port {} : pid {}", Entry.EffectiveListenPort.load(), Entry.Pid.load()); + }); return 0; } diff --git a/src/zen/zen.cpp b/src/zen/zen.cpp index 0dc86a50f..6031c8be6 100644 --- a/src/zen/zen.cpp +++ b/src/zen/zen.cpp @@ -456,7 +456,7 @@ ZenCmdBase::ResolveTargetHostSpec(const std::string& InHostSpec, uint16_t& OutEf Servers.Snapshot([&](const zen::ZenServerState::ZenServerEntry& Entry) { if (ResolvedSpec.empty()) { - ResolvedSpec = fmt::format("http://localhost:{}", Entry.EffectiveListenPort); + ResolvedSpec = fmt::format("http://localhost:{}", Entry.EffectiveListenPort.load()); OutEffectivePort = Entry.EffectiveListenPort; } }); diff --git a/src/zencore/include/zencore/fmtutils.h b/src/zencore/include/zencore/fmtutils.h index 5c5169cd6..a927df866 100644 --- a/src/zencore/include/zencore/fmtutils.h +++ b/src/zencore/include/zencore/fmtutils.h @@ -2,6 +2,7 @@ #pragma once +#include <zencore/filesystem.h> #include <zencore/guid.h> #include <zencore/iohash.h> #include <zencore/string.h> @@ -11,7 +12,6 @@ ZEN_THIRD_PARTY_INCLUDES_START #include <fmt/format.h> ZEN_THIRD_PARTY_INCLUDES_END -#include <filesystem> #include <string_view> // Custom formatting for some zencore types @@ -63,3 +63,12 @@ struct fmt::formatter<std::filesystem::path> : formatter<string_view> return fmt::formatter<string_view>::format(String.ToView(), ctx); } }; + +template<typename T> +struct fmt::formatter<T, std::enable_if_t<std::is_base_of<zen::PathBuilderBase, T>::value, char>> : fmt::formatter<std::string_view> +{ + auto format(const zen::PathBuilderBase& a, format_context& ctx) const + { + return fmt::formatter<std::string_view>::format(a.ToView(), ctx); + } +}; diff --git a/src/zencore/include/zencore/string.h b/src/zencore/include/zencore/string.h index 7a44bf781..b26407005 100644 --- a/src/zencore/include/zencore/string.h +++ b/src/zencore/include/zencore/string.h @@ -17,6 +17,10 @@ #include <type_traits> +ZEN_THIRD_PARTY_INCLUDES_START +#include <fmt/format.h> +ZEN_THIRD_PARTY_INCLUDES_END + namespace zen { ////////////////////////////////////////////////////////////////////////// @@ -302,6 +306,16 @@ public: return AppendAscii(Str); } +#if defined(__clang__) && !defined(__APPLE__) + /* UE Toolchain Clang has different types for int64_t and long long so an override is + needed here. Without it, Clang can't disambiguate integer overloads */ + inline StringBuilderImpl& operator<<(long long n) + { + IntNum Str(n); + return AppendAscii(Str); + } +#endif + inline StringBuilderImpl& operator<<(const char* str) { return AppendAscii(str); } inline StringBuilderImpl& operator<<(const std::string_view str) { return AppendAscii(str); } inline StringBuilderImpl& operator<<(const std::u8string_view str) { return AppendAscii(str); } @@ -1112,3 +1126,21 @@ private: void string_forcelink(); // internal } // namespace zen + +template<typename T> +struct fmt::formatter<T, std::enable_if_t<std::is_base_of<zen::StringBuilderBase, T>::value, char>> : fmt::formatter<std::string_view> +{ + auto format(const zen::StringBuilderBase& a, format_context& ctx) const + { + return fmt::formatter<std::string_view>::format(a.ToView(), ctx); + } +}; + +template<typename T> +struct fmt::formatter<T, std::enable_if_t<std::is_base_of<zen::NiceBase, T>::value, char>> : fmt::formatter<std::string_view> +{ + auto format(const zen::NiceBase& a, format_context& ctx) const + { + return fmt::formatter<std::string_view>::format(std::string_view(a), ctx); + } +}; diff --git a/src/zencore/thread.cpp b/src/zencore/thread.cpp index b225c8aff..d95f5d542 100644 --- a/src/zencore/thread.cpp +++ b/src/zencore/thread.cpp @@ -4,6 +4,7 @@ #include <zencore/except.h> #include <zencore/filesystem.h> +#include <zencore/fmtutils.h> #include <zencore/scopeguard.h> #include <zencore/string.h> #include <zencore/testing.h> diff --git a/src/zenserver-test/zenserver-test.cpp b/src/zenserver-test/zenserver-test.cpp index 0e7c3c674..8c95835fd 100644 --- a/src/zenserver-test/zenserver-test.cpp +++ b/src/zenserver-test/zenserver-test.cpp @@ -346,7 +346,10 @@ TEST_CASE("default.single") uint64_t Elapsed = timer.GetElapsedTimeMs(); - ZEN_INFO("{} requests in {} ({})", RequestCount, zen::NiceTimeSpanMs(Elapsed), zen::NiceRate(RequestCount, (uint32_t)Elapsed, "req")); + ZEN_INFO("{} requests in {} ({})", + RequestCount.load(), + zen::NiceTimeSpanMs(Elapsed), + zen::NiceRate(RequestCount, (uint32_t)Elapsed, "req")); } TEST_CASE("multi.basic") @@ -397,7 +400,10 @@ TEST_CASE("multi.basic") uint64_t Elapsed = timer.GetElapsedTimeMs(); - ZEN_INFO("{} requests in {} ({})", RequestCount, zen::NiceTimeSpanMs(Elapsed), zen::NiceRate(RequestCount, (uint32_t)Elapsed, "req")); + ZEN_INFO("{} requests in {} ({})", + RequestCount.load(), + zen::NiceTimeSpanMs(Elapsed), + zen::NiceRate(RequestCount, (uint32_t)Elapsed, "req")); } TEST_CASE("project.basic") @@ -562,7 +568,10 @@ TEST_CASE("project.basic") const uint64_t Elapsed = timer.GetElapsedTimeMs(); - ZEN_INFO("{} requests in {} ({})", RequestCount, zen::NiceTimeSpanMs(Elapsed), zen::NiceRate(RequestCount, (uint32_t)Elapsed, "req")); + ZEN_INFO("{} requests in {} ({})", + RequestCount.load(), + zen::NiceTimeSpanMs(Elapsed), + zen::NiceRate(RequestCount, (uint32_t)Elapsed, "req")); } # if 0 // this is extremely WIP diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp index 03bbde10e..7c4097d4f 100644 --- a/src/zenserver/cache/httpstructuredcache.cpp +++ b/src/zenserver/cache/httpstructuredcache.cpp @@ -541,7 +541,8 @@ HttpStructuredCacheService::HandleDetailsRequest(HttpServerRequest& Request) Cbo.AddHash("rawhash", ValueIt.second.RawHash); } Cbo.AddString("contenttype", ToString(ValueIt.second.ContentType)); - Cbo.AddInteger("age", NowSeconds.count() - LastAccessedSeconds.count()); + Cbo.AddInteger("age", + gsl::narrow<uint64_t>(NowSeconds.count() - LastAccessedSeconds.count())); if (ValueIt.second.Attachments.size() > 0) { if (AttachmentDetails) diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index 4865f048b..3a91d7f0c 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -317,8 +317,8 @@ struct ProjectStore::OplogStorage : public RefCounted ZEN_INFO("Oplog replay completed in {} - Max LSN# {}, Next offset: {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs()), - m_MaxLsn, - m_NextOpsOffset); + m_MaxLsn.load(), + m_NextOpsOffset.load()); } void ReplayLog(const std::span<OplogEntryAddress> Entries, std::function<void(CbObject)>&& Handler) diff --git a/src/zenserver/xmake.lua b/src/zenserver/xmake.lua index ed589ae93..a2d02baae 100644 --- a/src/zenserver/xmake.lua +++ b/src/zenserver/xmake.lua @@ -44,10 +44,13 @@ target("zenserver") "vcpkg::lua", "vcpkg::mimalloc", "vcpkg::rocksdb", - "vcpkg::sentry-native", "vcpkg::sol2" ) + if has_config("zensentry") then + add_packages("vcpkg::sentry-native") + end + if is_plat("linux") then -- As sentry_native uses symbols from breakpad_client, the latter must -- be specified after the former with GCC-like toolchains. xmake however diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp index 6e636611d..d4a82231d 100644 --- a/src/zenserver/zenserver.cpp +++ b/src/zenserver/zenserver.cpp @@ -1173,7 +1173,7 @@ ZenEntryPoint::Run() ZEN_INFO( "Looks like there is already a process listening to this port {} (pid: {}), attaching owner pid {} to running instance", ServerOptions.BasePort, - Entry->Pid, + Entry->Pid.load(), ServerOptions.OwnerPid); Entry->AddSponsorProcess(ServerOptions.OwnerPid); @@ -1182,7 +1182,9 @@ ZenEntryPoint::Run() } else { - ZEN_WARN("Exiting since there is already a process listening to port {} (pid: {})", ServerOptions.BasePort, Entry->Pid); + ZEN_WARN("Exiting since there is already a process listening to port {} (pid: {})", + ServerOptions.BasePort, + Entry->Pid.load()); std::exit(1); } } diff --git a/src/zenstore/filecas.cpp b/src/zenstore/filecas.cpp index 70078ecb7..f641b899e 100644 --- a/src/zenstore/filecas.cpp +++ b/src/zenstore/filecas.cpp @@ -957,7 +957,7 @@ FileCasStrategy::CollectGarbage(GcContext& GcCtx) m_RootDirectory, NiceTimeSpanMs(TotalTimer.GetElapsedTimeMs()), DeletedCount, - ChunkCount, + ChunkCount.load(), NiceBytes(OldTotalSize - m_TotalSize.load(std::memory_order::relaxed)), NiceBytes(OldTotalSize)); }); diff --git a/src/zenutil/zenserverprocess.cpp b/src/zenutil/zenserverprocess.cpp index d1a91b93f..c939d3f39 100644 --- a/src/zenutil/zenserverprocess.cpp +++ b/src/zenutil/zenserverprocess.cpp @@ -301,7 +301,7 @@ ZenServerState::Sweep() { if (IsProcessRunning(Entry.Pid) == false) { - ZEN_DEBUG("Sweep - pid {} not running, reclaiming entry (port {})", Entry.Pid, Entry.DesiredListenPort); + ZEN_DEBUG("Sweep - pid {} not running, reclaiming entry (port {})", Entry.Pid.load(), Entry.DesiredListenPort.load()); Entry.Reset(); } |