Cameras on devices (openpanel C1): frames in memory, a binary uplink, demand
- Volatile frames are held in memory with a byte-bounded queue instead of the /dev/shm ring scanned on every put; workers keep writing to the directory, which is trimmed on a timer. A volatile upload no longer spools to disk. ARTIFACT_VOLATILE_BYTES=0 turns the ring off. - A device sends camera frames as binary messages on its socket, held and published in one step and credited to its device node; refused frames are logged and dropped. Its snapshot carries demand and the uplink (binary, or http through the portal). - One demand registry for every socket's wanted media, the tunnel's included, plus what running flows read, mapped onto on-demand ports and published as device_demand; at most 8 media names per socket. - Per-message deflate off in serve and dev; a device may fetch the last 8 digests of a message; published dashboards cached per store revision; a revoked device socket is closed with 1008. - Media tiles want bytes only while on screen; the Devices tab previews a wired camera; the device node warns when a flow reads an on-demand port.
This commit is contained in:
@@ -655,6 +655,10 @@ class DashboardStore:
|
||||
self.root = flows.root / DASHBOARD_DIR
|
||||
# Read-modify-write of the version counter, same as the flow store.
|
||||
self._lock = threading.Lock()
|
||||
#: Published documents as last read, until the flow store commits.
|
||||
self._published: dict[str, DashboardDef | None] = {}
|
||||
self._published_at = -1
|
||||
self._published_lock = threading.Lock()
|
||||
|
||||
def _file(self, name: str) -> Path:
|
||||
return self.root / checked(name) / "dashboard.json"
|
||||
@@ -719,6 +723,24 @@ class DashboardStore:
|
||||
update={"has_draft": self.has_draft(name)}
|
||||
)
|
||||
|
||||
def published(self, name: str) -> DashboardDef | None:
|
||||
"""The published document, or None, as of the store's last commit.
|
||||
|
||||
What a device's credential is held against on every request, a camera
|
||||
fetching frame by frame included, so it is read once per commit rather
|
||||
than from disk each time. Every write commits. The document is shared:
|
||||
read it, never change it.
|
||||
"""
|
||||
with self._published_lock:
|
||||
if self._published_at != self.flows.revision:
|
||||
self._published, self._published_at = {}, self.flows.revision
|
||||
if name not in self._published:
|
||||
try:
|
||||
self._published[name] = self.read(name)
|
||||
except DashboardNotFound:
|
||||
self._published[name] = None
|
||||
return self._published[name]
|
||||
|
||||
def write(
|
||||
self, defn: DashboardDef, base_version: int | None = None
|
||||
) -> DashboardDef:
|
||||
|
||||
Reference in New Issue
Block a user