| 70 | } |
| 71 | |
| 72 | ThreadFuture<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 | |
| 90 | ThreadFuture<Key> DLTransaction::getKey(const KeySelectorRef& key, bool snapshot) { |
| 91 | FdbCApi::FDBFuture* f = |
nothing calls this directly
no test coverage detected