userver
C++ Async Framework
Loading...
Searching...
No Matches
boost_uuid7.hpp
1
#
pragma
once
2
3
/// @file userver/utils/boost_uuid7s.hpp
4
/// @brief @copybrief utils::generators::GenerateBoostUuidV7()
5
6
#
include
<
chrono
>
7
8
#
include
<
boost
/
uuid
/
uuid
.
hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
utils
{
13
14
namespace
generators
{
15
16
/// @brief Generates UUIDv7
17
///
18
/// Uses 22-bit counter to ensure UUID's monotonicity in generated batches
19
/// or for the same timestamp and timestamp incrementation as
20
/// counter rollover handler.
21
///
22
/// See RFC for detailed info:
23
/// https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-7
24
/// https://datatracker.ietf.org/doc/html/rfc9562#monotonicity_counters
25
boost::uuids::uuid
GenerateBoostUuidV7
();
26
27
}
// namespace generators
28
29
/// @brief Extracts timestamp from UUIDv7
30
///
31
/// Returns point in time when uuid was generated.
32
///
33
/// @note Due to implementation details time point may be inaccurate:
34
/// - implementation uses coarse clock, which have milliseconds precision
35
/// (https://www.kernel.org/doc/html/latest/core-api/timekeeping.html)
36
/// - implementation may move timestamp forward in order to ensure monotonicity
37
/// of generated uuids
38
///
39
std::chrono::system_clock::time_point
ExtractTimestampFromUuidV7
(boost::uuids::uuid uuid);
40
41
}
// namespace utils
42
43
USERVER_NAMESPACE_END
userver
utils
boost_uuid7.hpp
Generated on Tue Nov 19 2024 11:34:18 for userver by
Doxygen
1.10.0