feat(ttp): E.1.11 RuleStore contract — base ABC, factory, filesystem + database stubs
Adds decnet/ttp/store/ subpackage: - base.py: RuleState frozen dataclass, RuleChange NamedTuple, RuleStore ABC - factory.py: get_rule_store() reading DECNET_TTP_RULE_STORE_TYPE - impl/filesystem.py: FilesystemRuleStore with sys.platform=='linux' fail-fast guard, allowlist filename regex, raw inotify mask bits (lib import deferred to E.3 so contract phase compiles without the asyncinotify dep installed) - impl/database.py: DatabaseRuleStore stub (no platform guard) TTPRule + TTPRuleState SQLModels were already shipped at E.1.1; this commit closes the type-only TYPE_CHECKING forward-ref in rule_engine.py via real runtime imports through the new package.
This commit is contained in:
25
decnet/ttp/store/__init__.py
Normal file
25
decnet/ttp/store/__init__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""TTP rule store — pluggable backend for rule definitions + state.
|
||||
|
||||
Contract step E.1.11 of ``development/TTP_TAGGING.md``. Two backends
|
||||
ship:
|
||||
|
||||
* :class:`FilesystemRuleStore` — reads ``./rules/ttp/`` at projroot,
|
||||
inotify-watches for hot-reload, holds operational state in-process.
|
||||
Linux-only (the inotify dependency is non-portable by design).
|
||||
* :class:`DatabaseRuleStore` — mirrors rule content into ``ttp_rule``
|
||||
with state in ``ttp_rule_state``; survives restart and propagates
|
||||
to every worker in a swarm.
|
||||
|
||||
Selection via ``DECNET_TTP_RULE_STORE_TYPE`` (default ``"filesystem"``).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from decnet.ttp.store.base import RuleChange, RuleState, RuleStore
|
||||
from decnet.ttp.store.factory import get_rule_store
|
||||
|
||||
__all__ = [
|
||||
"RuleChange",
|
||||
"RuleState",
|
||||
"RuleStore",
|
||||
"get_rule_store",
|
||||
]
|
||||
Reference in New Issue
Block a user