MCPcopy Create free account
hub / github.com/apple/foundationdb / get

Method get

fdbclient/MultiVersionTransaction.actor.cpp:72–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72ThreadFuture<Optional<Value>> DLTransaction::get(const KeyRef& key, bool snapshot) {
73 FdbCApi::FDBFuture* f = api->transactionGet(tr, key.begin(), key.size(), snapshot);
74
75 return toThreadFuture<Optional<Value>>(api, f, [](FdbCApi::FDBFuture* f, FdbCApi* api) {
76 FdbCApi::fdb_bool_t present;
77 const uint8_t* value;
78 int valueLength;
79 FdbCApi::fdb_error_t error = api->futureGetValue(f, &present, &value, &valueLength);
80 ASSERT(!error);
81 if (present) {
82 // The memory for this is stored in the FDBFuture and is released when the future gets destroyed
83 return Optional<Value>(Value(ValueRef(value, valueLength), Arena()));
84 } else {
85 return Optional<Value>();
86 }
87 });
88}
89
90ThreadFuture<Key> DLTransaction::getKey(const KeySelectorRef& key, bool snapshot) {
91 FdbCApi::FDBFuture* f =

Callers

nothing calls this directly

Calls 8

ValueRefClass · 0.85
getTransactionFunction · 0.85
abortableFutureFunction · 0.85
getMethod · 0.65
ValueEnum · 0.50
ArenaClass · 0.50
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected