pub struct MachineRoom { /* private fields */ }Implementations§
Source§impl MachineRoom
impl MachineRoom
pub fn repository(&self) -> u64
pub fn windows(&self) -> HashMap<u64, Window>
Sourcepub fn files(&self) -> HashMap<u64, FilesState>
pub fn files(&self) -> HashMap<u64, FilesState>
Each Files window’s folder and view, by window id.
pub fn status(&self) -> MachineStatus
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
The repository’s name, so a guest who joined by code knows what it is.
Sourcepub fn private(&self) -> bool
pub fn private(&self) -> bool
Its connections go out only from a residential address, billed per GB to whoever pays for the machine. Stays true while private is paused.
Sourcepub fn private_reason(&self) -> String
pub fn private_reason(&self) -> String
Why private is paused while it reconnects, like a payer out of balance. Its internet is cut until then. Empty while private carries traffic, or is off.
Sourcepub fn hydrate(&self, state: &Value)
pub fn hydrate(&self, state: &Value)
Apply a connection snapshot { machine, bootstrap, cursor, windows }.
pub fn watch(&self, hooks: Arc<dyn MachineRoomHooks>)
pub async fn invoke_tool(&self, tool: &MachineTool) -> Result<String>
Sourcepub async fn exec(&self, command: &str, opts: ExecOptions) -> Result<ExecResult>
pub async fn exec(&self, command: &str, opts: ExecOptions) -> Result<ExecResult>
Run a shell command as agent in /repository with DISPLAY=:0, so GUI apps open as desktop windows.
Sourcepub async fn set_viewport(&self, width: f64, height: f64) -> Result<()>
pub async fn set_viewport(&self, width: f64, height: f64) -> Result<()>
Size the machine’s desktop to this seat’s screen, clamped to VIEWPORT. Only the controller can.
Sourcepub async fn open(&self, path: &str) -> Result<()>
pub async fn open(&self, path: &str) -> Result<()>
Open a file in an app on the machine, for everyone to see: text in nano inside an xterm, anything else with an installed opener. Only the controller can.
Sourcepub async fn set_files(&self, window: u64, files: &FilesState) -> Result<()>
pub async fn set_files(&self, window: u64, files: &FilesState) -> Result<()>
Put a Files window on a folder and view for every seat. Only the controller can.
Sourcepub async fn stop(&self) -> Result<()>
pub async fn stop(&self) -> Result<()>
Save a new revision and shut down. The room closes afterwards.
pub fn parrot_tools(&self) -> Vec<Tool>
pub fn handle_event(&self, packet: &Value) -> bool
Sourcepub async fn start(
authorization: &CredentialsOrApiKey,
repository: u64,
opts: StartOptions,
) -> Result<(MachineRoom, Presence)>
pub async fn start( authorization: &CredentialsOrApiKey, repository: u64, opts: StartOptions, ) -> Result<(MachineRoom, Presence)>
Boot the repository’s machine, or return the one already live, and connect to it.
private sends its connections out from a residential address, billed per GB to
whoever pays for the machine; on a live machine it switches it.
Sourcepub async fn shutdown(
authorization: &CredentialsOrApiKey,
repository: u64,
opts: GroupOptions,
) -> Result<()>
pub async fn shutdown( authorization: &CredentialsOrApiKey, repository: u64, opts: GroupOptions, ) -> Result<()>
Save and shut down a repository’s machine without joining its room. For its owner or group members.
Sourcepub async fn set_private(
authorization: &CredentialsOrApiKey,
repository: u64,
on: bool,
opts: GroupOptions,
) -> Result<PrivateState>
pub async fn set_private( authorization: &CredentialsOrApiKey, repository: u64, on: bool, opts: GroupOptions, ) -> Result<PrivateState>
Turn private on or off for a repository’s live machine, for its owner or group members. Resolves to the machine’s private state and, while it’s paused, why.
Sourcepub async fn connect(
authorization: &CredentialsOrApiKey,
target: &MachineTarget,
opts: MachineOptions,
) -> Result<(MachineRoom, Presence)>
pub async fn connect( authorization: &CredentialsOrApiKey, target: &MachineTarget, opts: MachineOptions, ) -> Result<(MachineRoom, Presence)>
Connect to a live machine by id, or by its termite:machine:{id} reference.
Sourcepub async fn join(
authorization: &CredentialsOrApiKey,
access_code: &str,
opts: MachineOptions,
) -> Result<(MachineRoom, Presence)>
pub async fn join( authorization: &CredentialsOrApiKey, access_code: &str, opts: MachineOptions, ) -> Result<(MachineRoom, Presence)>
Join a machine someone shared with an access code.
Methods from Deref<Target = PageRoom>§
pub fn web(&self) -> &WebRoom
pub fn cursor(&self) -> HtmlPointer
pub fn enabled_tools(&self) -> &HashSet<String>
Sourcepub fn controller(&self) -> Option<String>
pub fn controller(&self) -> Option<String>
The seat (presence id) whose actions run.
pub fn watch(&self, hooks: Arc<dyn BrowserRoomHooks>)
Sourcepub fn controlling(&self, me: &Presence) -> bool
pub fn controlling(&self, me: &Presence) -> bool
Whether your actions run: you control it and no agent holds it.
Sourcepub async fn set_controller(&self, seat: Option<&str>) -> Result<()>
pub async fn set_controller(&self, seat: Option<&str>) -> Result<()>
Hand control to a seat, or take it yourself without one. While an agent holds the room this stops the agent.
Sourcepub fn emit_presence(&self)
pub fn emit_presence(&self)
Presence changed: tell whoever is watching now.
pub fn emit_closed(&self)
pub async fn invoke_tool(&self, tool: &BrowserTool) -> Result<String>
pub fn parrot_tools(&self) -> Vec<Tool>
pub fn handle_event(&self, packet: &Value) -> bool
Methods from Deref<Target = Room>§
pub fn endpoint(&self) -> &str
pub fn ws(&self) -> RoomSocket
pub fn id(&self) -> &str
pub fn get_presences(&self) -> Vec<Presence>
The caller’s Credentials or ApiKey from the live authorization pack.