prf::config::ConfigSectionView class final

Mutable, section-scoped configuration view.

This type is the object injected into modules. It exposes only one section schema, so modules cannot accidentally write keys from other sections.

Constructors, destructors, conversion operators

ConfigSectionView() defaulted

Public functions

auto apply_updates_atomically(std::span<const ConfigSectionUpdate> updates, bool* out_invalid_update = nullptr) -> bool
Applies a batch of key updates as one atomic section mutation.
auto commit() -> bool
Persists this section if it is dirty.
template<typename Key>
auto get(typename Key::value_type*const out) const -> bool
Reads one schema key using compile-time key descriptor type.
auto get_bool(std::string_view key, bool* out) const -> bool
Typed read helper for boolean keys.
auto get_bytes(std::string_view key, std::vector<uint8_t>* out) const -> bool
Typed read helper for byte-array keys.
auto get_double(std::string_view key, double* out) const -> bool
Typed read helper for floating-point keys.
auto get_int64(std::string_view key, int64_t* out) const -> bool
Typed read helper for signed integer keys.
auto get_string(std::string_view key, std::string* out) const -> bool
Typed read helper for string keys.
auto get_uint64(std::string_view key, uint64_t* out) const -> bool
Typed read helper for unsigned integer keys.
auto get_value(std::string_view key, ConfigValue* out) const -> bool
Reads one key as generic ConfigValue.
auto key_specs() const -> std::span<const SectionKeySpec>
Returns immutable key schema for this section.
auto section_name() const -> const char*
Returns section name, for example npr1.
template<typename Key>
auto set(const typename Key::value_type& value) -> bool
Writes one schema key using compile-time key descriptor type.
auto set_bool(std::string_view key, bool value) -> bool
Typed write helper for boolean keys.
auto set_bytes(std::string_view key, std::vector<uint8_t> value) -> bool
Typed write helper for byte-array keys.
auto set_double(std::string_view key, double value) -> bool
Typed write helper for floating-point keys.
auto set_int64(std::string_view key, int64_t value) -> bool
Typed write helper for signed integer keys.
auto set_string(std::string_view key, std::string value) -> bool
Typed write helper for string keys.
auto set_uint64(std::string_view key, uint64_t value) -> bool
Typed write helper for unsigned integer keys.
auto set_value(std::string_view key, const ConfigValue& value) -> bool
Stores one key value in-memory and marks section dirty.
auto valid() const -> bool
Returns true when the view is bound to a live ConfigStore section.

Function documentation

bool prf::config::ConfigSectionView::apply_updates_atomically(std::span<const ConfigSectionUpdate> updates, bool* out_invalid_update = nullptr)

Applies a batch of key updates as one atomic section mutation.

The live in-memory snapshot is not modified until every update validates successfully and the staged snapshot is persisted through the backend. When persistence fails, the previously loaded section state remains intact.

bool prf::config::ConfigSectionView::commit()

Persists this section if it is dirty.

Uses backend atomic write semantics and keeps dirty flag on failure.

template<typename Key>
bool prf::config::ConfigSectionView::get(typename Key::value_type*const out) const

Reads one schema key using compile-time key descriptor type.

Template parameters
Key Key descriptor generated by CONFIG_DEFINE_KEY_STRUCT.
Parameters
out Output value pointer.
Returns true when key exists in schema and type matches.

bool prf::config::ConfigSectionView::get_value(std::string_view key, ConfigValue* out) const

Reads one key as generic ConfigValue.

Missing keys are resolved to schema defaults.

template<typename Key>
bool prf::config::ConfigSectionView::set(const typename Key::value_type& value)

Writes one schema key using compile-time key descriptor type.

Template parameters
Key Key descriptor generated by CONFIG_DEFINE_KEY_STRUCT.
Parameters
value New in-memory value.
Returns true when key exists in schema and type matches.

bool prf::config::ConfigSectionView::set_value(std::string_view key, const ConfigValue& value)

Stores one key value in-memory and marks section dirty.

Data is persisted only after commit().