#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 driverTransaction 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);

Appends suffix to the path.

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.

Result<std::string> ToUrl() const;

Returns the URL representation if available.

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

DriverPtr driver;

Driver spec.

std::string path;

Path within the driver.

Transaction transaction = no_transaction;

Bound transaction to use for I/O.

Friend functions

friend bool operator==(const KvStoreaconst KvStoreb);
friend bool operator!=(const KvStoreaconst KvStoreb);

Checks if the driver, path, and transaction are identical.

friend Result<KvStore>
ApplyTensorStoreTransaction(KvStore storeTransaction transaction);

Changes to a new transaction.

type tensorstore::kvstore::DriverPtr;

Handle to an open kvstore driver.

using tensorstore::KvStore = kvstore::KvStore;

Convenience alias of kvstore::KvStore.

using tensorstore::kvstore::Key = std::string;

Key-value store key type.

using tensorstore::kvstore::Value = absl::Cord;

Key-value store value type.

struct tensorstore::kvstore::ReadResult;

Result of a Read operation.

struct tensorstore::kvstore::TransactionalReadOptions;

Read options for transactional reads.

Future<KvStore>
tensorstore::kvstore::Open(Spec specOpenOptions&options);
Future<KvStore> tensorstore::kvstore::Open(::nlohmann::json json_spec,
                                           
OpenOptions&options);
static Future<KvStore>
tensorstore::kvstore::Open(Spec specOption&&... option);
static Future<KvStore>
tensorstore::kvstore::Open(::nlohmann::json jOption&&... option);

Opens a KvStore based on an already-parsed kvstore::Spec and an optional sequence of options.

Future<ReadResult>
tensorstore::kvstore::Read(const KvStorestore,
                           
std::string_view key,
                           
ReadOptions options = {});

Attempts to read the value for the key store.path + key.

Future<TimestampedStorageGeneration>
tensorstore::kvstore::Write(const KvStorestore,
                            
std::string_view key,
                            
std::optional<Value> value,
                            
WriteOptions options = {});
Future<TimestampedStorageGeneration>
tensorstore::kvstore::WriteCommitted(const KvStorestore,
                                     
std::string_view key,
                                     
std::optional<Value> value,
                                     
WriteOptions options = {});

Performs an optionally-conditional write.

Future<TimestampedStorageGeneration>
tensorstore::kvstore::Delete(const KvStorestore,
                             
std::string_view key,
                             
WriteOptions options = {});
Future<TimestampedStorageGeneration>
tensorstore::kvstore::DeleteCommitted(const KvStorestore,
                                      
std::string_view key,
                                      
WriteOptions options = {});

Performs an optionally-conditional delete.

Future<const void>
tensorstore::kvstore::DeleteRange(const KvStorestore,
                                  
KeyRange range);

Deletes all keys in the specified range.

Future<const void> tensorstore::kvstore::ExperimentalCopyRange(
    
const KvStoresource,
    
const KvStoretarget,
    
CopyRangeOptions options = {});

Copies a range from source to target.

Future<std::vector<ListEntry>>
tensorstore::kvstore::ListFuture(const KvStorestore,
                                 
ListOptions options = {});

Lists the keys in a kvstore.