Documentation
¶
Overview ¶
Package attachment coordinates live CLI clients of one run.
Index ¶
- func Attached(paths state.ProjectPaths, runID string) (bool, error)
- func Bind(paths state.ProjectPaths, id, runID string) error
- func CurrentLaunchOrigin() model.LaunchOrigin
- func EnableRun(paths state.ProjectPaths, runID string) error
- func Enabled(paths state.ProjectPaths, runID string) bool
- func Forget(paths state.ProjectPaths, id string) error
- func ForgetRun(paths state.ProjectPaths, runID string) error
- func IsAttached(paths state.ProjectPaths, runID string) (bool, error)
- func NewID() (string, error)
- func SameLaunchOrigin(recorded *model.LaunchOrigin, current model.LaunchOrigin) bool
- type Info
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attached ¶
func Attached(paths state.ProjectPaths, runID string) (bool, error)
Attached reports whether a run has any live client sessions. Sessions whose liveness cannot be disproved (notably remote hosts) remain attached.
func Bind ¶
func Bind(paths state.ProjectPaths, id, runID string) error
Bind commits the pending initiating session to a run. It also marks that run as using session-derived attachment state, replacing the legacy boolean.
func CurrentLaunchOrigin ¶
func CurrentLaunchOrigin() model.LaunchOrigin
CurrentLaunchOrigin is the process that ran this rotari command: its parent, such as the shell or script, on this host. Like a shell's wait, wait without a selector follows the runs that the same process started.
func EnableRun ¶
func EnableRun(paths state.ProjectPaths, runID string) error
EnableRun marks a newly started run as using session-derived attachment state. Older runs without this marker retain their lock-boolean fallback.
func Enabled ¶
func Enabled(paths state.ProjectPaths, runID string) bool
Enabled reports whether a run has session-derived attachment state.
func Forget ¶
func Forget(paths state.ProjectPaths, id string) error
Forget removes a stale or handled session record after the caller has applied its disconnect policy. It does not remove a live session lock.
func ForgetRun ¶
func ForgetRun(paths state.ProjectPaths, runID string) error
ForgetRun removes a deleted run's attachment marker and the session records bound to it whose locks are not held. A live client's session is left for that client to close.
func IsAttached ¶
func IsAttached(paths state.ProjectPaths, runID string) (bool, error)
IsAttached derives current attachment state, retaining compatibility with active runs created before session records were introduced.
func SameLaunchOrigin ¶
func SameLaunchOrigin(recorded *model.LaunchOrigin, current model.LaunchOrigin) bool
SameLaunchOrigin reports whether a run's recorded origin is current: the same PID in the same host and PID namespace (state.ProcessIdentity.Locate). A start time known on both sides must match, so a reused PID never matches. An origin from an earlier rotari, without a namespace, matches on host and PID as before.
Types ¶
type Info ¶
type Info struct {
ID string
RunID string
PID int
Host string
Disconnect string
Initiator bool
Live bool
}
Info describes one live or unexpectedly lost client session.
func Scan ¶
func Scan(paths state.ProjectPaths, runID string) (live, stale []Info, err error)
Scan returns live sessions and sessions proved stale on this host. A stale initiating session configured to cancel is returned so the supervisor can apply that policy; callers should treat scan errors as uncertainty.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session owns a process-held advisory lock. The lock is released by the kernel on process death, including SIGKILL, and remains held while stopped.
func Open ¶
func Open(paths state.ProjectPaths, runID, id, disconnectAction string) (*Session, error)
Open registers a client that attaches to an existing run.
func OpenPending ¶
func OpenPending(paths state.ProjectPaths, id, disconnectAction string) (*Session, error)
OpenPending reserves an initiating client session before run startup. Bind associates it with the accepted run without releasing the process lock.