dita_v2: VenueTelemetrySnapshot + Zinc venue plane (4th shm partition) + local Rust target dir
Upstream-canonical commit of the ~366 lines that sat uncommitted in the working tree (surveyed in DITAV2_SOA_SURVEY_20260702). Venue telemetry published at every venue boundary (submit/cancel/reconcile) over the zinc venue_region; SOA per UV DITAv2 adjudication 2026-07-03. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,7 @@ from typing import Any, Dict, Iterable, List, Mapping, Optional, Protocol
|
||||
import threading
|
||||
import time
|
||||
|
||||
from .contracts import KernelIntent, TradeSlot
|
||||
from .contracts import KernelIntent, TradeSlot, VenueTelemetrySnapshot
|
||||
from .control import KernelControlSnapshot
|
||||
|
||||
|
||||
@@ -52,6 +52,18 @@ class ZincPlane(Protocol):
|
||||
def notify_control(self) -> None:
|
||||
...
|
||||
|
||||
def publish_venue(self, telemetry: VenueTelemetrySnapshot) -> None:
|
||||
...
|
||||
|
||||
def read_venue(self) -> VenueTelemetrySnapshot:
|
||||
...
|
||||
|
||||
def wait_on_venue(self, timeout_ms: int = 1000) -> bool:
|
||||
...
|
||||
|
||||
def notify_venue(self) -> None:
|
||||
...
|
||||
|
||||
|
||||
@dataclass
|
||||
class InMemoryZincPlane:
|
||||
@@ -60,12 +72,15 @@ class InMemoryZincPlane:
|
||||
intent_region: List[KernelIntent] = field(default_factory=list)
|
||||
state_region: Dict[int, TradeSlot] = field(default_factory=dict)
|
||||
control_region: Optional[KernelControlSnapshot] = None
|
||||
venue_region: VenueTelemetrySnapshot = field(default_factory=VenueTelemetrySnapshot)
|
||||
_intent_seq: int = field(default=0, init=False, repr=False)
|
||||
_state_seq: int = field(default=0, init=False, repr=False)
|
||||
_control_seq: int = field(default=0, init=False, repr=False)
|
||||
_venue_seq: int = field(default=0, init=False, repr=False)
|
||||
_intent_observed_seq: int = field(default=0, init=False, repr=False)
|
||||
_state_observed_seq: int = field(default=0, init=False, repr=False)
|
||||
_control_observed_seq: int = field(default=0, init=False, repr=False)
|
||||
_venue_observed_seq: int = field(default=0, init=False, repr=False)
|
||||
_signal: threading.Condition = field(default_factory=threading.Condition, init=False, repr=False)
|
||||
|
||||
def publish_intent(self, intent: KernelIntent) -> None:
|
||||
@@ -118,6 +133,23 @@ class InMemoryZincPlane:
|
||||
self._control_seq += 1
|
||||
self._signal.notify_all()
|
||||
|
||||
def publish_venue(self, telemetry: VenueTelemetrySnapshot) -> None:
|
||||
with self._signal:
|
||||
self.venue_region = telemetry
|
||||
self._venue_seq += 1
|
||||
self._signal.notify_all()
|
||||
|
||||
def read_venue(self) -> VenueTelemetrySnapshot:
|
||||
return self.venue_region
|
||||
|
||||
def wait_on_venue(self, timeout_ms: int = 1000) -> bool:
|
||||
return self._wait_for_change("_venue_seq", "_venue_observed_seq", timeout_ms)
|
||||
|
||||
def notify_venue(self) -> None:
|
||||
with self._signal:
|
||||
self._venue_seq += 1
|
||||
self._signal.notify_all()
|
||||
|
||||
def _wait_for_change(self, seq_attr: str, observed_attr: str, timeout_ms: int) -> bool:
|
||||
timeout_s = None if timeout_ms is None or timeout_ms < 0 else max(0.0, timeout_ms / 1000.0)
|
||||
deadline = None if timeout_s is None else time.monotonic() + timeout_s
|
||||
|
||||
Reference in New Issue
Block a user