Opsmaru.Incus.Session (opsmaru_incus v0.1.0)

Copy Markdown View Source

Native exec/console channels and controls, retaining accepted operation identity.

Summary

Functions

Close the local channels without cancelling Incus. A console's control channel receives the pinned 1000 "Detaching from console" close frame.

Send the native write barrier without closing output/control channels.

Collect creator-owned live noninteractive exec output through two binary sinks returning :ok. Pass finite binary :stdin to write it while both outputs drain, or send it with input/2 first; collection sends the write barrier, closes local channels after collection starts and never cancels Incus. :timeout covers collection, callbacks and final operation wait (at most the connection's stream timeout); :max_output_bytes bounds stdout + stderr and :stdin is bounded by the connection's max_stream_bytes. Returns final :operation, native :exit_status and per-stream byte counts. A limit fails visibly rather than truncating. Recorded/interactive sessions and foreign creators reject before IO. See docs/incus-client.md for scope.

Attach to an instance console as the pinned ConsoleInstance does: the body is an InstanceConsolePost (type defaults to "console"), and the control channel opens before channel 0. Other accepted channels are ignored. Missing secrets fail closed with the accepted operation and open no channel. Hosts drive frames, barriers and resize explicitly; close/1 detaches.

Receive one frame; the default channel is 0 for a console and 1 for exec.

Submit live noninteractive exec and exchange finite binary stdin with acknowledged output sinks concurrently. Options are :timeout, :max_input_bytes and :max_output_bytes, capped by connection limits. One lifetime covers submission through completion. Local failures never cancel or replay Incus; known accepted identity remains usable through the original client. See docs/incus-client.md.

Functions

close(session)

Close the local channels without cancelling Incus. A console's control channel receives the pinned 1000 "Detaching from console" close frame.

close_input(session)

Send the native write barrier without closing output/control channels.

collect(session, stdout, stderr, opts \\ [])

Collect creator-owned live noninteractive exec output through two binary sinks returning :ok. Pass finite binary :stdin to write it while both outputs drain, or send it with input/2 first; collection sends the write barrier, closes local channels after collection starts and never cancels Incus. :timeout covers collection, callbacks and final operation wait (at most the connection's stream timeout); :max_output_bytes bounds stdout + stderr and :stdin is bounded by the connection's max_stream_bytes. Returns final :operation, native :exit_status and per-stream byte counts. A limit fails visibly rather than truncating. Recorded/interactive sessions and foreign creators reject before IO. See docs/incus-client.md for scope.

console(client, instance, body)

Attach to an instance console as the pinned ConsoleInstance does: the body is an InstanceConsolePost (type defaults to "console"), and the control channel opens before channel 0. Other accepted channels are ignored. Missing secrets fail closed with the accepted operation and open no channel. Hosts drive frames, barriers and resize explicitly; close/1 detaches.

control(session, body)

exec(client, instance, body)

exit_status(session)

input(session, bytes)

output(session, channel \\ :default, timeout \\ 5000)

Receive one frame; the default channel is 0 for a console and 1 for exec.

resize(session, width, height)

run(client, instance, body, stdin, stdout, stderr, opts \\ [])

Submit live noninteractive exec and exchange finite binary stdin with acknowledged output sinks concurrently. Options are :timeout, :max_input_bytes and :max_output_bytes, capped by connection limits. One lifetime covers submission through completion. Local failures never cancel or replay Incus; known accepted identity remains usable through the original client. See docs/incus-client.md.

signal(session, signal)