tlcconfig.projection¶
Storage projections for configuration values.
A projection is the backing store for a config key’s provenanced writes. The default in-memory projection keeps values in the process; other projections delegate to a process-wide native registry (e.g. the URL-alias registry in Rust) so native code and Python config share one source of truth.
- class:
~tlcconfig.store.ConfigStoredispatches every storage operation through the projection bound to an option viaOption.projection, so the store carries no per-key branches: adding a native-backed option is a matter of implementing an adapter and tagging the option.
This mirrors the Rust tlc-config::ConfigProjection trait — domains own
their projections and implement a uniform interface (notably clear_source
for reload teardown) so the configuration layer treats them generically.
Module Contents¶
Classes¶
Class |
Description |
|---|---|
Backing store for the provenanced writes of one or more config keys. |
Data¶
Data |
Description |
|---|---|
API¶
- class ConfigProjection¶
Bases:
typing.ProtocolBacking store for the provenanced writes of one or more config keys.
A projection records writes tagged by
(source, source_info)and exposes them back as :class:~tlcconfig.store.ProvenancedItemlists, from which the store synthesizes its merged / per-tier / provenance views. The store owns those reductions once; a projection only has to store and surface items, so every projection — in-memory or native-backed — shares the same precedence logic.Implementations are responsible for their own thread-safety.
- clear_source(
- source: ConfigSource,
- source_info: str | None,
Drop every entry contributed by
(source, source_info)— the reload teardown.
- items(
- key: str,
Return the per-item view the store’s read reductions consume.
- remove_item(
- key: str,
- sub_key_or_value: Any,
- source: ConfigSource,
- source_info: str | None,
Remove a single sub-element at the given tier; return whether one was removed.
- set_raw(
- key: str,
- value: Any,
- source: ConfigSource,
- source_info: str | None,
Additively record a write, splitting compounds into per-item entries.
- MEMORY_PROJECTION = memory¶
- NATIVE_ALIAS_PROJECTION = native-aliases¶