2026-09-21 11:13:53 +08:00

56 lines
2.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
"""pbl_runtime_ext —— scense_runtime 薄扩展:单事务事件+状态写入与广播(M11a/M11b)。
铁律:**不改基表**(scense_runtime / world / scene / entity 基表只读),
扩展一律落在 pbl_* 自有表(pbl_runtime_event / pbl_entity_state / pbl_world_state_snapshot)。
包出口:
from pbl_runtime_ext.init import load_pbl_runtime_ext
M11b 契约(必须与 init.py 的 env 注册、m11b_api.py 的实现三处同步,缺一即 NameError):
apply_runtime_event / poll_events / read_states / assert_append_only
pbl_runtime_broadcast_pull / pbl_runtime_broadcast_stats
"""
from .init import load_pbl_runtime_ext # noqa: F401 包出口(挂载唯一入口)
# ---- M11a ----
from .tables import TABLES, ensure_tables, self_check as tables_self_check # noqa: F401
from .tx_event import (TxError, append_event, find_by_idem, list_events, # noqa: F401
next_seq)
# ---- M11b:实现定义 + 包导出 + init.py env 注册(三处同步)----
from .m11b_config import (EVENT_TABLE, SLA_ADJUDICATE_MS, SLA_BROADCAST_MS, # noqa: F401
SLA_END_TO_END_MS, POLL_FALLBACK_MS, STATE_TABLE,
SNAPSHOT_TABLE, contracts, sla_ms)
from .rtx_db import (RtxError, dbname, q_all, q_one, transaction) # noqa: F401
from .partitions import ensure_forward_partitions # noqa: F401
from .broadcast import BroadcastHub, channel_of, get_hub # noqa: F401
from .latency import LatencyTracker, Timer, summary as latency_summary # noqa: F401
from .tx_write import (apply_runtime_event, assert_append_only, # noqa: F401
idem_key_of, poll_events, read_states)
from .m11b_api import (pbl_runtime_broadcast_pull, # noqa: F401
pbl_runtime_broadcast_stats)
from .m11b_probe import FakeEngine, run_probes # noqa: F401
from .m11b_probe import self_check as m11b_probe_self_check # noqa: F401
__all__ = [
# 挂载
"load_pbl_runtime_ext", "TABLES", "ensure_tables", "tables_self_check",
# M11a
"TxError", "append_event", "find_by_idem", "list_events", "next_seq",
# M11b 契约
"apply_runtime_event", "poll_events", "read_states", "assert_append_only",
"pbl_runtime_broadcast_pull", "pbl_runtime_broadcast_stats",
# M11b 写入路径离线探针(state_updates 非空端到端覆盖)
"run_probes", "m11b_probe_self_check", "FakeEngine",
"idem_key_of", "contracts",
# M11b 基础设施
"RtxError", "dbname", "q_all", "q_one", "transaction",
"ensure_forward_partitions", "BroadcastHub", "channel_of", "get_hub",
"LatencyTracker", "Timer", "latency_summary", "sla_ms",
"EVENT_TABLE", "STATE_TABLE", "SNAPSHOT_TABLE",
"SLA_ADJUDICATE_MS", "SLA_BROADCAST_MS", "SLA_END_TO_END_MS", "POLL_FALLBACK_MS",
]
__version__ = "1.1.0"