载入中...
搜索中...
未找到
Identity.cpp
浏览该文件的文档.
12 const bool alpha = (character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z');
19 return (first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z') || (first >= '0' && first <= '9');
38 if (separator == std::string_view::npos || text.find(':', separator + 1) != std::string_view::npos) {
48std::optional<LogicalId> LogicalId::fromParts(std::string_view namespaceName, std::string_view name) {
85std::optional<PersistentId> UuidV7Generator::generate(std::chrono::system_clock::time_point timestamp) const {
Strong identity values shared by persistence, content and logical-name APIs.
static std::optional< LogicalId > fromParts(std::string_view namespaceName, std::string_view name)
Builds a logical ID from separate namespace and name components.
Definition Identity.cpp:48
static std::optional< LogicalId > parse(std::string_view text)
Parses a scoped logical name.
Definition Identity.cpp:36
std::uint64_t hash() const noexcept
Returns a stable non-cryptographic hash for hash tables.
Definition Identity.cpp:68
std::string_view name() const noexcept
Returns the name component as a view into this object.
Definition Identity.cpp:63
std::string_view namespaceName() const noexcept
Returns the namespace component as a view into this object.
Definition Identity.cpp:58
std::optional< PersistentId > generate() const
Generates a UUIDv7 using the injected clock.
Definition Identity.cpp:80
UuidV7Generator(UuidEntropySource entropy, UuidClock clock={})
Creates a generator with an injected entropy source and optional clock.
Definition Identity.cpp:77
void assign(std::string_view text)
Assigns from canonical UUID text or from a legacy spelling.
Definition Identity.cpp:187
static UuidBytes projectLegacy(std::string_view text) noexcept
Builds the deterministic UUID projection of a legacy spelling.
Definition Identity.cpp:200
std::array< std::uint8_t, 16 > UuidBytes
Byte representation shared by every tagged 128-bit identity.
Definition Identity.h:54
std::string formatUuidBytes(const UuidBytes &bytes)
Formats UUID bytes as lower-case canonical 8-4-4-4-12 text.
Definition Identity.cpp:160
UuidBytes childUuidBytes(const UuidBytes &parent, std::string_view role) noexcept
Derives a deterministic child UUID from a parent and a role.
Definition Identity.cpp:172
std::optional< UuidBytes > parseUuidText(std::string_view text) noexcept
Parses canonical UUID text without knowing the domain tag.
Definition Identity.cpp:134
StrongUuid< detail::PersistentIdTag > PersistentId
Stable instance identity for persistence, networking and process boundaries.
Definition Identity.h:254
std::function< std::chrono::system_clock::time_point()> UuidClock
Clock callback used by the injectable UUIDv7 generator.
Definition Identity.h:469
std::function< bool(std::span< std::uint8_t > bytes)> UuidEntropySource
Entropy callback used by UUIDv7 generation.
Definition Identity.h:466
std::optional< PersistentId > generateUuidV7(std::chrono::system_clock::time_point timestamp, const UuidEntropySource &entropy)
Constructs a UUIDv7 without owning a clock or generator object.
Definition Identity.cpp:89
Definition Container.h:602