userver: userver/utils/statistics/entry.hpp Source File
Loading...
Searching...
No Matches
entry.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/utils/statistics/entry.hpp
4/// @brief Header with all the types required in component header to use
5/// statistics (includes utils::statistics::Entry and forward declarations).
6
7#include <userver/utils/fast_pimpl.hpp>
8#include <userver/utils/statistics/fwd.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace utils::statistics {
13
14namespace impl {
15enum class UnregisteringKind { kManual, kAutomatic };
16}
17
18/// @brief Statistics registration holder, used to unregister a metric source
19/// before it is destroyed.
20///
21/// See utils::statistics::Storage for info on registrations
22class [[nodiscard]] Entry final {
23public:
24 Entry();
25
26 Entry(const Entry& other) = delete;
27 Entry& operator=(const Entry& other) = delete;
28 Entry(Entry&& other) noexcept;
29 Entry& operator=(Entry&& other) noexcept;
30 ~Entry();
31
32 void Unregister() noexcept;
33
34private:
35 struct Impl;
36
37 friend class Storage; // in RegisterExtender()
38
39 explicit Entry(const Impl& impl) noexcept;
40
41 utils::FastPimpl<Impl, 16, 8> impl_;
42};
43
44} // namespace utils::statistics
45
46USERVER_NAMESPACE_END