libzarr
Header-only C++17 Zarr v2/v3, WASM-compatible
Loading...
Searching...
No Matches
Public Member Functions | List of all members
zarr::MemoryStore Class Referencefinal

#include <store.hpp>

Public Member Functions

std::optional< Bytesread (std::string_view key) override
 Full value at key, or std::nullopt if the key is absent.
 
void write (std::string_view key, Bytes value) override
 Create or replace the value at key.
 
std::optional< std::uint64_t > size (std::string_view key) override
 
bool exists (std::string_view key) override
 True if key holds a value.
 
void erase (std::string_view key) override
 Remove key; removing an absent key is a no-op.
 
std::vector< std::string > list_prefix (std::string_view prefix) override
 All keys starting with prefix ("" or ending in '/'), sorted.
 
DirListing list_dir (std::string_view prefix) override
 Immediate children under prefix ("" or ending in '/').
 
std::size_t key_count () const
 
- Public Member Functions inherited from zarr::Store
 Store (const Store &)=delete
 
Storeoperator= (const Store &)=delete
 
 Store (Store &&)=delete
 
Storeoperator= (Store &&)=delete
 
virtual std::optional< Bytesread_range (std::string_view key, ByteRange range)
 
virtual std::vector< std::optional< Bytes > > read_many (const std::vector< ReadRequest > &requests)
 
virtual void flush ()
 

Detailed Description

In-memory Store backed by a sorted map: the default store for tests, WASM builds, and assembling stores to be packed into archives.

Member Function Documentation

◆ erase()

void zarr::MemoryStore::erase ( std::string_view  key)
inlineoverridevirtual

Remove key; removing an absent key is a no-op.

Implements zarr::Store.

◆ exists()

bool zarr::MemoryStore::exists ( std::string_view  key)
inlineoverridevirtual

True if key holds a value.

Implements zarr::Store.

◆ key_count()

std::size_t zarr::MemoryStore::key_count ( ) const
inline

Number of keys held. (Named key_count, not size, to avoid colliding with Store::size(key), which returns a value's byte length.)

◆ list_dir()

DirListing zarr::MemoryStore::list_dir ( std::string_view  prefix)
inlineoverridevirtual

Immediate children under prefix ("" or ending in '/').

Implements zarr::Store.

◆ list_prefix()

std::vector< std::string > zarr::MemoryStore::list_prefix ( std::string_view  prefix)
inlineoverridevirtual

All keys starting with prefix ("" or ending in '/'), sorted.

Implements zarr::Store.

◆ read()

std::optional< Bytes > zarr::MemoryStore::read ( std::string_view  key)
inlineoverridevirtual

Full value at key, or std::nullopt if the key is absent.

Implements zarr::Store.

◆ size()

std::optional< std::uint64_t > zarr::MemoryStore::size ( std::string_view  key)
inlineoverridevirtual

Size in bytes of the value at key, or std::nullopt if absent. The default implementation reads the whole value; backends with cheap stat (files: fstat, HTTP: HEAD) should override.

Reimplemented from zarr::Store.

◆ write()

void zarr::MemoryStore::write ( std::string_view  key,
Bytes  value 
)
inlineoverridevirtual

Create or replace the value at key.

Implements zarr::Store.


The documentation for this class was generated from the following file: