API Reference#
db#
- Author
Ashot Vardanian
- Date
26 Jun 2022
-
namespace unum#
-
namespace ustore#
-
-
struct collections_list_t#
- #include <db.hpp>
-
class context_t : public std::enable_shared_from_this<context_t>#
- #include <db.hpp>
A DBMS client for a single thread.
May be used not only as a consistency warrant, but also a performance optimization, as batched writes will be stored in a DB-optimal way until being commited, which reduces the preprocessing overhead for DB.
See also
Public Functions
-
inline context_t() noexcept#
-
inline context_t(ustore_database_t db, ustore_transaction_t txn = nullptr, ustore_snapshot_t snap = {}) noexcept#
-
inline ~context_t() noexcept#
-
inline ustore_database_t db() const noexcept#
-
inline ustore_transaction_t txn() const noexcept#
-
inline ustore_snapshot_t snap() const noexcept#
-
inline operator ustore_transaction_t() const noexcept#
-
inline void set_snapshot(ustore_snapshot_t snap) noexcept#
-
inline blobs_ref_gt<places_arg_t> operator[](strided_range_gt<collection_key_t const> collections_and_keys) noexcept#
-
inline blobs_ref_gt<places_arg_t> operator[](strided_range_gt<collection_key_field_t const> collections_and_keys) noexcept#
-
inline blobs_ref_gt<places_arg_t> operator[](keys_view_t keys) noexcept#
-
template<typename keys_arg_at>
inline blobs_ref_gt<keys_arg_at> operator[](keys_arg_at &&keys) noexcept#
-
inline expected_gt<blobs_collection_t> operator[](ustore_str_view_t name) noexcept#
-
template<typename collection_at = blobs_collection_t>
inline collection_at main() noexcept#
-
inline expected_gt<collections_list_t> collections() noexcept#
-
inline expected_gt<snapshots_list_t> snapshots() noexcept#
-
inline expected_gt<bool> contains(std::string_view name) noexcept#
-
template<typename collection_at = blobs_collection_t>
inline expected_gt<collection_at> find(std::string_view name = {}) noexcept# Provides a view of a single collection synchronized with the transaction.
- Template Parameters:
collection_at – Can be a
blobs_collection_t
,docs_collection_t
,graph_collection_t
.
-
inline status_t reset() noexcept#
Clears the stare of transaction, preserving the underlying memory, cleaning it, and labeling it with a new “sequence number” or “generation”.
- Parameters:
snapshot – Controls whether a consistent view of the entirety of DB must be created for this transaction. Is required for long-running analytical tasks with strong consistency requirements.
-
inline status_t commit(bool flush = false) noexcept#
Attempts to commit all the updates to the DB. Fails if any single one of the updates fails.
-
inline expected_gt<ustore_sequence_number_t> sequenced_commit(bool flush = false) noexcept#
-
inline status_t export_to(ustore_str_view_t path) noexcept#
Exports the snapshot as a new database into the specified path.
Protected Attributes
-
ustore_database_t db_ = {nullptr}#
-
ustore_transaction_t txn_ = {nullptr}#
-
ustore_snapshot_t snap_ = {}#
-
inline context_t() noexcept#
-
class database_t : public std::enable_shared_from_this<database_t>#
- #include <db.hpp>
DataBase is a “collection of named collections”, essentially a transactional map<string,map<id,string>>. Or in Python terms: dict[str,dict[int,str]].
Public Functions
-
database_t() = default#
-
database_t(database_t const&) = delete#
-
inline database_t(database_t &&other) noexcept#
-
inline operator ustore_database_t() const noexcept#
-
inline status_t open(ustore_str_view_t config = nullptr) noexcept#
-
inline void close() noexcept#
-
inline ~database_t() noexcept#
-
inline bool supports_named_collections()#
-
inline bool supports_transactions()#
-
inline bool supports_snapshots()#
-
inline expected_gt<context_t> transact() noexcept#
-
inline expected_gt<context_t> snapshot() noexcept#
-
inline status_t drop_snapshot(ustore_snapshot_t id) noexcept#
-
template<typename collection_at = blobs_collection_t>
inline collection_at main() noexcept#
-
inline operator blobs_collection_t() noexcept#
-
inline expected_gt<blobs_collection_t> operator[](ustore_str_view_t name) noexcept#
-
inline expected_gt<bool> contains(std::string_view name) noexcept#
-
template<typename collection_at = blobs_collection_t>
inline expected_gt<collection_at> create(ustore_str_view_t name, ustore_str_view_t config = "") noexcept#
-
template<typename collection_at = blobs_collection_t>
inline expected_gt<collection_at> find(std::string_view name = {}) noexcept#
-
template<typename collection_at = blobs_collection_t>
inline expected_gt<collection_at> find_or_create(ustore_str_view_t name) noexcept#
Private Functions
-
inline ustore_metadata_t get_metadata()#
Private Members
-
ustore_database_t db_ = nullptr#
-
database_t() = default#
-
struct collections_list_t#
-
namespace ustore#
ustore#
- Author
Ashot Vardanian
- Date
26 Jun 2022
blobs_collection#
- Author
Ashot Vardanian
- Date
26 Jun 2022
-
namespace unum
-
namespace ustore
-
class blobs_collection_t#
- #include <blobs_collection.hpp>
Collection is persistent associative container, essentially a transactional map<id,string>. Or in Python terms: dict[int,bytes].
Generally cheap to construct. Can address both collections “HEAD” state, as well as some “snapshot”/”transaction” view.
Public Functions
-
inline blobs_collection_t() noexcept#
-
inline blobs_collection_t(ustore_database_t db_ptr, ustore_collection_t collection = ustore_collection_main_k, ustore_transaction_t txn = nullptr, ustore_snapshot_t snap = {}, ustore_arena_t *arena = nullptr) noexcept#
-
inline blobs_collection_t(blobs_collection_t &&other) noexcept#
-
inline blobs_collection_t &operator=(blobs_collection_t &&other) noexcept#
-
inline blobs_collection_t(blobs_collection_t const &other) noexcept#
-
inline blobs_collection_t &operator=(blobs_collection_t const &other) noexcept#
-
inline operator ustore_collection_t() const noexcept#
-
inline ustore_collection_t *member_ptr() noexcept#
-
inline ustore_arena_t *member_arena() noexcept#
-
inline ustore_database_t db() const noexcept#
-
inline ustore_transaction_t txn() const noexcept#
-
inline ustore_snapshot_t snap() const noexcept#
-
inline blobs_range_t members(ustore_key_t min_key = std::numeric_limits<ustore_key_t>::min(), ustore_key_t max_key = std::numeric_limits<ustore_key_t>::max()) const noexcept#
-
inline keys_range_t keys(ustore_key_t min_key = std::numeric_limits<ustore_key_t>::min(), ustore_key_t max_key = std::numeric_limits<ustore_key_t>::max()) const noexcept#
-
inline pairs_range_t items(ustore_key_t min_key = std::numeric_limits<ustore_key_t>::min(), ustore_key_t max_key = std::numeric_limits<ustore_key_t>::max()) const noexcept#
-
inline expected_gt<size_range_t> size_range() const noexcept#
-
inline pairs_stream_t begin() const noexcept(false)#
-
inline pairs_stream_t end() const noexcept(false)#
-
inline blobs_ref_gt<places_arg_t> operator[](std::initializer_list<ustore_key_t> keys) noexcept#
-
inline blobs_ref_gt<places_arg_t> at(std::initializer_list<ustore_key_t> keys) noexcept#
-
inline blobs_ref_gt<places_arg_t> operator[](keys_view_t keys) noexcept#
-
inline blobs_ref_gt<places_arg_t> at(keys_view_t keys) noexcept#
-
template<typename keys_arg_at>
inline auto operator[](keys_arg_at &&keys) noexcept#
-
template<typename keys_arg_at>
inline auto at(keys_arg_at &&keys) noexcept#
Private Members
-
ustore_database_t db_ = {nullptr}#
-
ustore_collection_t collection_ = {ustore_collection_main_k}#
-
ustore_transaction_t txn_ = {nullptr}#
-
ustore_snapshot_t snap_ = {}#
-
any_arena_t arena_ = {nullptr}#
-
inline blobs_collection_t() noexcept#
-
class blobs_collection_t#
-
namespace ustore
blobs_join#
- Author
Ashot Vardanian
- Date
26 Jun 2022
-
namespace unum
-
namespace ustore
-
struct keys_join_stream_t#
- #include <blobs_join.hpp>
Implements multi-way set intersection to join entities from different collections, that have matching identifiers.
Implementation-wise, scans the smallest collection and batch-selects in others.
Public Members
-
ustore_database_t db = {nullptr}#
-
ustore_transaction_t txn = {nullptr}#
-
ustore_arena_t *arena = {nullptr}#
-
strided_range_gt<ustore_collection_t const> collections#
-
ustore_key_t next_min_key_ = {0}#
-
ustore_size_t window_size_ = {0}#
-
strided_range_gt<ustore_key_t*> fetched_keys_#
-
strided_range_gt<ustore_length_t> fetched_lengths#
-
ustore_database_t db = {nullptr}#
-
struct keys_join_stream_t#
-
namespace ustore
blobs_range#
- Author
Ashot Vardanian
- Date
26 Jun 2022
-
namespace unum
-
namespace ustore
-
class keys_stream_t#
- #include <blobs_range.hpp>
Iterator (almost) over the keys in a single collection.
Manages it’s own memory and may be expressive to construct. Prefer to
seek
, instead of re-creating such a stream. Unlike classical iterators, keeps an internal state, which makes it non copy-constructible!Public Types
-
using value_type = ustore_key_t#
-
using pointer = ustore_key_t*#
-
using reference = ustore_key_t&#
Public Functions
-
inline keys_stream_t(ustore_database_t db, ustore_collection_t collection = ustore_collection_main_k, std::size_t read_ahead = keys_stream_t::default_read_ahead_k, ustore_transaction_t txn = nullptr) noexcept#
-
keys_stream_t(keys_stream_t&&) = default#
-
keys_stream_t &operator=(keys_stream_t&&) = default#
-
keys_stream_t(keys_stream_t const&) = delete#
-
keys_stream_t &operator=(keys_stream_t const&) = delete#
-
inline status_t seek(ustore_key_t key) noexcept#
-
inline keys_stream_t &operator++() noexcept#
! Unlike the
advance()
, canonically returns a self-reference, ! meaning that the error must be propagated in a different way. ! So we promote this iterator toend()
, once an error occurs.
-
inline ustore_key_t key() const noexcept#
-
inline ustore_key_t operator*() const noexcept#
-
inline ptr_range_gt<ustore_key_t const> keys_batch() noexcept#
Exposes all the fetched keys at once, including the passed ones. Should be used with
seek_to_next_batch
. Nextadvance
will do the same.
-
inline bool is_end() const noexcept#
-
inline bool operator==(keys_stream_t const &other) const noexcept#
-
inline bool operator!=(keys_stream_t const &other) const noexcept#
Private Members
-
ustore_database_t db_ = {nullptr}#
-
ustore_collection_t collection_ = {ustore_collection_main_k}#
-
ustore_transaction_t txn_ = {nullptr}#
-
ustore_length_t read_ahead_ = {0}#
-
ustore_key_t next_min_key_ = {std::numeric_limits<ustore_key_t>::min()}#
-
ptr_range_gt<ustore_key_t> fetched_keys_ = {}#
-
using value_type = ustore_key_t#
-
class pairs_stream_t#
- #include <blobs_range.hpp>
Public Types
-
using value_type = std::pair<ustore_key_t, value_view_t>#
Public Functions
-
inline pairs_stream_t(ustore_database_t db, ustore_collection_t collection = ustore_collection_main_k, std::size_t read_ahead = pairs_stream_t::default_read_ahead_k, ustore_transaction_t txn = nullptr) noexcept#
-
pairs_stream_t(pairs_stream_t&&) = default#
-
pairs_stream_t &operator=(pairs_stream_t&&) = default#
-
pairs_stream_t(pairs_stream_t const&) = delete#
-
pairs_stream_t &operator=(pairs_stream_t const&) = delete#
-
inline status_t seek(ustore_key_t key) noexcept#
-
inline pairs_stream_t &operator++() noexcept#
! Unlike the
advance()
, canonically returns a self-reference, ! meaning that the error must be propagated in a different way. ! So we promote this iterator toend()
, once an error occurs.
-
inline ustore_key_t key() const noexcept#
-
inline value_view_t value() const noexcept#
-
inline value_type item() const noexcept#
-
inline value_type operator*() const noexcept#
-
inline ptr_range_gt<ustore_key_t const> keys_batch() noexcept#
Exposes all the fetched keys at once, including the passed ones. Should be used with
seek_to_next_batch
. Nextadvance
will do the same.
-
inline bool is_end() const noexcept#
-
inline bool operator==(pairs_stream_t const &other) const noexcept#
-
inline bool operator!=(pairs_stream_t const &other) const noexcept#
Private Members
-
ustore_database_t db_ = {nullptr}#
-
ustore_collection_t collection_ = {ustore_collection_main_k}#
-
ustore_transaction_t txn_ = {nullptr}#
-
ustore_length_t read_ahead_ = {0}#
-
ustore_key_t next_min_key_ = {std::numeric_limits<ustore_key_t>::min()}#
-
ptr_range_gt<ustore_key_t> fetched_keys_ = {}#
-
joined_blobs_t values_view_ = {}#
-
joined_blobs_iterator_t values_iterator_ = {}#
-
using value_type = std::pair<ustore_key_t, value_view_t>#
-
struct size_range_t#
- #include <blobs_range.hpp>
-
struct size_estimates_t#
- #include <blobs_range.hpp>
-
class blobs_range_t#
- #include <blobs_range.hpp>
Slice of keys or key-value-pairs stored in a single collection. In Python terms: dict().items() or dict().keys(). Supports C++ range-based loops:
for (auto key : @b collection.items())
It can also be use for loose cardinality and disk-usage estimates.Public Functions
-
inline blobs_range_t(ustore_database_t db, ustore_transaction_t txn = nullptr, ustore_snapshot_t snap = 0, ustore_collection_t collection = ustore_collection_main_k, ustore_key_t min_key = std::numeric_limits<ustore_key_t>::min(), ustore_key_t max_key = std::numeric_limits<ustore_key_t>::max()) noexcept#
-
blobs_range_t(blobs_range_t&&) = default#
-
blobs_range_t &operator=(blobs_range_t&&) = default#
-
blobs_range_t(blobs_range_t const&) = default#
-
blobs_range_t &operator=(blobs_range_t const&) = default#
-
inline ustore_database_t db() const noexcept#
-
inline ustore_transaction_t txn() const noexcept#
-
inline ustore_snapshot_t snap() const noexcept#
-
inline ustore_collection_t collection() const noexcept#
-
inline expected_gt<keys_stream_t> keys_begin(std::size_t read_ahead = keys_stream_t::default_read_ahead_k) noexcept#
-
inline expected_gt<keys_stream_t> keys_end() noexcept#
-
inline expected_gt<pairs_stream_t> pairs_begin(std::size_t read_ahead = pairs_stream_t::default_read_ahead_k) noexcept#
-
inline expected_gt<pairs_stream_t> pairs_end() noexcept#
-
inline expected_gt<size_estimates_t> size_estimates() noexcept#
-
inline blobs_range_t &since(ustore_key_t min_key) noexcept#
-
inline blobs_range_t &until(ustore_key_t max_key) noexcept#
-
inline ustore_key_t min_key() noexcept#
-
inline ustore_key_t max_key() noexcept#
Private Functions
-
template<typename stream_at>
inline expected_gt<stream_at> make_stream(ustore_key_t target, std::size_t read_ahead = keys_stream_t::default_read_ahead_k) noexcept#
Private Members
-
ustore_snapshot_t snap_#
-
ustore_collection_t collection_#
-
ustore_key_t min_key_#
-
ustore_key_t max_key_#
-
inline blobs_range_t(ustore_database_t db, ustore_transaction_t txn = nullptr, ustore_snapshot_t snap = 0, ustore_collection_t collection = ustore_collection_main_k, ustore_key_t min_key = std::numeric_limits<ustore_key_t>::min(), ustore_key_t max_key = std::numeric_limits<ustore_key_t>::max()) noexcept#
-
struct keys_range_t#
- #include <blobs_range.hpp>
Public Functions
-
inline keys_stream_t begin() noexcept(false)#
-
inline keys_stream_t end() noexcept(false)#
-
inline expected_gt<sample_t> sample(std::size_t count, ustore_arena_t *arena) noexcept#
Public Members
-
blobs_range_t members#
-
inline keys_stream_t begin() noexcept(false)#
-
struct pairs_range_t#
- #include <blobs_range.hpp>
Public Types
-
using iterator_type = pairs_stream_t#
Public Functions
-
inline pairs_stream_t begin() noexcept(false)#
-
inline pairs_stream_t end() noexcept(false)#
Public Members
-
blobs_range_t members#
-
using iterator_type = pairs_stream_t#
-
class keys_stream_t#
-
namespace ustore
blobs_ref#
- Author
Ashot Vardanian
- Date
26 Jun 2022
-
namespace unum
-
namespace ustore
-
template<typename locations_at>
class blobs_ref_gt# - #include <blobs_ref.hpp>
A proxy object, that allows both lookups and writes with
[]
and assignment operators for a batch of keys simultaneously.Following assignment combinations are possible:
one value to many keys
many values to many keys
one value to one key The only impossible combination is assigning many values to one key.
- Template Parameters:
locations_at – Type describing the address of a value in DBMS.
(ustore_collection_t?, ustore_key_t, ustore_field_t?): Single KV-pair location.
(ustore_collection_t*, ustore_key_t*, ustore_field_t*): Externally owned range of keys.
(ustore_collection_t[x], ustore_key_t[x], ustore_field_t[x]): On-stack array of addresses.
Public Types
-
using locations_store_t = location_store_gt<locations_at>#
-
using locations_plain_t = typename locations_store_t::plain_t#
-
using keys_extractor_t = places_arg_extractor_gt<locations_plain_t>#
-
using value_t = std::conditional_t<is_one_k, value_view_t, embedded_blobs_t>#
-
using present_t = std::conditional_t<is_one_k, bool, bits_span_t>#
-
using length_t = std::conditional_t<is_one_k, ustore_length_t, ptr_range_gt<ustore_length_t>>#
Public Functions
-
inline blobs_ref_gt(ustore_database_t db, ustore_transaction_t txn, ustore_snapshot_t snap, locations_at &&locations, ustore_arena_t *arena) noexcept#
-
blobs_ref_gt(blobs_ref_gt&&) = default#
-
blobs_ref_gt &operator=(blobs_ref_gt&&) = default#
-
blobs_ref_gt(blobs_ref_gt const&) = default#
-
blobs_ref_gt &operator=(blobs_ref_gt const&) = default#
-
inline blobs_ref_gt &on(arena_t &arena) noexcept#
-
inline expected_gt<value_t> value(bool watch = true) noexcept#
-
inline operator expected_gt<value_t>() noexcept#
-
inline expected_gt<length_t> length(bool watch = true) noexcept#
-
inline expected_gt<present_t> present(bool watch = true) noexcept#
Checks if requested keys are present in the store. ! Related values may be empty strings.
-
template<typename contents_arg_at>
inline status_t assign(contents_arg_at &&vals, bool flush = false) noexcept# Pair-wise assigns values to keys located in this proxy objects.
- Parameters:
vals – values to be assigned.
flush – Pass true, if you need the data to be persisted before returning.
- Returns:
status_t Non-NULL if only an error had occurred.
-
inline status_t erase(bool flush = false) noexcept#
Removes both the keys and the associated values.
- Parameters:
flush – Pass true, if you need the data to be persisted before returning.
- Returns:
status_t Non-NULL if only an error had occurred.
-
inline status_t clear(bool flush = false) noexcept#
Keeps the keys, but clears the contents of associated values.
- Parameters:
flush – Pass true, if you need the data to be persisted before returning.
- Returns:
status_t Non-NULL if only an error had occurred.
-
template<typename contents_arg_at>
inline blobs_ref_gt &operator=(contents_arg_at &&vals) noexcept(false)#
-
inline blobs_ref_gt &operator=(std::nullptr_t) noexcept(false)#
-
inline locations_plain_t &locations() noexcept#
-
inline locations_plain_t &locations() const noexcept#
Public Static Attributes
-
static constexpr bool is_one_k = keys_extractor_t::is_one_k#
Protected Functions
-
template<typename contents_arg_at>
status_t any_assign(contents_arg_at&&, ustore_options_t) noexcept#
-
template<typename expected_at = value_t>
expected_gt<expected_at> any_get(ustore_options_t) noexcept#
-
template<typename expected_at, typename contents_arg_at>
expected_gt<expected_at> any_gather(contents_arg_at&&, ustore_options_t) noexcept#
Protected Attributes
-
ustore_database_t db_ = {}#
-
ustore_transaction_t txn_ = {}#
-
ustore_snapshot_t snap_ = {}#
-
ustore_arena_t *arena_ = {}#
-
locations_store_t locations_ = {}#
-
template<typename locations_at>
-
namespace ustore
context#
- Author
Ashot Vardanian
- Date
26 Jun 2022
-
namespace unum
-
namespace ustore
-
class null_context_t#
- #include <context.hpp>
Abstraction over
ustore_database_t
,ustore_transaction_t
andustore_arena_t
, needed for default-construction.
-
class borrowed_transactional_context_t#
- #include <context.hpp>
Allows transactional operations on memory managed by someone else. Won’t allow adding or removing collections or bulk-removing all entries.
Public Functions
-
inline ustore_database_t db() noexcept#
-
inline ustore_transaction_t txn() noexcept#
-
inline ustore_arena_t *arena() noexcept#
-
inline borrowed_transactional_context_t(ustore_database_t db, ustore_transaction_t txn, ustore_arena_t *arena) noexcept#
Private Members
-
ustore_database_t db_ = {nullptr}#
-
ustore_transaction_t txn_ = {nullptr}#
-
ustore_arena_t *arena_ = {nullptr}#
-
inline ustore_database_t db() noexcept#
-
class owned_transactional_context_t#
- #include <context.hpp>
Allows transactional operations on the memory owned by this context. Won’t allow adding or removing collections or bulk-removing all entries.
Public Functions
-
inline ustore_database_t db() noexcept#
-
inline ustore_transaction_t txn() noexcept#
-
inline ustore_arena_t *arena() noexcept#
Private Members
-
ustore_database_t db_ = {nullptr}#
-
ustore_transaction_t txn_ = {nullptr}#
-
ustore_arena_t arena_ = {nullptr}#
-
inline ustore_database_t db() noexcept#
-
class owned_context_t#
- #include <context.hpp>
Allows any operations without any “transactional compositing” on the memory owned by this context. Mostly used for testing, addition and removal of collections and bulk entry removals.
Public Functions
-
inline ustore_database_t db() noexcept#
-
inline ustore_transaction_t txn() noexcept#
-
inline ustore_arena_t *arena() noexcept#
-
inline ustore_database_t db() noexcept#
-
class null_context_t#
-
namespace ustore
docs_ref#
- Author
Ashot Vardanian
- Date
26 Jun 2022
-
namespace unum
-
namespace ustore
-
template<typename locations_at>
class docs_ref_gt# - #include <docs_ref.hpp>
A proxy object, that allows both lookups and writes with
[]
and assignment operators for a batch of keys and sub-keys/fields across different documents. Following assignment combinations are possible:one value to many keys
many values to many keys
one value to one key The only impossible combination is assigning many values to one key.
- Template Parameters:
locations_at – Type describing the address of a value in DBMS.
(ustore_collection_t?, ustore_key_t, ustore_field_t?): Single KV-pair location.
(ustore_collection_t*, ustore_key_t*, ustore_field_t*): Externally owned range of keys.
(ustore_collection_t[x], ustore_key_t[x], ustore_field_t[x]): On-stack array of addresses.
Public Types
-
using locations_store_t = location_store_gt<locations_at>#
-
using locations_plain_t = typename locations_store_t::plain_t#
-
using keys_extractor_t = places_arg_extractor_gt<locations_plain_t>#
-
using value_t = std::conditional_t<is_one_k, value_view_t, embedded_blobs_t>#
-
using present_t = std::conditional_t<is_one_k, bool, bits_span_t>#
-
using length_t = std::conditional_t<is_one_k, ustore_length_t, ptr_range_gt<ustore_length_t>>#
Public Functions
-
inline docs_ref_gt(ustore_database_t db, ustore_transaction_t txn, ustore_snapshot_t snap, locations_at &&locations, ustore_arena_t *arena, ustore_doc_field_type_t type = ustore_doc_field_default_k) noexcept#
-
docs_ref_gt(docs_ref_gt&&) = default#
-
docs_ref_gt &operator=(docs_ref_gt&&) = default#
-
docs_ref_gt(docs_ref_gt const&) = default#
-
docs_ref_gt &operator=(docs_ref_gt const&) = default#
-
inline docs_ref_gt &on(arena_t &arena) noexcept#
-
inline docs_ref_gt &as(ustore_doc_field_type_t type) noexcept#
-
inline expected_gt<value_t> value(bool watch = true) noexcept#
-
inline expected_gt<value_t> value(ustore_doc_field_type_t type, bool watch = true) noexcept#
-
inline operator expected_gt<value_t>() noexcept#
-
inline expected_gt<length_t> length(bool watch = true) noexcept#
-
inline expected_gt<present_t> present(bool watch = true) noexcept#
Checks if requested keys are present in the store. ! Related values may be empty strings.
-
template<typename contents_arg_at>
inline status_t assign(contents_arg_at &&vals, bool flush = false) noexcept# Pair-wise assigns values to keys located in this proxy objects.
- Parameters:
vals – Values to be assigned.
flush – Pass true, if you need the data to be persisted before returning.
- Returns:
status_t Non-NULL if only an error had occurred.
-
template<typename contents_arg_at>
inline status_t assign(contents_arg_at &&vals, ustore_doc_field_type_t type, bool flush = false) noexcept#
-
inline status_t erase(bool flush = false) noexcept#
Removes both the keys and the associated values.
- Parameters:
flush – Pass true, if you need the data to be persisted before returning.
- Returns:
status_t Non-NULL if only an error had occurred.
-
inline status_t clear(bool flush = false) noexcept#
Keeps the keys, but clears the contents of associated values.
- Parameters:
flush – Pass true, if you need the data to be persisted before returning.
- Returns:
status_t Non-NULL if only an error had occurred.
-
template<typename contents_arg_at>
inline docs_ref_gt &operator=(contents_arg_at &&vals) noexcept(false)#
-
inline docs_ref_gt &operator=(std::nullptr_t) noexcept(false)#
-
inline locations_plain_t &locations() noexcept#
-
inline locations_plain_t &locations() const noexcept#
-
template<typename contents_arg_at>
inline status_t patch(contents_arg_at &&vals, bool flush = false) noexcept# Patches hierarchical documents with RFC 6902 JSON Patches.
-
template<typename contents_arg_at>
inline status_t merge(contents_arg_at &&vals, bool flush = false) noexcept# Patches hierarchical documents with RFC 7386 JSON Merge Patches.
-
template<typename contents_arg_at>
inline status_t insert(contents_arg_at &&vals, bool flush = false) noexcept#
-
template<typename contents_arg_at>
inline status_t upsert(contents_arg_at &&vals, bool flush = false) noexcept#
-
template<typename contents_arg_at>
inline status_t update(contents_arg_at &&vals, bool flush = false) noexcept#
-
expected_gt<joined_strs_t> gist(bool watch = true) noexcept#
Find the names of all unique fields in requested documents.
-
inline expected_gt<docs_table_t> gather(table_header_t const &header, bool watch = true) noexcept#
For N documents and M fields gather (N * M) responses. You put in a
table_layout_view_gt
and you receive a. Any column type annotation is optional.
-
inline expected_gt<docs_table_t> gather(table_header_view_t const &header, bool watch = true) noexcept#
-
template<typename ...column_types_at>
inline expected_gt<docs_table_gt<column_types_at...>> gather(table_header_gt<column_types_at...> const &header, bool watch = true) noexcept#
Public Static Attributes
-
static constexpr bool is_one_k = keys_extractor_t::is_one_k#
Protected Functions
-
template<typename contents_arg_at>
status_t any_write(contents_arg_at&&, ustore_doc_modification_t, ustore_doc_field_type_t, ustore_options_t) noexcept#
-
template<typename expected_at = value_t>
expected_gt<expected_at> any_get(ustore_doc_field_type_t, ustore_options_t) noexcept#
-
template<typename expected_at, typename layout_at>
expected_gt<expected_at> any_gather(layout_at&&, ustore_options_t) noexcept#
Protected Attributes
-
ustore_database_t db_ = nullptr#
-
ustore_transaction_t transaction_ = nullptr#
-
ustore_snapshot_t snapshot_ = {}#
-
ustore_arena_t *arena_ = nullptr#
-
locations_store_t locations_#
-
template<typename locations_at>
-
namespace ustore
docs_table#
- Author
Ashot Vardanian
- Date
4 Jul 2022
Typedefs
-
template<typename element_at>
using column_view_gt = std::conditional_t<is_variable_length<element_at>(), column_view_varlen_gt<element_at>, column_view_scalar_gt<element_at>>#
Functions
-
template<typename element_at>
constexpr bool is_variable_length()#
-
inline table_header_gt table_header()#
-
template<>
struct field_type_gt<std::monostate># - #include <docs_table.hpp>
Public Members
-
ustore_str_view_t field = nullptr#
-
ustore_str_view_t field = nullptr#
-
template<>
struct table_header_gt<std::monostate># - #include <docs_table.hpp>
Combination of index column and header row, defining the order of dynamically-typed contents in the table.
Public Functions
-
inline void clear() noexcept#
-
inline table_header_view_t view() const noexcept#
-
inline operator table_header_view_t() const noexcept#
-
template<typename element_at>
inline table_header_gt &with(ustore_str_view_t name) &#
-
inline table_header_gt &with(ustore_str_view_t name, ustore_doc_field_type_t type) &#
-
inline strided_range_gt<ustore_str_view_t const> fields() const noexcept#
-
inline strided_range_gt<ustore_doc_field_type_t const> types() const noexcept#
Public Members
-
std::vector<field_type_t> columns#
-
inline void clear() noexcept#
-
namespace unum
-
namespace ustore
Typedefs
-
template<typename element_at>
using column_view_gt = std::conditional_t<is_variable_length<element_at>(), column_view_varlen_gt<element_at>, column_view_scalar_gt<element_at>>#
-
using docs_table_t = docs_table_gt<std::monostate>#
-
using field_type_t = field_type_gt<std::monostate>#
-
using table_header_t = table_header_gt<std::monostate>#
Functions
-
template<typename element_at>
constexpr bool is_variable_length()#
-
inline table_header_gt table_header()#
-
template<typename element_at>
struct cell_gt# - #include <docs_table.hpp>
Public Members
-
bool valid = {false}#
-
bool converted = {false}#
-
bool collides = {false}#
-
element_at value#
-
bool valid = {false}#
-
template<typename element_at>
struct field_type_gt# - #include <docs_table.hpp>
Public Members
-
ustore_str_view_t field = nullptr#
-
ustore_str_view_t field = nullptr#
-
template<typename element_at>
class column_view_varlen_gt# - #include <docs_table.hpp>
Public Functions
-
inline column_view_varlen_gt(ustore_octet_t *validities, ustore_octet_t *conversions, ustore_octet_t *collisions, ustore_byte_t *tape, ustore_length_t *offsets, ustore_length_t *lengths, ustore_size_t count, ustore_str_view_t name = nullptr) noexcept#
-
column_view_varlen_gt(column_view_varlen_gt&&) = default#
-
column_view_varlen_gt(column_view_varlen_gt const&) = default#
-
column_view_varlen_gt &operator=(column_view_varlen_gt&&) = default#
-
column_view_varlen_gt &operator=(column_view_varlen_gt const&) = default#
-
inline ustore_str_view_t name() const noexcept#
Private Members
-
ustore_octet_t *validities_ = {nullptr}#
-
ustore_octet_t *conversions_ = {nullptr}#
-
ustore_octet_t *collisions_ = {nullptr}#
-
ustore_byte_t *tape_ = {nullptr}#
-
ustore_length_t *offsets_ = {nullptr}#
-
ustore_length_t *lengths_ = {nullptr}#
-
ustore_size_t count_ = {0}#
-
ustore_str_view_t name_ = {nullptr}#
-
inline column_view_varlen_gt(ustore_octet_t *validities, ustore_octet_t *conversions, ustore_octet_t *collisions, ustore_byte_t *tape, ustore_length_t *offsets, ustore_length_t *lengths, ustore_size_t count, ustore_str_view_t name = nullptr) noexcept#
-
template<typename element_at>
class column_view_scalar_gt# - #include <docs_table.hpp>
Public Types
-
using scalar_t = element_at#
Public Functions
-
inline column_view_scalar_gt(ustore_octet_t *validities, ustore_octet_t *conversions, ustore_octet_t *collisions, scalar_t *scalars, ustore_size_t count, ustore_str_view_t name = nullptr) noexcept#
-
column_view_scalar_gt(column_view_scalar_gt&&) = default#
-
column_view_scalar_gt(column_view_scalar_gt const&) = default#
-
column_view_scalar_gt &operator=(column_view_scalar_gt&&) = default#
-
column_view_scalar_gt &operator=(column_view_scalar_gt const&) = default#
-
inline ustore_str_view_t name() const noexcept#
Private Members
-
ustore_octet_t *validities_ = {nullptr}#
-
ustore_octet_t *conversions_ = {nullptr}#
-
ustore_octet_t *collisions_ = {nullptr}#
-
element_at *scalars_ = {nullptr}#
-
ustore_size_t count_ = {0}#
-
ustore_str_view_t name_ = {nullptr}#
-
using scalar_t = element_at#
-
template<typename ...column_types_at>
class docs_table_gt# - #include <docs_table.hpp>
- Template Parameters:
column_types_at – Optional type-annotation for columns.
Public Functions
-
inline docs_table_gt(ustore_size_t docs_count, ustore_size_t fields_count, strided_iterator_gt<ustore_collection_t const> collections, strided_iterator_gt<ustore_key_t const> keys, strided_iterator_gt<ustore_str_view_t const> fields, strided_iterator_gt<ustore_doc_field_type_t const> types, ustore_octet_t **columns_validities = nullptr, ustore_octet_t **columns_conversions = nullptr, ustore_octet_t **columns_collisions = nullptr, ustore_byte_t **columns_scalars = nullptr, ustore_length_t **columns_offsets = nullptr, ustore_length_t **columns_lengths = nullptr, ustore_byte_t *tape = nullptr) noexcept#
-
docs_table_gt(docs_table_gt&&) = default#
-
docs_table_gt(docs_table_gt const&) = default#
-
docs_table_gt &operator=(docs_table_gt&&) = default#
-
docs_table_gt &operator=(docs_table_gt const&) = default#
-
inline table_index_view_t index() const noexcept#
-
inline table_header_view_t header() const noexcept#
-
template<std::size_t idx_ak>
inline column_at_gt<idx_ak> column() const noexcept#
-
inline row_tuple_t row(std::size_t i) const noexcept#
-
inline ustore_octet_t ***member_validities() noexcept#
-
inline ustore_octet_t ***member_conversions() noexcept#
-
inline ustore_octet_t ***member_collisions() noexcept#
-
inline ustore_byte_t ***member_scalars() noexcept#
-
inline ustore_length_t ***member_offsets() noexcept#
-
inline ustore_length_t ***member_lengths() noexcept#
-
inline ustore_byte_t **member_tape() noexcept#
Private Types
-
using types_tuple_t = std::tuple<column_types_at...>#
-
using row_tuple_t = std::tuple<cell_gt<column_types_at>...>#
-
template<std::size_t idx_ak>
using column_at_gt = std::conditional_t<is_dynamic_k, column_view_t, column_view_gt<std::tuple_element_t<idx_ak, types_tuple_t>>>#
Private Members
-
ustore_size_t docs_count_#
-
ustore_size_t fields_count_#
-
strided_iterator_gt<ustore_collection_t const> collections_#
-
strided_iterator_gt<ustore_key_t const> keys_#
-
strided_iterator_gt<ustore_str_view_t const> fields_#
-
strided_iterator_gt<ustore_doc_field_type_t const> types_#
-
ustore_octet_t **columns_validities_ = nullptr#
-
ustore_octet_t **columns_conversions_ = nullptr#
-
ustore_octet_t **columns_collisions_ = nullptr#
-
ustore_byte_t **columns_scalars_ = nullptr#
-
ustore_length_t **columns_offsets_ = nullptr#
-
ustore_length_t **columns_lengths_ = nullptr#
-
ustore_byte_t *tape_ = nullptr#
Private Static Attributes
-
static constexpr bool is_dynamic_k = std::is_same_v<empty_tuple_t, types_tuple_t>#
-
template<typename ...column_types_at>
struct table_header_gt# - #include <docs_table.hpp>
Combination of index column and header row, defining the order of statically-typed contents in the table.
Public Types
-
using types_tuple_t = std::tuple<column_types_at...>#
-
using columns_t = std::array<field_type_t, collections_count_k>#
Public Functions
-
template<typename element_at>
inline table_header_gt<column_types_at..., element_at> with(ustore_str_view_t name) &&#
-
inline strided_range_gt<ustore_str_view_t const> fields() const noexcept#
-
inline strided_range_gt<ustore_doc_field_type_t const> types() const noexcept#
Public Static Attributes
-
static constexpr std::size_t collections_count_k = std::tuple_size_v<types_tuple_t>#
-
using types_tuple_t = std::tuple<column_types_at...>#
-
struct table_index_view_t#
- #include <docs_table.hpp>
The first column of the table, describing its contents.
Public Functions
-
inline strided_range_gt<ustore_collection_t const> collections() const noexcept#
-
inline strided_range_gt<ustore_key_t const> keys() const noexcept#
Public Members
-
strided_iterator_gt<ustore_collection_t const> collections_begin#
-
strided_iterator_gt<ustore_key_t const> keys_begin#
-
inline strided_range_gt<ustore_collection_t const> collections() const noexcept#
-
struct table_header_view_t#
- #include <docs_table.hpp>
Public Functions
-
inline strided_range_gt<ustore_str_view_t const> fields() const noexcept#
-
inline strided_range_gt<ustore_doc_field_type_t const> types() const noexcept#
Public Members
-
strided_iterator_gt<ustore_str_view_t const> fields_begin#
-
strided_iterator_gt<ustore_doc_field_type_t const> types_begin#
-
inline strided_range_gt<ustore_str_view_t const> fields() const noexcept#
-
template<>
struct cell_gt<value_view_t># - #include <docs_table.hpp>
Public Members
-
bool valid = {false}#
-
bool converted = {false}#
-
bool collides = {false}#
-
value_view_t value#
-
bool valid = {false}#
-
class column_view_t#
- #include <docs_table.hpp>
Public Functions
-
inline column_view_t(ustore_octet_t *validities, ustore_octet_t *conversions, ustore_octet_t *collisions, ustore_byte_t *scalars, ustore_byte_t *tape, ustore_length_t *offsets, ustore_length_t *lengths, ustore_size_t count, ustore_str_view_t name = nullptr, ustore_doc_field_type_t type = ustore_doc_field_json_k) noexcept#
-
column_view_t(column_view_t&&) = default#
-
column_view_t(column_view_t const&) = default#
-
column_view_t &operator=(column_view_t&&) = default#
-
column_view_t &operator=(column_view_t const&) = default#
-
inline ustore_str_view_t name() const noexcept#
-
inline ustore_doc_field_type_t type() const noexcept#
-
template<typename element_at>
inline column_view_gt<element_at> as() const noexcept#
-
inline ustore_octet_t *validities() const noexcept#
-
inline ustore_length_t *offsets() const noexcept#
-
inline ustore_length_t *lengths() const noexcept#
-
inline ustore_byte_t *contents() const noexcept#
Private Members
-
ustore_octet_t *validities_ = {nullptr}#
-
ustore_octet_t *conversions_ = {nullptr}#
-
ustore_octet_t *collisions_ = {nullptr}#
-
ustore_byte_t *scalars_ = {nullptr}#
-
ustore_byte_t *tape_ = {nullptr}#
-
ustore_length_t *offsets_ = {nullptr}#
-
ustore_length_t *lengths_ = {nullptr}#
-
ustore_size_t count_ = {0}#
-
ustore_str_view_t name_ = {nullptr}#
-
inline column_view_t(ustore_octet_t *validities, ustore_octet_t *conversions, ustore_octet_t *collisions, ustore_byte_t *scalars, ustore_byte_t *tape, ustore_length_t *offsets, ustore_length_t *lengths, ustore_size_t count, ustore_str_view_t name = nullptr, ustore_doc_field_type_t type = ustore_doc_field_json_k) noexcept#
- template<> monostate >
- #include <docs_table.hpp>
Public Members
-
ustore_str_view_t field = nullptr#
-
ustore_str_view_t field = nullptr#
- template<> monostate >
- #include <docs_table.hpp>
Combination of index column and header row, defining the order of dynamically-typed contents in the table.
Public Functions
-
inline void clear() noexcept#
-
inline table_header_view_t view() const noexcept#
-
inline operator table_header_view_t() const noexcept#
-
template<typename element_at>
inline table_header_gt &with(ustore_str_view_t name) &#
-
inline table_header_gt &with(ustore_str_view_t name, ustore_doc_field_type_t type) &#
-
inline strided_range_gt<ustore_str_view_t const> fields() const noexcept#
-
inline strided_range_gt<ustore_doc_field_type_t const> types() const noexcept#
Public Members
-
std::vector<field_type_t> columns#
-
inline void clear() noexcept#
-
template<typename element_at>
-
namespace ustore
graph_collection#
- Author
Ashot Vardanian
- Date
30 Jun 2022
-
namespace unum
-
namespace ustore
-
class graph_collection_t#
- #include <graph_collection.hpp>
Wraps relational/linking operations with cleaner type system. Controls mainly just the inverted index collection and keeps a local memory buffer (tape) for read operations, so isn’t thread-safe. You can have one such object in every working thread, even for the same graph collection. Supports updates/reads from within a transaction.
Public Types
-
using adjacency_range_t = range_gt<graph_stream_t>#
Public Functions
-
inline graph_collection_t() noexcept#
-
inline graph_collection_t(ustore_database_t db, ustore_collection_t collection = ustore_collection_main_k, ustore_transaction_t txn = nullptr, ustore_snapshot_t snap = {}, ustore_arena_t *arena = nullptr) noexcept#
-
graph_collection_t(graph_collection_t&&) = default#
-
graph_collection_t &operator=(graph_collection_t&&) = default#
-
graph_collection_t(graph_collection_t const&) = delete#
-
graph_collection_t &operator=(graph_collection_t const&) = delete#
-
inline status_t upsert_vertices(strided_range_gt<ustore_key_t const> vertices) noexcept#
-
inline status_t upsert_edges(edges_view_t const &edges) noexcept#
-
inline status_t remove_vertices(strided_range_gt<ustore_key_t const> vertices, strided_range_gt<ustore_vertex_role_t const> roles = {}, bool flush = false) noexcept#
-
inline status_t remove_edges(edges_view_t const &edges) noexcept#
-
inline ustore_collection_t *member_ptr() noexcept#
-
inline status_t upsert_vertex(ustore_key_t const vertex) noexcept#
-
template<typename key_arg_at>
inline status_t upsert_vertices(key_arg_at &&vertices) noexcept#
-
inline status_t remove_vertex(ustore_key_t const vertex, ustore_vertex_role_t const role = ustore_vertex_role_any_k, bool flush = false) noexcept#
-
template<typename key_arg_at>
inline status_t remove_vertices(key_arg_at &&vertices) noexcept#
-
inline expected_gt<ustore_vertex_degree_t> degree(ustore_key_t vertex, ustore_vertex_role_t role = ustore_vertex_role_any_k, bool watch = true) noexcept#
-
inline expected_gt<ptr_range_gt<ustore_vertex_degree_t>> degrees(strided_range_gt<ustore_key_t const> vertices, strided_range_gt<ustore_vertex_role_t const> roles = {}, bool watch = true) noexcept#
-
inline expected_gt<bool> contains(ustore_key_t vertex, bool watch = true) noexcept#
-
inline expected_gt<bits_span_t> contains(strided_range_gt<ustore_key_t const> const &vertices, bool watch = true) noexcept#
Checks if certain vertices are present in the graph. They maybe disconnected from everything else.
-
inline expected_gt<keys_stream_t> vertex_stream(std::size_t vertices_read_ahead = keys_stream_t::default_read_ahead_k) const noexcept#
-
inline expected_gt<adjacency_range_t> edges(ustore_vertex_role_t role = ustore_vertex_role_any_k, std::size_t vertices_read_ahead = keys_stream_t::default_read_ahead_k) const noexcept#
-
inline expected_gt<edges_span_t> edges_containing(ustore_key_t vertex, ustore_vertex_role_t role = ustore_vertex_role_any_k, bool watch = true) noexcept#
-
inline expected_gt<edges_span_t> edges_between(ustore_key_t source, ustore_key_t target, bool watch = true) noexcept#
-
inline expected_gt<edges_span_t> edges_containing(strided_range_gt<ustore_key_t const> vertices, strided_range_gt<ustore_vertex_role_t const> roles = {}, bool watch = true) noexcept#
Finds all the edges, that have any of the supplied nodes in allowed roles. In undirected graphs, some edges may come with inverse duplicates.
-
inline expected_gt<strided_range_gt<ustore_key_t>> successors(ustore_key_t vertex) noexcept#
-
inline expected_gt<strided_range_gt<ustore_key_t>> predecessors(ustore_key_t vertex) noexcept#
-
inline expected_gt<strided_range_gt<ustore_key_t>> neighbors(ustore_key_t vertex, ustore_vertex_role_t role = ustore_vertex_role_any_k) noexcept#
Private Members
-
ustore_database_t db_ = nullptr#
-
ustore_collection_t collection_ = ustore_collection_main_k#
-
ustore_transaction_t transaction_ = nullptr#
-
ustore_snapshot_t snapshot_ = {}#
-
any_arena_t arena_#
-
using adjacency_range_t = range_gt<graph_stream_t>#
-
class graph_collection_t#
-
namespace ustore
graph_stream#
- Author
Ashot Vardanian
- Date
30 Jun 2022
-
namespace unum
-
namespace ustore
-
class graph_stream_t#
- #include <graph_stream.hpp>
A stream of all
edge_t's
in a graph. No particular order is guaranteed.Public Types
-
using value_type = ustore_key_t#
-
using pointer = ustore_key_t*#
-
using reference = ustore_key_t&#
Public Functions
-
inline graph_stream_t(ustore_database_t db, ustore_collection_t collection = ustore_collection_main_k, ustore_transaction_t txn = nullptr, ustore_snapshot_t snap = 0, std::size_t read_ahead_vertices = keys_stream_t::default_read_ahead_k, ustore_vertex_role_t role = ustore_vertex_role_any_k) noexcept#
-
graph_stream_t(graph_stream_t&&) = default#
-
graph_stream_t &operator=(graph_stream_t&&) = default#
-
graph_stream_t(graph_stream_t const&) = delete#
-
graph_stream_t &operator=(graph_stream_t const&) = delete#
-
inline status_t seek(ustore_key_t vertex_id) noexcept#
-
inline graph_stream_t &operator++() noexcept#
! Unlike the
advance()
, canonically returns a self-reference, ! meaning that the error must be propagated in a different way. ! So we promote this iterator toend()
, once an error occurs.
-
inline edges_span_t edges_batch() noexcept#
Exposes all the fetched edges at once, including the passed ones. Should be used with
seek_to_next_batch
. Nextadvance
will do the same.
-
inline bool is_end() const noexcept#
-
inline bool operator==(graph_stream_t const &other) const noexcept#
-
inline bool operator!=(graph_stream_t const &other) const noexcept#
Private Members
-
ustore_database_t db_ = {nullptr}#
-
ustore_collection_t collection_ = {ustore_collection_main_k}#
-
ustore_transaction_t transaction_ = {nullptr}#
-
ustore_snapshot_t snapshot_ = {}#
-
edges_span_t fetched_edges_ = {}#
-
keys_stream_t vertex_stream_#
-
using value_type = ustore_key_t#
-
class graph_stream_t#
-
namespace ustore
ranges_args#
- Author
Ashot Vardanian
- Date
4 Jul 2022
Typedefs
-
using keys_view_t = strided_range_gt<ustore_key_t const>#
-
using fields_view_t = strided_range_gt<ustore_str_view_t const>#
-
using edges_span_t = edges_range_gt<ustore_key_t>#
-
using edges_view_t = edges_range_gt<ustore_key_t const>#
Functions
-
inline bool same_collections_are_named(strided_iterator_gt<ustore_collection_t const> collections_begin) noexcept#
-
template<typename enum_at, typename allowed_mask_at>
inline bool enum_is_subset(enum_at enum_value, allowed_mask_at allowed) noexcept#
-
inline void validate_write(ustore_transaction_t const c_txn, places_arg_t const &places, contents_arg_t const &contents, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
inline void validate_read(ustore_transaction_t const c_txn, places_arg_t const &places, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
inline void validate_scan(ustore_transaction_t const c_txn, scans_arg_t const &args, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
inline void validate_transaction_begin(ustore_transaction_t const c_txn, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
inline void validate_transaction_commit(ustore_transaction_t const c_txn, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
namespace unum
-
namespace ustore
Typedefs
-
using keys_view_t = strided_range_gt<ustore_key_t const>#
-
using fields_view_t = strided_range_gt<ustore_str_view_t const>#
-
using edges_span_t = edges_range_gt<ustore_key_t>#
-
using edges_view_t = edges_range_gt<ustore_key_t const>#
Functions
-
inline bool same_collections_are_named(strided_iterator_gt<ustore_collection_t const> collections_begin) noexcept#
-
template<typename enum_at, typename allowed_mask_at>
inline bool enum_is_subset(enum_at enum_value, allowed_mask_at allowed) noexcept#
-
inline void validate_write(ustore_transaction_t const c_txn, places_arg_t const &places, contents_arg_t const &contents, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
inline void validate_read(ustore_transaction_t const c_txn, places_arg_t const &places, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
inline void validate_scan(ustore_transaction_t const c_txn, scans_arg_t const &args, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
inline void validate_transaction_begin(ustore_transaction_t const c_txn, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
inline void validate_transaction_commit(ustore_transaction_t const c_txn, ustore_options_t const c_options, ustore_error_t *c_error) noexcept#
-
struct place_t#
- #include <ranges_args.hpp>
Public Functions
-
inline collection_key_t collection_key() const noexcept#
-
inline collection_key_field_t collection_key_field() const noexcept#
-
inline collection_key_t collection_key() const noexcept#
-
struct places_arg_t#
- #include <ranges_args.hpp>
Working with batched data is ugly in C++. This handle doesn’t help in the general case, but at least allow reusing the arguments.
Public Functions
-
inline bool same_collection() const noexcept#
Public Members
-
strided_iterator_gt<ustore_collection_t const> collections_begin#
-
strided_iterator_gt<ustore_key_t const> keys_begin#
-
strided_iterator_gt<ustore_str_view_t const> fields_begin#
-
ustore_size_t count = {0}#
-
inline bool same_collection() const noexcept#
-
struct contents_arg_t#
- #include <ranges_args.hpp>
Working with batched data is ugly in C++. This handle doesn’t help in the general case, but at least allow reusing the arguments.
Public Types
-
using value_type = value_view_t#
Public Functions
-
inline value_view_t operator[](std::size_t i) const noexcept#
-
inline bool is_arrow() const noexcept#
-
inline bool is_continuous() const noexcept#
Public Members
-
bits_view_t presences_begin#
-
strided_iterator_gt<ustore_length_t const> offsets_begin#
-
strided_iterator_gt<ustore_length_t const> lengths_begin#
-
strided_iterator_gt<ustore_bytes_cptr_t const> contents_begin#
-
ustore_size_t count = {0}#
-
ustore_char_t separator = {'\0'}#
-
using value_type = value_view_t#
-
struct scan_t#
- #include <ranges_args.hpp>
-
struct scans_arg_t#
- #include <ranges_args.hpp>
Arguments of
ustore_scan()
aggregated into a Structure-of-Arrays. Is used to validate various combinations of arguments, strides, NULLs, etc.Public Functions
-
inline bool same_collection() const noexcept#
Public Members
-
strided_iterator_gt<ustore_collection_t const> collections#
-
strided_iterator_gt<ustore_key_t const> start_keys#
-
strided_iterator_gt<ustore_length_t const> limits#
-
ustore_size_t count = 0#
-
inline bool same_collection() const noexcept#
-
struct sample_arg_t#
- #include <ranges_args.hpp>
-
struct sample_args_t#
- #include <ranges_args.hpp>
Arguments of
ustore_sample
aggregated into a Structure-of-Arrays. Is used to validate various combinations of arguments, strides, NULLs, etc.Public Functions
-
inline sample_arg_t operator[](std::size_t i) const noexcept#
-
inline bool same_collection() const noexcept#
Public Members
-
strided_iterator_gt<ustore_collection_t const> collections#
-
strided_iterator_gt<ustore_length_t const> limits#
-
ustore_size_t count = 0#
-
inline sample_arg_t operator[](std::size_t i) const noexcept#
-
struct find_edge_t#
- #include <ranges_args.hpp>
-
struct find_edges_t#
- #include <ranges_args.hpp>
Working with batched data is ugly in C++. This handle doesn’t help in the general case, but at least allow reusing the arguments.
Public Types
-
using value_type = find_edge_t#
Public Functions
-
inline find_edge_t operator[](std::size_t i) const noexcept#
-
inline bool same_collection() const noexcept#
Public Members
-
strided_iterator_gt<ustore_collection_t const> collections_begin#
-
strided_iterator_gt<ustore_key_t const> vertex_id_begin#
-
strided_iterator_gt<ustore_vertex_role_t const> roles_begin#
-
ustore_size_t count = 0#
-
using value_type = find_edge_t#
-
template<typename id_at>
struct edges_range_gt# - #include <ranges_args.hpp>
Public Types
Public Functions
-
inline edges_range_gt() = default#
-
inline edges_range_gt(edges_range_gt&&) = default#
-
inline edges_range_gt(edges_range_gt const&) = default#
-
inline edges_range_gt &operator=(edges_range_gt&&) = default#
-
inline edges_range_gt &operator=(edges_range_gt const&) = default#
-
inline edges_range_gt(strided_range_gt<id_t> sources, strided_range_gt<id_t> targets, strided_range_gt<id_t> edges = {&ustore_default_edge_id_k, 1}) noexcept#
-
inline operator edges_range_gt<id_at const>() const noexcept#
-
inline edges_range_gt<id_at const> immutable() const noexcept#
Public Members
-
strided_range_gt<id_t> source_ids#
-
strided_range_gt<id_t> target_ids#
-
strided_range_gt<id_t> edge_ids#
-
inline edges_range_gt() = default#
-
using keys_view_t = strided_range_gt<ustore_key_t const>#
-
namespace ustore
ranges#
- Author
Ashot Vardanian
- Date
4 Jul 2022
Typedefs
-
template<typename element_at>
using ptr_range_gt = indexed_range_gt<element_at*>#
-
using consecutive_blobs_iterator_t = consecutive_chunks_iterator_gt<value_view_t>#
-
using joined_blobs_iterator_t = joined_chunks_iterator_gt<value_view_t>#
-
using joined_blobs_t = joined_chunks_gt<value_view_t>#
-
using embedded_blobs_iterator_t = embedded_chunks_iterator_gt<value_view_t>#
-
using embedded_blobs_t = embedded_chunks_gt<value_view_t>#
Functions
-
template<typename at, typename alloc_at = std::allocator<at>>
strided_range_gt<at> strided_range(std::vector<at, alloc_at> &vec) noexcept#
-
template<typename at, typename alloc_at = std::allocator<at>>
strided_range_gt<at const> strided_range(std::vector<at, alloc_at> const &vec) noexcept#
-
template<typename at, std::size_t count_ak>
strided_range_gt<at> strided_range(at (&c_array)[count_ak]) noexcept#
-
template<typename at, std::size_t count_ak>
strided_range_gt<at const> strided_range(std::array<at, count_ak> const &array) noexcept#
-
template<typename at>
strided_range_gt<at const> strided_range(std::initializer_list<at> list) noexcept#
-
template<typename element_at, typename iterator_at, typename transform_at = identity_t>
element_at transform_reduce_n(iterator_at begin, std::size_t n, element_at init, transform_at transform = {})# Unlike the
std::accumulate
andstd::transform_reduce
takes an integern
instead of the end iterator. This helps with zero-strided iterators.
-
template<typename output_iterator_at, typename iterator_at, typename transform_at = identity_t>
void transform_n(iterator_at begin, std::size_t n, output_iterator_at output, transform_at transform = {})#
-
template<typename element_at, typename iterator_at>
element_at reduce_n(iterator_at begin, std::size_t n, element_at init)#
-
template<typename iterator_at>
bool all_ascending(iterator_at begin, std::size_t n)#
-
template<typename iterator_at>
std::size_t sort_and_deduplicate(iterator_at begin, iterator_at end)#
-
namespace unum
-
namespace ustore
Typedefs
-
template<typename element_at>
using ptr_range_gt = indexed_range_gt<element_at*>#
-
using consecutive_strs_iterator_t = consecutive_chunks_iterator_gt<std::string_view>#
-
using consecutive_blobs_iterator_t = consecutive_chunks_iterator_gt<value_view_t>#
-
using joined_strs_iterator_t = joined_chunks_iterator_gt<std::string_view>#
-
using joined_blobs_iterator_t = joined_chunks_iterator_gt<value_view_t>#
-
using joined_strs_t = joined_chunks_gt<std::string_view>#
-
using joined_blobs_t = joined_chunks_gt<value_view_t>#
-
using embedded_strs_iterator_t = embedded_chunks_iterator_gt<std::string_view>#
-
using embedded_blobs_iterator_t = embedded_chunks_iterator_gt<value_view_t>#
-
using embedded_strs_t = embedded_chunks_gt<std::string_view>#
-
using embedded_blobs_t = embedded_chunks_gt<value_view_t>#
Functions
-
template<typename at, typename alloc_at = std::allocator<at>>
strided_range_gt<at> strided_range(std::vector<at, alloc_at> &vec) noexcept#
-
template<typename at, typename alloc_at = std::allocator<at>>
strided_range_gt<at const> strided_range(std::vector<at, alloc_at> const &vec) noexcept#
-
template<typename at, std::size_t count_ak>
strided_range_gt<at> strided_range(at (&c_array)[count_ak]) noexcept#
-
template<typename at, std::size_t count_ak>
strided_range_gt<at const> strided_range(std::array<at, count_ak> const &array) noexcept#
-
template<typename at>
strided_range_gt<at const> strided_range(std::initializer_list<at> list) noexcept#
-
template<typename at>
strided_range_gt<at> strided_range(at *begin, at *end) noexcept#
-
template<typename element_at, typename iterator_at, typename transform_at = identity_t>
element_at transform_reduce_n(iterator_at begin, std::size_t n, element_at init, transform_at transform = {})# Unlike the
std::accumulate
andstd::transform_reduce
takes an integern
instead of the end iterator. This helps with zero-strided iterators.
-
template<typename output_iterator_at, typename iterator_at, typename transform_at = identity_t>
void transform_n(iterator_at begin, std::size_t n, output_iterator_at output, transform_at transform = {})#
-
template<typename element_at, typename iterator_at>
element_at reduce_n(iterator_at begin, std::size_t n, element_at init)#
-
template<typename iterator_at>
bool all_ascending(iterator_at begin, std::size_t n)#
-
template<typename iterator_at>
std::size_t sort_and_deduplicate(iterator_at begin, iterator_at end)#
-
template<typename element_at>
class strided_iterator_gt# - #include <ranges.hpp>
A smart pointer type with customizable jump length for increments. In other words, it allows a strided data layout, common to HPC apps. Cool hint, you can use this to represent an infinite array of repeating values with
stride
equal to zero.Public Types
-
using element_t = element_at#
-
using pointer = value_type*#
-
using reference = value_type&#
Public Functions
-
inline strided_iterator_gt(element_t *raw = nullptr, ustore_size_t stride = 0) noexcept#
-
strided_iterator_gt(strided_iterator_gt&&) noexcept = default#
-
strided_iterator_gt(strided_iterator_gt const&) noexcept = default#
-
strided_iterator_gt &operator=(strided_iterator_gt&&) noexcept = default#
-
strided_iterator_gt &operator=(strided_iterator_gt const&) noexcept = default#
-
inline element_t &operator[](ustore_size_t idx) const noexcept#
-
inline strided_iterator_gt &operator++() noexcept#
-
inline strided_iterator_gt &operator--() noexcept#
-
inline strided_iterator_gt operator++(int) const noexcept#
-
inline strided_iterator_gt operator--(int) const noexcept#
-
inline strided_iterator_gt operator+(std::ptrdiff_t n) const noexcept#
-
inline strided_iterator_gt operator-(std::ptrdiff_t n) const noexcept#
-
inline strided_iterator_gt &operator+=(std::ptrdiff_t n) noexcept#
-
inline strided_iterator_gt &operator-=(std::ptrdiff_t n) noexcept#
-
inline std::ptrdiff_t operator-(strided_iterator_gt other) const noexcept#
! Calling this function with “stride” different from zero or ! non-zero
sizeof(element_t)
multiple will cause Undefined ! behavior.
-
inline explicit operator bool() const noexcept#
-
inline bool repeats() const noexcept#
-
inline bool is_continuous() const noexcept#
-
inline ustore_size_t stride() const noexcept#
-
inline bool operator==(strided_iterator_gt const &other) const noexcept#
-
inline bool operator!=(strided_iterator_gt const &other) const noexcept#
-
inline bool operator<(strided_iterator_gt const &other) const noexcept#
-
inline bool operator>(strided_iterator_gt const &other) const noexcept#
-
inline bool operator<=(strided_iterator_gt const &other) const noexcept#
-
inline bool operator>=(strided_iterator_gt const &other) const noexcept#
Protected Functions
-
using element_t = element_at#
-
class bits_span_t#
- #include <ranges.hpp>
Public Functions
-
bits_span_t(bits_span_t&&) noexcept = default#
-
bits_span_t(bits_span_t const&) noexcept = default#
-
bits_span_t &operator=(bits_span_t&&) noexcept = default#
-
bits_span_t &operator=(bits_span_t const&) noexcept = default#
-
inline explicit operator bool() const noexcept#
-
inline bool operator==(bits_span_t const &other) const noexcept#
-
inline bool operator!=(bits_span_t const &other) const noexcept#
-
struct ref_t#
- #include <ranges.hpp>
Public Functions
-
inline ref_t(ustore_octet_t &raw) noexcept#
-
inline ref_t(ustore_octet_t *raw, ustore_octet_t mask) noexcept#
-
inline operator bool() const noexcept#
-
inline ref_t(ustore_octet_t &raw) noexcept#
-
bits_span_t(bits_span_t&&) noexcept = default#
-
class bits_view_t#
- #include <ranges.hpp>
Public Types
-
using element_t = ustore_octet_t const#
-
using value_type = bool#
-
using reference = void#
Public Functions
-
bits_view_t(bits_view_t&&) noexcept = default#
-
bits_view_t(bits_view_t const&) noexcept = default#
-
bits_view_t &operator=(bits_view_t&&) noexcept = default#
-
bits_view_t &operator=(bits_view_t const&) noexcept = default#
-
inline explicit operator bool() const noexcept#
-
inline bool operator==(bits_view_t const &other) const noexcept#
-
inline bool operator!=(bits_view_t const &other) const noexcept#
-
using element_t = ustore_octet_t const#
-
template<typename element_at>
class strided_range_gt# - #include <ranges.hpp>
Public Types
-
using element_t = element_at#
-
using iterator_t = strided_iterator_gt<element_t>#
-
using value_type = typename iterator_t::value_type#
-
using reference = typename iterator_t::reference#
Public Functions
-
strided_range_gt() = default#
-
inline strided_range_gt(iterator_t begin, std::size_t count) noexcept#
-
strided_range_gt(strided_range_gt&&) = default#
-
strided_range_gt(strided_range_gt const&) = default#
-
strided_range_gt &operator=(strided_range_gt&&) = default#
-
strided_range_gt &operator=(strided_range_gt const&) = default#
-
inline decltype(auto) begin() const noexcept#
-
inline decltype(auto) end() const noexcept#
-
inline auto immutable() const noexcept#
-
inline strided_range_gt subspan(std::size_t offset, std::size_t count) const noexcept#
-
inline bool empty() const noexcept#
-
inline ustore_size_t stride() const noexcept#
-
inline ustore_size_t count() const noexcept#
-
inline explicit operator bool() const noexcept#
-
template<typename member_at, typename parent_at = element_t>
inline auto members(member_at parent_at::* member_ptr) const noexcept#
-
inline bool same_elements() const noexcept#
-
using element_t = element_at#
-
template<typename pointer_at>
struct indexed_range_gt# - #include <ranges.hpp>
Similar to
std::optional<std::span>
. It’s NULL state and “empty string” states are not identical. The NULL state generally reflects missing values.Public Functions
-
inline indexed_range_gt() noexcept#
-
inline bool empty() const noexcept#
-
inline explicit operator bool() const noexcept#
-
template<typename other_at>
inline indexed_range_gt<other_at> cast() const noexcept#
-
inline indexed_range_gt<byte_t const> span_bytes() const noexcept#
-
inline indexed_range_gt() noexcept#
-
template<typename pointer_at>
struct range_gt# - #include <ranges.hpp>
Public Functions
-
inline pointer_at const &begin() const & noexcept#
-
inline pointer_at const &end() const & noexcept#
-
inline pointer_at &&begin() && noexcept#
-
inline pointer_at &&end() && noexcept#
-
inline pointer_at const &begin() const & noexcept#
-
template<typename chunk_at>
class consecutive_chunks_iterator_gt# - #include <ranges.hpp>
A read-only iterator for values packed into a contiguous memory range. Doesn’t own underlying memory. Only needs element “lengths”, but can only be forward-iterated.
Public Functions
-
consecutive_chunks_iterator_gt() = default#
-
template<typename same_size_at>
inline consecutive_chunks_iterator_gt(ustore_length_t const *lens, same_size_at *vals) noexcept#
-
inline consecutive_chunks_iterator_gt &operator++() noexcept#
-
inline consecutive_chunks_iterator_gt operator++(int) const noexcept#
-
inline bool operator==(consecutive_chunks_iterator_gt const &other) const noexcept#
-
inline bool operator!=(consecutive_chunks_iterator_gt const &other) const noexcept#
-
consecutive_chunks_iterator_gt() = default#
-
template<typename chunk_at>
class joined_chunks_iterator_gt# - #include <ranges.hpp>
A read-only iterator for values packed into a contiguous memory range. Doesn’t own underlying memory. Relies on “offsets” to be in an Arrow-compatible form.
Public Functions
-
joined_chunks_iterator_gt() = default#
-
template<typename same_size_at>
inline joined_chunks_iterator_gt(ustore_length_t *offs, same_size_at *vals) noexcept#
-
inline joined_chunks_iterator_gt &operator++() noexcept#
-
inline joined_chunks_iterator_gt operator++(int) const noexcept#
-
inline joined_chunks_iterator_gt operator--(int) const noexcept#
-
inline bool operator==(joined_chunks_iterator_gt const &other) const noexcept#
-
inline bool operator!=(joined_chunks_iterator_gt const &other) const noexcept#
-
joined_chunks_iterator_gt() = default#
-
template<typename chunk_at>
class joined_chunks_gt# - #include <ranges.hpp>
Public Functions
-
joined_chunks_gt() = default#
-
template<typename same_size_at>
inline joined_chunks_gt(ustore_size_t elements, ustore_length_t *offs, same_size_at *vals) noexcept#
-
inline joined_chunks_iterator_gt<chunk_at> begin() const noexcept#
-
inline joined_chunks_iterator_gt<chunk_at> end() const noexcept#
-
inline ustore_length_t *offsets() const noexcept#
-
joined_chunks_gt() = default#
-
template<typename chunk_at>
class embedded_chunks_iterator_gt# - #include <ranges.hpp>
A read-only iterator for values packed into a contiguous memory range. Doesn’t own underlying memory.
Public Functions
-
template<typename same_size_at>
inline embedded_chunks_iterator_gt(ustore_length_t *offs, ustore_length_t *lens, same_size_at *vals) noexcept#
-
inline embedded_chunks_iterator_gt &operator++() noexcept#
-
inline embedded_chunks_iterator_gt operator++(int) const noexcept#
-
inline embedded_chunks_iterator_gt operator--(int) const noexcept#
-
inline bool operator==(embedded_chunks_iterator_gt const &other) const noexcept#
-
inline bool operator!=(embedded_chunks_iterator_gt const &other) const noexcept#
-
template<typename same_size_at>
-
template<typename chunk_at>
class embedded_chunks_gt# - #include <ranges.hpp>
Public Functions
-
embedded_chunks_gt() = default#
-
template<typename same_size_at>
inline embedded_chunks_gt(ustore_size_t elements, ustore_length_t *offs, ustore_length_t *lens, same_size_at *vals) noexcept#
-
inline embedded_chunks_iterator_gt<chunk_at> begin() const noexcept#
-
inline embedded_chunks_iterator_gt<chunk_at> end() const noexcept#
-
inline ustore_length_t *offsets() const noexcept#
-
inline ustore_length_t *lengths() const noexcept#
Private Members
-
ustore_size_t count_ = {0}#
-
ustore_length_t *offsets_ = {nullptr}#
-
ustore_length_t *lengths_ = {nullptr}#
-
embedded_chunks_gt() = default#
-
class strings_tape_iterator_t#
- #include <ranges.hpp>
Iterates through a predetermined number of NULL-delimited strings joined one after another in continuous memory. Can be used for
ustore_docs_gist()
orustore_collection_list()
.Public Types
-
using pointer = ustore_char_t**#
Public Functions
-
inline strings_tape_iterator_t(ustore_size_t remaining = 0, ustore_str_view_t current = nullptr)#
-
strings_tape_iterator_t(strings_tape_iterator_t&&) = default#
-
strings_tape_iterator_t &operator=(strings_tape_iterator_t&&) = default#
-
strings_tape_iterator_t(strings_tape_iterator_t const&) = default#
-
strings_tape_iterator_t &operator=(strings_tape_iterator_t const&) = default#
-
inline strings_tape_iterator_t &operator++() noexcept#
-
inline strings_tape_iterator_t operator++(int) noexcept#
-
inline ustore_str_view_t operator*() const noexcept#
-
inline bool is_end() const noexcept#
-
inline ustore_size_t size() const noexcept#
-
using pointer = ustore_char_t**#
-
template<typename scalar_at>
class strided_matrix_gt# - #include <ranges.hpp>
Public Functions
-
strided_matrix_gt() = default#
-
inline strided_matrix_gt(scalar_t *begin, std::size_t rows, std::size_t columns, std::size_t bytes_between_rows, std::size_t column_stride = sizeof(scalar_t)) noexcept#
-
strided_matrix_gt(strided_matrix_gt&&) = default#
-
strided_matrix_gt(strided_matrix_gt const&) = default#
-
strided_matrix_gt &operator=(strided_matrix_gt&&) = default#
-
strided_matrix_gt &operator=(strided_matrix_gt const&) = default#
-
inline strided_range_gt<scalar_t const> column(std::size_t j) const noexcept#
-
inline strided_range_gt<scalar_t const*> row(std::size_t i) const noexcept#
Private Members
-
ustore_size_t bytes_between_rows_ = {0}#
-
ustore_size_t bytes_between_columns_ = {0}#
-
ustore_size_t rows_ = {0}#
-
ustore_size_t columns_ = {0}#
-
strided_matrix_gt() = default#
-
struct identity_t#
- #include <ranges.hpp>
-
template<typename element_at>
-
namespace ustore
sfinae#
- Author
Ashot Vardanian
- Date
4 Jul 2022
Functions
-
template<typename locations_at>
constexpr bool is_one()#
-
template<typename at>
struct sfinae_is_range_gt<at, decltype(std::data(at{}), 0)> : public std::true_type# - #include <sfinae.hpp>
-
template<typename at>
struct sfinae_has_collection_gt<at, decltype((void)at::collection, 0)> : public std::true_type# - #include <sfinae.hpp>
-
template<typename at>
struct sfinae_has_field_gt<at, decltype((void)at::field, 0)> : public std::true_type# - #include <sfinae.hpp>
-
template<typename at>
struct sfinae_member_extractor_gt<at, std::void_t<typename at::value_type>># - #include <sfinae.hpp>
-
template<>
struct contents_arg_extractor_gt<std::nullptr_t># - #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(std::nullptr_t) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(std::nullptr_t) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(std::nullptr_t) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(std::nullptr_t) noexcept#
-
template<typename allocator_at>
struct contents_arg_extractor_gt<std::vector<value_view_t, allocator_at>># - #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(std::vector<value_view_t, allocator_at> const &many) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(std::vector<value_view_t, allocator_at> const&) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(std::vector<value_view_t, allocator_at> const &many) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(std::vector<value_view_t, allocator_at> const &many) noexcept#
-
namespace unum
-
namespace ustore
Functions
-
template<typename locations_at>
constexpr bool is_one()#
-
template<typename at, typename = int>
struct sfinae_is_range_gt : public std::false_type# - #include <sfinae.hpp>
- template<typename at> data(at{}), 0)> : public std::true_type
- #include <sfinae.hpp>
-
template<typename at>
struct sfinae_is_range_gt<strided_range_gt<at>> : public std::true_type# - #include <sfinae.hpp>
-
template<typename at, typename = int>
struct sfinae_has_collection_gt : public std::false_type# - #include <sfinae.hpp>
- template<typename at> collection, 0)> : public std::true_type
- #include <sfinae.hpp>
-
template<typename at, typename = int>
struct sfinae_has_field_gt : public std::false_type# - #include <sfinae.hpp>
- template<typename at> field, 0)> : public std::true_type
- #include <sfinae.hpp>
-
template<typename at, typename = void>
struct sfinae_member_extractor_gt# - #include <sfinae.hpp>
- template<typename at> value_type > >
- #include <sfinae.hpp>
Public Types
-
using value_type = typename at::value_type#
-
using value_type = typename at::value_type#
-
template<typename at>
struct location_store_gt# - #include <sfinae.hpp>
Public Functions
-
location_store_gt() = default#
-
location_store_gt(location_store_gt&&) = default#
-
location_store_gt(location_store_gt const&) = default#
-
location_store_gt() = default#
-
template<>
struct location_store_gt<int> : public unum::ustore::location_store_gt<collection_key_field_t># - #include <sfinae.hpp>
-
template<>
struct location_store_gt<ustore_key_t> : public unum::ustore::location_store_gt<collection_key_field_t># - #include <sfinae.hpp>
-
template<>
struct location_store_gt<collection_key_t> : public unum::ustore::location_store_gt<collection_key_field_t># - #include <sfinae.hpp>
-
template<>
struct location_store_gt<int&> : public unum::ustore::location_store_gt<collection_key_field_t># - #include <sfinae.hpp>
-
template<>
struct location_store_gt<ustore_key_t&> : public unum::ustore::location_store_gt<collection_key_field_t># - #include <sfinae.hpp>
-
template<>
struct location_store_gt<collection_key_t&> : public unum::ustore::location_store_gt<collection_key_field_t># - #include <sfinae.hpp>
-
template<typename at>
struct location_store_gt<at&># - #include <sfinae.hpp>
Public Functions
-
location_store_gt() = default#
-
location_store_gt(location_store_gt&&) = default#
-
location_store_gt(location_store_gt const&) = default#
-
location_store_gt() = default#
-
template<typename locations_without_collections_at>
struct locations_in_collection_gt# - #include <sfinae.hpp>
Public Members
-
ustore_collection_t collection#
-
ustore_collection_t collection#
-
template<>
struct locations_in_collection_gt<int> : public unum::ustore::collection_key_field_t# - #include <sfinae.hpp>
-
template<>
struct locations_in_collection_gt<ustore_key_t> : public unum::ustore::collection_key_field_t# - #include <sfinae.hpp>
-
template<typename at, typename = void>
struct places_arg_extractor_gt# - #include <sfinae.hpp>
Subclassed by unum::ustore::places_arg_extractor_gt< at & >
Public Types
-
using element_t = typename sfinae_member_extractor_gt<location_t>::value_type#
Public Functions
-
inline ustore_size_t count(location_t const &arg) noexcept#
-
inline strided_iterator_gt<ustore_key_t const> keys(location_t const &arg) noexcept#
-
inline strided_iterator_gt<ustore_collection_t const> collections(location_t const &arg) noexcept#
-
inline strided_iterator_gt<ustore_str_view_t const> fields(location_t const &arg) noexcept#
Public Static Attributes
-
static constexpr bool is_one_k = is_one<location_t>()#
-
static constexpr bool element_stores_collection_k = sfinae_has_collection_gt<element_t>::value#
-
static constexpr bool element_stores_field_k = sfinae_has_field_gt<element_t>::value#
-
using element_t = typename sfinae_member_extractor_gt<location_t>::value_type#
-
template<>
struct places_arg_extractor_gt<places_arg_t># - #include <sfinae.hpp>
Public Types
-
using location_t = places_arg_t#
Public Functions
-
inline ustore_size_t count(places_arg_t const &native) noexcept#
-
inline strided_iterator_gt<ustore_key_t const> keys(places_arg_t const &native) noexcept#
-
inline strided_iterator_gt<ustore_collection_t const> collections(places_arg_t const &native) noexcept#
-
inline strided_iterator_gt<ustore_str_view_t const> fields(places_arg_t const &native) noexcept#
Public Static Attributes
-
static constexpr bool is_one_k = false#
-
using location_t = places_arg_t#
-
template<typename at>
struct places_arg_extractor_gt<locations_in_collection_gt<at>># - #include <sfinae.hpp>
Public Types
-
using location_t = locations_in_collection_gt<at>#
Public Functions
-
inline ustore_size_t count(location_t const &arg) noexcept#
-
inline strided_iterator_gt<ustore_key_t const> keys(location_t const &arg) noexcept#
-
inline strided_iterator_gt<ustore_collection_t const> collections(location_t const &arg) noexcept#
-
inline strided_iterator_gt<ustore_str_view_t const> fields(location_t const &arg) noexcept#
-
using location_t = locations_in_collection_gt<at>#
-
template<typename at>
struct places_arg_extractor_gt<at&> : public unum::ustore::places_arg_extractor_gt<at># - #include <sfinae.hpp>
-
template<typename at, typename = void>
struct contents_arg_extractor_gt# - #include <sfinae.hpp>
-
template<>
struct contents_arg_extractor_gt<char const**># - #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(char const **strings) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(char const**) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(char const**) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(char const **strings) noexcept#
-
template<>
struct contents_arg_extractor_gt<char const*># - #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(char const *&one) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(char const*) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(char const*) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(char const *&one) noexcept#
-
template<size_t length_ak>
struct contents_arg_extractor_gt<char const[length_ak]># - #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(char const *&one) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(char const*) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(char const*) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(char const *&one) noexcept#
-
template<size_t length_ak>
struct contents_arg_extractor_gt<value_view_t[length_ak]># - #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(value_view_t *many) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(value_view_t*) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(value_view_t *many) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(value_view_t *many) noexcept#
-
template<>
struct contents_arg_extractor_gt<value_view_t># - #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(value_view_t &one) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(value_view_t) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(value_view_t &one) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(value_view_t &one) noexcept#
-
template<>
struct contents_arg_extractor_gt<contents_arg_t># - #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(contents_arg_t native) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(contents_arg_t native) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(contents_arg_t native) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(contents_arg_t native) noexcept#
- template<> nullptr_t >
- #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(std::nullptr_t) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(std::nullptr_t) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(std::nullptr_t) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(std::nullptr_t) noexcept#
- template<typename allocator_at> vector< value_view_t, allocator_at > >
- #include <sfinae.hpp>
Public Functions
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(std::vector<value_view_t, allocator_at> const &many) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> offsets(std::vector<value_view_t, allocator_at> const&) noexcept#
-
inline strided_iterator_gt<ustore_length_t const> lengths(std::vector<value_view_t, allocator_at> const &many) noexcept#
-
inline strided_iterator_gt<ustore_bytes_cptr_t const> contents(std::vector<value_view_t, allocator_at> const &many) noexcept#
-
template<typename locations_at>
-
namespace ustore
status#
- Author
Ashot Vardanian
- Date
4 Jul 2022
Defines
-
log_warning_m(format, ...)#
-
log_error_m(c_error, code, message)#
-
log_error_if_m(must_be_true, c_error, code, message)#
-
return_error_if_m(must_be_true, c_error, code, message)#
-
return_if_error_m(c_error)#
-
return_error_m(c_error, message)#
Enums
-
namespace unum
-
namespace ustore
Enums
-
class status_t#
- #include <status.hpp>
Public Functions
-
inline status_t(ustore_error_t err = nullptr) noexcept#
-
inline operator bool() const noexcept#
-
inline ~status_t() noexcept#
-
inline void throw_unhandled()#
-
inline ustore_error_t *member_ptr() noexcept#
-
inline ustore_error_t release_error() noexcept#
-
inline ustore_error_t message() const noexcept#
-
inline status_t(ustore_error_t err = nullptr) noexcept#
-
template<typename object_at>
class expected_gt# - #include <status.hpp>
Extends
std::optional
to support a status, describing empty state.Subclassed by unum::ustore::given_gt< object_at >
Public Functions
-
expected_gt() = default#
-
inline expected_gt(expected_gt &&other) noexcept#
-
inline expected_gt &operator=(expected_gt &&other) noexcept#
-
inline operator bool() const noexcept#
-
inline void throw_unhandled()#
-
template<typename hetero_at>
inline bool operator==(expected_gt<hetero_at> const &other) const noexcept#
-
template<typename hetero_at>
inline bool operator!=(expected_gt<hetero_at> const &other) const noexcept#
-
expected_gt() = default#
-
template<typename object_at>
class given_gt : public unum::ustore::expected_gt<object_at># - #include <status.hpp>
Wraps a potentially non-trivial type, like “optional”, often controlling the underlying memory of the object.
Public Functions
-
inline given_gt(status_t &&status, object_at &&default_object = object_at{}, arena_t &&arena = {nullptr})#
-
template<typename hetero_at>
inline bool operator==(expected_gt<hetero_at> const &other) const noexcept#
-
template<typename hetero_at>
inline bool operator!=(expected_gt<hetero_at> const &other) const noexcept#
-
inline void throw_unhandled()#
Protected Types
-
using base_t = expected_gt<object_at>#
-
inline given_gt(status_t &&status, object_at &&default_object = object_at{}, arena_t &&arena = {nullptr})#
-
class status_t#
-
namespace ustore
types#
- Author
Ashot Vardanian
- Date
4 Jul 2022
Functions
-
template<typename container_at>
value_view_t value_view(container_at &&container)#
-
template<typename hashable_at>
inline void hash_combine(std::size_t &seed, hashable_at const &v)# Trivial hash-mixing scheme from Boost.
-
inline ustore_vertex_role_t invert(ustore_vertex_role_t role)#
-
template<typename element_at>
constexpr ustore_doc_field_type_t ustore_doc_field()#
-
template<>
inline void swap(unum::ustore::value_ref_t &a, unum::ustore::value_ref_t &b) noexcept#
-
template<>
class hash<unum::ustore::collection_key_t> : public unum::ustore::collection_key_hash_t# - #include <types.hpp>
-
namespace unum
-
namespace ustore
-
Functions
-
template<typename ...args_at>
inline collection_key_field_t ckf(args_at&&... args)#
-
template<typename container_at>
value_view_t value_view(container_at &&container)#
-
template<typename hashable_at>
inline void hash_combine(std::size_t &seed, hashable_at const &v)# Trivial hash-mixing scheme from Boost.
-
inline ustore_vertex_role_t invert(ustore_vertex_role_t role)#
-
template<typename element_at>
constexpr ustore_doc_field_type_t ustore_doc_field()#
-
struct collection_key_t#
- #include <types.hpp>
An OOP-friendly location representation for objects in the DB. Should be used with
stride
set tosizeof(collection_key_t)
.Public Functions
-
collection_key_t() = default#
-
collection_key_t(collection_key_t const&) = default#
-
collection_key_t &operator=(collection_key_t const&) = default#
-
inline explicit collection_key_t(ustore_key_t k) noexcept#
-
inline collection_key_t in(ustore_collection_t collection) const noexcept#
-
inline collection_key_t(ustore_collection_t c, ustore_key_t k) noexcept#
-
inline bool operator==(collection_key_t const &other) const noexcept#
-
inline bool operator!=(collection_key_t const &other) const noexcept#
-
inline bool operator<(collection_key_t const &other) const noexcept#
-
inline bool operator>(collection_key_t const &other) const noexcept#
-
inline bool operator<=(collection_key_t const &other) const noexcept#
-
inline bool operator>=(collection_key_t const &other) const noexcept#
-
collection_key_t() = default#
-
struct collection_key_field_t#
- #include <types.hpp>
Subclassed by unum::ustore::locations_in_collection_gt< int >, unum::ustore::locations_in_collection_gt< ustore_key_t >
Public Functions
-
collection_key_field_t() = default#
-
inline collection_key_field_t(ustore_collection_t collection, ustore_key_t key, ustore_str_view_t field = nullptr) noexcept#
-
inline collection_key_field_t(ustore_key_t key) noexcept#
-
inline explicit collection_key_field_t(ustore_key_t key, ustore_str_view_t field) noexcept#
Public Members
-
ustore_collection_t collection = {0}#
-
ustore_key_t key = {ustore_key_unknown_k}#
-
ustore_str_view_t field = {nullptr}#
-
collection_key_field_t() = default#
-
struct edge_t#
- #include <types.hpp>
Graph Edge, or in DBMS terms - a relationship.
Public Functions
-
struct neighborship_t#
- #include <types.hpp>
An asymmetric slice of a bond/relation. Every vertex stores a list of such
neighborship_t's
in a sorted order.Friends
-
inline friend bool operator<(neighborship_t a, neighborship_t b) noexcept#
-
inline friend bool operator==(neighborship_t a, neighborship_t b) noexcept#
-
inline friend bool operator!=(neighborship_t a, neighborship_t b) noexcept#
-
inline friend bool operator<(ustore_key_t a_vertex_id, neighborship_t b) noexcept#
-
inline friend bool operator<(neighborship_t a, ustore_key_t b_vertex_id) noexcept#
-
inline friend bool operator==(ustore_key_t a_vertex_id, neighborship_t b) noexcept#
-
inline friend bool operator==(neighborship_t a, ustore_key_t b_vertex_id) noexcept#
-
inline friend bool operator<(neighborship_t a, neighborship_t b) noexcept#
-
class value_view_t#
- #include <types.hpp>
Similar to
std::optional<std::string_view>
. It’s NULL state and “empty string” states are not identical. The NULL state generally reflects missing values. Unlikeptr_range_gt<byte_t const>
, this classes layout allows easily passing it to the internals of UStore implementations without additional bit-twiddling.Public Functions
-
inline value_view_t() = default#
-
inline value_view_t(ustore_bytes_cptr_t ptr, ustore_length_t length) noexcept#
-
inline value_view_t(byte_t const *begin, std::size_t n) noexcept#
Compatibility with
std::basic_string_view
in C++17.
-
inline value_view_t(char const *c_str) noexcept#
-
template<typename char_at, typename traits_at>
inline value_view_t(std::basic_string_view<char_at, traits_at> view) noexcept#
-
inline operator bool() const noexcept#
-
inline char const *c_str() const noexcept#
-
inline bool empty() const noexcept#
-
inline ustore_bytes_cptr_t const *member_ptr() const noexcept#
-
inline ustore_length_t const *member_length() const noexcept#
-
inline bool operator==(value_view_t other) const noexcept#
-
inline bool operator!=(value_view_t other) const noexcept#
Public Static Functions
-
static inline value_view_t make_empty() noexcept#
Private Members
-
ustore_bytes_cptr_t ptr_ = nullptr#
-
ustore_length_t length_ = ustore_length_missing_k#
-
inline value_view_t() = default#
-
class value_ref_t#
- #include <types.hpp>
Public Functions
-
inline value_ref_t() = default#
-
inline value_ref_t(ustore_byte_t *ptr, ustore_length_t &offset, ustore_length_t &length) noexcept#
-
inline char const *c_str() const noexcept#
-
inline bool empty() const noexcept#
-
inline operator bool() const noexcept#
-
inline ustore_byte_t *const *member_ptr() const noexcept#
-
inline ustore_length_t const *member_offset() const noexcept#
-
inline ustore_length_t const *member_length() const noexcept#
-
inline bool operator==(value_ref_t other) const noexcept#
-
inline bool operator!=(value_ref_t other) const noexcept#
-
inline void swap(value_ref_t &other)#
Private Members
-
ustore_byte_t *ptr_ = nullptr#
-
ustore_length_t *offset_ = nullptr#
-
ustore_length_t *length_ = nullptr#
-
inline value_ref_t() = default#
-
class arena_t#
- #include <types.hpp>
A view of a tape received from the DB. Allocates no memory, but is responsible for the cleanup.
Public Functions
-
inline arena_t(ustore_database_t db) noexcept#
-
inline ~arena_t()#
-
inline ustore_arena_t *member_ptr() noexcept#
-
inline operator ustore_arena_t*() & noexcept#
-
inline ustore_database_t db() const noexcept#
-
inline arena_t(ustore_database_t db) noexcept#
-
class any_arena_t#
- #include <types.hpp>
Public Functions
-
inline any_arena_t(ustore_database_t db) noexcept#
-
inline any_arena_t(ustore_database_t db, ustore_arena_t *accessible) noexcept#
-
any_arena_t(any_arena_t&&) = default#
-
any_arena_t &operator=(any_arena_t&&) = default#
-
inline any_arena_t(any_arena_t const &other) noexcept#
-
inline any_arena_t &operator=(any_arena_t const &other) noexcept#
-
inline bool is_remote() const noexcept#
-
inline ustore_arena_t *member_ptr() noexcept#
-
inline operator ustore_arena_t*() & noexcept#
-
inline any_arena_t(ustore_database_t db) noexcept#
-
struct collection_key_hash_t#
- #include <types.hpp>
Subclassed by std::hash< unum::ustore::collection_key_t >
Public Functions
-
inline std::size_t operator()(collection_key_t const &sub) const noexcept#
-
inline std::size_t operator()(collection_key_t const &sub) const noexcept#
-
struct edge_hash_t#
- #include <types.hpp>
-
template<typename ...args_at>
-
namespace ustore
-
namespace std#
STL namespace.
Functions
-
template<>
inline void swap(unum::ustore::value_ref_t &a, unum::ustore::value_ref_t &b) noexcept#
- template<> collection_key_t > : public unum::ustore::collection_key_hash_t
- #include <types.hpp>
-
template<>