pub struct NotebookState { /* private fields */ }Expand description
Atomically-updated view of the jupyter sidecar.
The supervisor owns writes; the proxy and the /waratah/notebooks +
/waratah/cluster handlers only read. ready flips as sidecar
instances die and come back; addr changes when a restart picks a fresh
port (the old value could point at a reused port, so readers must always
go through NotebookState::sidecar_addr, never cache it).
Implementations§
Source§impl NotebookState
impl NotebookState
Sourcepub fn new(token: String, repo: String, addr: SocketAddr) -> Self
pub fn new(token: String, repo: String, addr: SocketAddr) -> Self
New state for a sidecar not yet started at addr.
Sourcepub fn repo(&self) -> &str
pub fn repo(&self) -> &str
The repository this compute serves — the only legal
env.WARATAH_REPO value (the engine writes exactly one kernelspec).
Sourcepub fn is_ready(&self) -> bool
pub fn is_ready(&self) -> bool
Whether the sidecar currently answers (GET /api 200 at last poll).
Sourcepub fn set_ready(&self, ready: bool)
pub fn set_ready(&self, ready: bool)
Supervisor writes readiness; also false while a restart is in progress.
Sourcepub async fn sidecar_addr(&self) -> SocketAddr
pub async fn sidecar_addr(&self) -> SocketAddr
Loopback address of the current sidecar instance.
Sourcepub async fn set_sidecar_addr(&self, addr: SocketAddr)
pub async fn set_sidecar_addr(&self, addr: SocketAddr)
Supervisor records the address of each (re)started instance.