MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / uuid

Method uuid

src/geode/basic/uuid.cpp:240–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238namespace geode
239{
240 uuid::uuid()
241 {
242 static constexpr index_t MAX_SAFETY_COUNT = 1000;
243 static constexpr absl::Duration INITIAL_SLEEP =
244 absl::Microseconds( 100 );
245 static constexpr absl::Duration MAX_SLEEP = absl::Milliseconds( 50 );
246 UUIDv7Generator gen;
247 bool generated{ false };
248 auto sleep = INITIAL_SLEEP;
249 for( const auto i : Range{ MAX_SAFETY_COUNT } )
250 {
251 geode_unused( i );
252 if( auto bytes = gen.generate() )
253 {
254 bytes_ = bytes.value();
255 generated = true;
256 break;
257 }
258 absl::SleepFor( sleep );
259 sleep = std::min( sleep * 2., MAX_SLEEP );
260 }
261 OpenGeodeBasicException::check_exception( generated, nullptr,
262 OpenGeodeException::TYPE::internal,
263 "[uuid] could not generate uuid" );
264 }
265
266 uuid::uuid( std::string_view string )
267 {

Callers 1

test-py-uuid.pyFile · 0.80

Calls 5

geode_unusedFunction · 0.85
to_stringFunction · 0.85
generateMethod · 0.80
valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected