Sprites.Session (Sprites v0.2.0)
View SourceSession management for sprites.
Sessions represent active command executions that can be listed and attached to.
Summary
Functions
Represents an active execution session.
Creates a session from a map.
Returns how long ago the last activity was.
Returns true if the session has recent activity (within 5 minutes).
Lists all active sessions for a sprite.
Lists all active sessions for a sprite by name.
Types
@type t() :: %Sprites.Session{ bytes_per_second: float(), command: String.t(), created: DateTime.t() | nil, id: String.t(), is_active: boolean(), last_activity: DateTime.t() | nil, tty: boolean(), workdir: String.t() | nil }
Functions
Represents an active execution session.
Fields
:id- Unique session identifier:command- The command being executed:workdir- Working directory:created- When the session was created (DateTime):bytes_per_second- Throughput rate:is_active- Whether the session is currently active:last_activity- Time of last activity (DateTime):tty- Whether TTY is enabled
Creates a session from a map.
Returns how long ago the last activity was.
Returns true if the session has recent activity (within 5 minutes).
@spec list(Sprites.Sprite.t()) :: {:ok, [t()]} | {:error, term()}
Lists all active sessions for a sprite.
Examples
{:ok, sessions} = Sprites.Session.list(sprite)
@spec list_by_name(Sprites.Client.t(), String.t()) :: {:ok, [t()]} | {:error, term()}
Lists all active sessions for a sprite by name.