|
libzarr
Header-only C++17 Zarr v2/v3, WASM-compatible
|
#include <store.hpp>
Public Member Functions | |
| Store (const Store &)=delete | |
| Store & | operator= (const Store &)=delete |
| Store (Store &&)=delete | |
| Store & | operator= (Store &&)=delete |
| virtual std::optional< Bytes > | read (std::string_view key)=0 |
Full value at key, or std::nullopt if the key is absent. | |
| virtual std::optional< Bytes > | read_range (std::string_view key, ByteRange range) |
| virtual std::optional< std::uint64_t > | size (std::string_view key) |
| virtual std::vector< std::optional< Bytes > > | read_many (const std::vector< ReadRequest > &requests) |
| virtual void | write (std::string_view key, Bytes value)=0 |
Create or replace the value at key. | |
| virtual bool | exists (std::string_view key)=0 |
True if key holds a value. | |
| virtual void | erase (std::string_view key)=0 |
Remove key; removing an absent key is a no-op. | |
| virtual void | flush () |
| virtual std::vector< std::string > | list_prefix (std::string_view prefix)=0 |
All keys starting with prefix ("" or ending in '/'), sorted. | |
| virtual DirListing | list_dir (std::string_view prefix)=0 |
Immediate children under prefix ("" or ending in '/'). | |
Abstract key->bytes store. All array and metadata logic in libzarr is written against this interface; backends supply bytes from memory, files, ZIP archives, HTTP range requests, ...
The core is single-threaded by design; implementations are not required to be thread-safe.
|
pure virtual |
Remove key; removing an absent key is a no-op.
Implemented in zarr::FilesystemStore, zarr::MemoryStore, and zarr::ZipStore.
|
pure virtual |
True if key holds a value.
Implemented in zarr::FilesystemStore, zarr::MemoryStore, and zarr::ZipStore.
|
inlinevirtual |
Completes any buffered writes. Plain stores write through and need nothing; adapters that assemble objects (sharding) override.
|
pure virtual |
Immediate children under prefix ("" or ending in '/').
Implemented in zarr::FilesystemStore, zarr::MemoryStore, and zarr::ZipStore.
|
pure virtual |
All keys starting with prefix ("" or ending in '/'), sorted.
Implemented in zarr::FilesystemStore, zarr::MemoryStore, and zarr::ZipStore.
|
pure virtual |
Full value at key, or std::nullopt if the key is absent.
Implemented in zarr::FilesystemStore, zarr::MemoryStore, and zarr::ZipStore.
|
inlinevirtual |
Reads several ranges in one call, order-preserving: result[i] is the value for requests[i], or std::nullopt if that key is absent. The default implementation loops over read_range; backends whose I/O has per-request latency (HTTP, object stores) should override to issue the requests concurrently or as coalesced multi-range reads, cutting round trips. Still synchronous: it returns only once every range is resolved.
|
inlinevirtual |
Part of the value at key: std::nullopt if the key is absent, throws zarr::error if the range lies outside the value. The default implementation reads the full value and slices it; backends with native range reads (files, HTTP) should override.
Reimplemented in zarr::FilesystemStore, and zarr::ZipStore.
|
inlinevirtual |
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 in zarr::FilesystemStore, zarr::MemoryStore, and zarr::ZipStore.
|
pure virtual |
Create or replace the value at key.
Implemented in zarr::FilesystemStore, zarr::MemoryStore, and zarr::ZipStore.