State-layer proxy (SPEC-035).
Exposes warm store, cold storage helpers, snapshots, event log, state facts, and the storage router.
Source code in crp/sdk/proxies_more.py
| class _StateProxy:
"""State-layer proxy (SPEC-035).
Exposes warm store, cold storage helpers, snapshots, event log, state facts,
and the storage router.
"""
def __init__(self, orchestrator: Any) -> None:
self._orchestrator = orchestrator
def warm_store(self) -> Any:
"""Return the orchestrator's ``WarmStateStore``.
Returns:
WarmStateStore instance.
"""
return getattr(self._orchestrator, "warm_store", None)
def cold_storage(self) -> Any:
"""Return cold-storage helpers.
Returns:
SimpleNamespace with ``persist_to_cold`` and ``restore_from_cold``.
"""
from crp.state.cold_storage import persist_to_cold, restore_from_cold
return SimpleNamespace(persist=persist_to_cold, restore=restore_from_cold)
def snapshot(self) -> Any:
"""Return a fresh ``EventLogSnapshot``.
Returns:
EventLogSnapshot instance.
"""
from crp.state.snapshot import EventLogSnapshot
return EventLogSnapshot()
def event_log(self) -> Any:
"""Return a fresh ``FactEventLog``.
Returns:
FactEventLog instance.
"""
from crp.state.event_log import FactEventLog
return FactEventLog()
def fact(self) -> Any:
"""Return a sample ``StateFact`` wrapping a default ``Fact``.
Returns:
StateFact instance.
"""
from crp.extraction.types import Fact
from crp.state.fact import StateFact
return StateFact(Fact(id="sdk_sample", text="Sample state fact."))
def router(self) -> Any:
"""Return a fresh ``StorageRouter``.
Returns:
StorageRouter instance.
"""
from crp.state.storage import StorageRouter
return StorageRouter()
|
warm_store()
Return the orchestrator's WarmStateStore.
Returns:
Source code in crp/sdk/proxies_more.py
| def warm_store(self) -> Any:
"""Return the orchestrator's ``WarmStateStore``.
Returns:
WarmStateStore instance.
"""
return getattr(self._orchestrator, "warm_store", None)
|
cold_storage()
Return cold-storage helpers.
Returns:
| Type | Description |
Any | SimpleNamespace with persist_to_cold and restore_from_cold. |
Source code in crp/sdk/proxies_more.py
| def cold_storage(self) -> Any:
"""Return cold-storage helpers.
Returns:
SimpleNamespace with ``persist_to_cold`` and ``restore_from_cold``.
"""
from crp.state.cold_storage import persist_to_cold, restore_from_cold
return SimpleNamespace(persist=persist_to_cold, restore=restore_from_cold)
|
snapshot()
Return a fresh EventLogSnapshot.
Returns:
| Type | Description |
Any | EventLogSnapshot instance. |
Source code in crp/sdk/proxies_more.py
| def snapshot(self) -> Any:
"""Return a fresh ``EventLogSnapshot``.
Returns:
EventLogSnapshot instance.
"""
from crp.state.snapshot import EventLogSnapshot
return EventLogSnapshot()
|
event_log()
Return a fresh FactEventLog.
Returns:
Source code in crp/sdk/proxies_more.py
| def event_log(self) -> Any:
"""Return a fresh ``FactEventLog``.
Returns:
FactEventLog instance.
"""
from crp.state.event_log import FactEventLog
return FactEventLog()
|
fact()
Return a sample StateFact wrapping a default Fact.
Returns:
Source code in crp/sdk/proxies_more.py
| def fact(self) -> Any:
"""Return a sample ``StateFact`` wrapping a default ``Fact``.
Returns:
StateFact instance.
"""
from crp.extraction.types import Fact
from crp.state.fact import StateFact
return StateFact(Fact(id="sdk_sample", text="Sample state fact."))
|
router()
Return a fresh StorageRouter.
Returns:
Source code in crp/sdk/proxies_more.py
| def router(self) -> Any:
"""Return a fresh ``StorageRouter``.
Returns:
StorageRouter instance.
"""
from crp.state.storage import StorageRouter
return StorageRouter()
|