-
#include "tensorstore/kvstore/kvstore.h"
- class tensorstore::kvstore::KvStore;
Combines a
DriverPtr
with a string path that serves as a key prefix, and an optional transaction.Constructors¶
- KvStore();
Constructs an invalid (null) kvstore.
- KvStore(DriverPtr driver);
- explicit KvStore(DriverPtr driver, Transaction transaction);
-
explicit KvStore(DriverPtr driver,
std::string path,
Transaction transaction = no_transaction); Constructs from a driver, and optional path and transaction.
Methods¶
- void AppendSuffix(std::string_view suffix);
- void AppendPathComponent(std::string_view component);
Joins a ‘/’-separated path component to the end
path
.
- bool valid() const;
Returns
true
if this is a valid (non-null) kvstore.
- Result<Spec> spec(Option&&... option) const;
- Result<Spec> spec(SpecRequestOptions&& options) const;
Returns a Spec that can be used to re-open this
KvStore
.
- KvStore non_transactional() const&;
- KvStore non_transactional() &&;
Returns the corresponding non-transactional
KvStore
.
- Result<KvStore> base() const;
Returns the underlying
KvStore
if this is an adapter, such as OCDBT or neuroglancer_uint64_sharded. Otherwise returns a null kvstore.
-
PipelineResultType<const KvStore&, Func>
operator|(Func&& func) const&; - PipelineResultType<KvStore&&, Func> operator|(Func&& func) &&;
“Pipeline” operator.
Data members¶
- Transaction transaction = no_transaction;
Bound transaction to use for I/O.
Friend functions¶
- friend bool operator==(const KvStore& a, const KvStore& b);
- friend bool operator!=(const KvStore& a, const KvStore& b);
Checks if the
driver
,path
, andtransaction
are identical.
-
friend Result<KvStore>
ApplyTensorStoreTransaction(KvStore store, Transaction transaction); Changes to a new transaction.
Related Types¶
- type tensorstore::kvstore::DriverPtr;
Handle to an open kvstore driver.
- struct tensorstore::kvstore::ReadResult;
Result of a
Read
operation.
- struct tensorstore::kvstore::TransactionalReadOptions;
Read options for transactional reads.
Related Functions¶
-
Future<KvStore>
tensorstore::kvstore::Open(Spec spec, OpenOptions&& options); -
Future<KvStore> tensorstore::kvstore::Open(::nlohmann::json json_spec,
OpenOptions&& options); -
static Future<KvStore>
tensorstore::kvstore::Open(Spec spec, Option&&... option); -
static Future<KvStore>
tensorstore::kvstore::Open(::nlohmann::json j, Option&&... option); Opens a
KvStore
based on an already-parsedkvstore::Spec
and an optional sequence of options.
-
Future<ReadResult>
tensorstore::kvstore::Read(const KvStore& store,
std::string_view key,
ReadOptions options = {});
-
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.
-
Future<TimestampedStorageGeneration>
tensorstore::kvstore::Delete(const KvStore& store,
std::string_view key,
WriteOptions options = {}); -
Future<TimestampedStorageGeneration>
tensorstore::kvstore::DeleteCommitted(const KvStore& store,
std::string_view key,
WriteOptions options = {}); Performs an optionally-conditional delete.
-
Future<const void>
tensorstore::kvstore::DeleteRange(const KvStore& store,
KeyRange range); Deletes all keys in the specified range.
-
Future<const void> tensorstore::kvstore::ExperimentalCopyRange(
const KvStore& source,
const KvStore& target,
CopyRangeOptions options = {});
-
Future<std::vector<ListEntry>>
tensorstore::kvstore::ListFuture(const KvStore& store,
ListOptions options = {}); Lists the keys in a kvstore.