Documentation
¶
Index ¶
- Constants
- Variables
- func CleanStaleLock(sessionDir string) (bool, error)
- func CleanupStaleLocks(baseDir string) ([]string, error)
- func GetSessionDir(baseDir, sessionID string) string
- func GetSessionsDir(baseDir string) string
- func SessionExists(baseDir, sessionID string) bool
- type Info
- type Lock
- type SessionData
Constants ¶
const LockFileName = "session.lock"
LockFileName is the name of the lock file within a session directory
const SessionFileName = "session.json"
SessionFileName is the name of the session data file within a session directory
const SessionsDir = "sessions"
SessionsDir is the directory name within .claudio that contains all sessions
Variables ¶
var ErrSessionLocked = errors.New("session is locked by another process")
ErrSessionLocked is returned when attempting to acquire a lock on an already-locked session
Functions ¶
func CleanStaleLock ¶
CleanStaleLock removes a stale lock file if the owning process is no longer running. Returns true if a stale lock was cleaned.
func CleanupStaleLocks ¶
CleanupStaleLocks iterates through all sessions and removes stale lock files. Returns the IDs of sessions that had stale locks cleaned.
func GetSessionDir ¶
GetSessionDir returns the path to a specific session's directory
func GetSessionsDir ¶
GetSessionsDir returns the path to the sessions directory for a given base directory
func SessionExists ¶
SessionExists checks if a session with the given ID exists.
Types ¶
type Info ¶
type Info struct {
ID string `json:"id"`
Name string `json:"name"`
Created time.Time `json:"created"`
InstanceCount int `json:"instance_count"`
IsLocked bool `json:"is_locked"`
LockInfo *Lock `json:"lock_info,omitempty"`
SessionDir string `json:"session_dir"`
}
Info contains summary information about a session
func FindUnlockedSessions ¶
FindUnlockedSessions returns all sessions that are not currently locked.
func GetSessionInfo ¶
GetSessionInfo returns detailed information about a specific session.
func ListSessions ¶
ListSessions returns information about all sessions in the base directory. Sessions are discovered by scanning .claudio/sessions/ for subdirectories containing session.json files.
type Lock ¶
type Lock struct {
SessionID string `json:"session_id"`
PID int `json:"pid"`
Hostname string `json:"hostname"`
StartedAt time.Time `json:"started_at"`
// contains filtered or unexported fields
}
Lock represents an acquired session lock
func AcquireLock ¶
AcquireLock attempts to acquire an exclusive lock on the session directory. Returns ErrSessionLocked if the session is already in use by another process.
func IsLocked ¶
IsLocked checks if a session directory is currently locked. Returns the lock info if locked, nil otherwise.
type SessionData ¶
type SessionData struct {
ID string `json:"id"`
Name string `json:"name"`
Created time.Time `json:"created"`
Instances json.RawMessage `json:"instances"` // Keep raw to count without full parsing
}
SessionData represents the minimal session structure needed for discovery. This mirrors the Session struct from orchestrator but only includes the fields we need for listing.