scene_service.scene_graph.store¶
Live scene graph plus the on-disk relation cache.
Two asyncio writers own disjoint slices: the geometric loop writes nodes and geometric edges, the builder writes semantic edges. The relation cache is persisted as JSON so a restart does not re-ask the LLM about every pair; its I/O failures only cost a redundant call.
Classes
|
In-memory live graph (two writer slices) + on-disk relation cache. |
- class scene_service.scene_graph.store.SceneGraphStore(cache_dir: str = '/data/robonix/scene_graph/cache', map_id: str | None = None)[source]¶
Bases:
objectIn-memory live graph (two writer slices) + on-disk relation cache.
- get_cached_relation(a: SceneGraphNode, b: SceneGraphNode, hint: GeometryHint, semantic_only: bool = False) SceneGraphEdge | None[source]¶
- get_geometric_edges() list[SceneGraphEdge][source]¶
- get_semantic_edges() list[SceneGraphEdge][source]¶
- get_snapshot() SceneGraphSnapshot | None[source]¶
Both slices composed for readers, or None before anything was published. A (source, target, relation) in both slices is kept once, geometric first.
- invalidate_object(object_id: str) int[source]¶
Drop the cached relations that mention one object; returns how many. Callers decide when a disk flush is worth it.
- prune_relations(live_object_ids: set[str]) int[source]¶
Drop cached edges with an endpoint no longer in the registry.
- put_cached_relation(a: SceneGraphNode, b: SceneGraphNode, hint: GeometryHint, edge: SceneGraphEdge, semantic_only: bool = False) None[source]¶
- set_geometric(nodes: list[SceneGraphNode], edges: list[SceneGraphEdge]) None[source]¶
- set_semantic_edges(edges: list[SceneGraphEdge]) None[source]¶