diff options
| author | Per Larsson <[email protected]> | 2021-10-01 13:29:02 +0200 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-10-01 13:29:02 +0200 |
| commit | 82a032af24dfefa508c384536e6b5b7dbe65ccb8 (patch) | |
| tree | df19f51bc87532061fe3f2c918722f47abaca86c /zenserver/upstream/upstreamcache.h | |
| parent | Added upstream cache perf metrics. (diff) | |
| download | zen-82a032af24dfefa508c384536e6b5b7dbe65ccb8.tar.xz zen-82a032af24dfefa508c384536e6b5b7dbe65ccb8.zip | |
Improved error handling for upstream endpoints.
Diffstat (limited to 'zenserver/upstream/upstreamcache.h')
| -rw-r--r-- | zenserver/upstream/upstreamcache.h | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/zenserver/upstream/upstreamcache.h b/zenserver/upstream/upstreamcache.h index a6b1e9784..08f379b11 100644 --- a/zenserver/upstream/upstreamcache.h +++ b/zenserver/upstream/upstreamcache.h @@ -45,35 +45,29 @@ struct UpstreamCacheOptions bool StatsEnabled = false; }; -enum class UpstreamStatusCode : uint8_t -{ - Ok, - Error -}; - struct UpstreamError { - UpstreamStatusCode StatusCode = UpstreamStatusCode::Ok; - std::string Reason; + int32_t ErrorCode{}; + std::string Reason{}; - explicit operator bool() const { return StatusCode != UpstreamStatusCode::Ok; } + explicit operator bool() const { return ErrorCode != 0; } }; struct GetUpstreamCacheResult { IoBuffer Value; - UpstreamError Error; - int64_t Bytes = {}; - double ElapsedSeconds = {}; - bool Success = false; + UpstreamError Error{}; + int64_t Bytes{}; + double ElapsedSeconds{}; + bool Success = false; }; struct PutUpstreamCacheResult { std::string Reason; - int64_t Bytes = {}; - double ElapsedSeconds = {}; - bool Success = false; + int64_t Bytes{}; + double ElapsedSeconds{}; + bool Success = false; }; struct UpstreamEndpointHealth @@ -84,14 +78,14 @@ struct UpstreamEndpointHealth struct UpstreamEndpointStats { - std::atomic_uint64_t HitCount = {}; - std::atomic_uint64_t MissCount = {}; - std::atomic_uint64_t UpCount = {}; - std::atomic_uint64_t ErrorCount = {}; - std::atomic<double> UpBytes = {}; - std::atomic<double> DownBytes = {}; - std::atomic<double> SecondsUp = {}; - std::atomic<double> SecondsDown = {}; + std::atomic_uint64_t HitCount{}; + std::atomic_uint64_t MissCount{}; + std::atomic_uint64_t UpCount{}; + std::atomic_uint64_t ErrorCount{}; + std::atomic<double> UpBytes{}; + std::atomic<double> DownBytes{}; + std::atomic<double> SecondsUp{}; + std::atomic<double> SecondsDown{}; }; /** |