pub struct MachineRoom { /* private fields */ }Implementations§
Source§impl MachineRoom
impl MachineRoom
pub fn repository(&self) -> u64
pub fn cursor(&self) -> HtmlPointer
Sourcepub fn controller(&self) -> Option<String>
pub fn controller(&self) -> Option<String>
The seat (presence id) whose actions run.
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, control, cursor, windows, files, private }. The
desktop’s copy follows the connection as a bootstrap of this seat’s own.
pub fn watch(&self, hooks: Arc<dyn MachineRoomHooks>)
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 machine 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)
Sourcepub async fn invoke_tool(&self, tool: &MachineTool) -> Result<String>
pub async fn invoke_tool(&self, tool: &MachineTool) -> Result<String>
Run a tool as this seat. Only the controller’s tools run. wait pauses here, at most
WAIT_MAX_SECONDS.
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 and code in an editor window, images, PDFs, video and audio in a preview, 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>
Sourcepub fn handle_binary(&self, data: &[u8]) -> bool
pub fn handle_binary(&self, data: &[u8]) -> bool
A binary frame: an app frame reaches on_app_frame.
Sourcepub fn repaint(&self, window: u32)
pub fn repaint(&self, window: u32)
Ask for a whole picture of app window window, after a frame of it was skipped. Anyone
in the room can.
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.
spec is what it asks for; room.spec() is what it was granted, and a live machine
keeps its own. 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 = 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.