pub struct RendererRegistry { /* private fields */ }Implementations§
Source§impl RendererRegistry
impl RendererRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new RendererRegistry with default settings (max_pending=100).
Use with_max_pending() to customize the limit.
Sourcepub fn with_max_pending(max_pending: usize) -> Self
pub fn with_max_pending(max_pending: usize) -> Self
Creates a new RendererRegistry with a custom max pending requests limit.
Sourcepub async fn register(&self, session: RendererSession) -> Result<RendererId>
pub async fn register(&self, session: RendererSession) -> Result<RendererId>
Registers a renderer session. Returns Ok(id) on success, or Err if the name is already in use (first-wins policy). Atomic check-and-insert ensures no race conditions with concurrent registration attempts.
Sourcepub async fn unregister(&self, id: &str, connection_id: Uuid)
pub async fn unregister(&self, id: &str, connection_id: Uuid)
Unregisters a renderer session, but only if the connection_id matches. This prevents a refused or late-cleaning-up connection from unregistering a different session that took over the name. The renderer stays listed afterwards, as disconnected.
Sourcepub async fn get_info(&self, id: &str) -> Result<RendererInfo>
pub async fn get_info(&self, id: &str) -> Result<RendererInfo>
Connected, or disconnected since this process started.
Sourcepub async fn list_info(&self) -> Vec<RendererInfo>
pub async fn list_info(&self) -> Vec<RendererInfo>
Connected renderers plus ones that disconnected since this process
started — check RendererInfo::is_connected to tell them apart.
Sourcepub fn graphic_in_use(&self, graphic_id: &str) -> bool
pub fn graphic_in_use(&self, graphic_id: &str) -> bool
Whether any connected renderer has an instance of graphic_id —
a deleted graphic’s files stay until this is false.
Sourcepub async fn send_and_await(
&self,
renderer_id: &str,
build: impl FnOnce(Uuid) -> ServerMessage,
timeout: Duration,
) -> Result<RendererMessage>
pub async fn send_and_await( &self, renderer_id: &str, build: impl FnOnce(Uuid) -> ServerMessage, timeout: Duration, ) -> Result<RendererMessage>
Sends a command to a renderer and waits for its correlated result. The OGraf spec requires load()/playAction()/etc HTTP responses to reflect what actually happened inside the GraphicInstance, so this is the only way commands reach a renderer — no fire-and-forget.
Sourcepub async fn resolve(
&self,
renderer_id: &str,
request_id: Uuid,
message: RendererMessage,
)
pub async fn resolve( &self, renderer_id: &str, request_id: Uuid, message: RendererMessage, )
Applies a renderer-confirmed result to session state (so GET renderer
endpoints reflect renderer-confirmed truth, not what was merely sent)
and wakes up the HTTP handler awaiting it via send_and_await, if any.