-
#include "tensorstore/kvstore/operations.h"
-
Future<TimestampedStorageGeneration>
tensorstore::kvstore::Write(const KvStore& store,
std::string_view key,
std::optional<Value> value,
WriteOptions options = {}); -
Future<TimestampedStorageGeneration>
tensorstore::kvstore::WriteCommitted(const KvStore& store,
std::string_view key,
std::optional<Value> value,
WriteOptions options = {}); Performs an optionally-conditional write.
Atomically updates or deletes the value stored for
store.path + key
subject to the conditions specified inoptions
.WriteCommitted
behaves the same asWrite
for non-transactional writes. For transactional writes, the future returned byWriteCommitted
becomes ready only once the transaction is committed or aborted, and if the write is successful, contains the actualTimestampedStorageGeneration
; in contrast, the future returned byWrite
becomes ready immediately to reflect the fact that the value can immediately be read back in the context of the transaction.- Parameters:¶
- const KvStore &store¶
KvStore
into which to perform the write operation.- std::string_view key¶
The key to write or delete, interpreted as a suffix to be appended to
store.path
.- std::optional<Value> value¶
The value to write, or
std::nullopt
to delete.- WriteOptions options = {}¶
Specifies options for writing.
- Returns:¶
A Future that resolves to the generation corresponding to the new value on success, or to
StorageGeneration::Unknown()
if the conditions inoptions
are not satisfied.
Related Types¶
- struct tensorstore::kvstore::WriteGenerationConditions;
Conditions on the existing generation for write operations.
- struct tensorstore::kvstore::WriteOptions;
Options for
Write
.