Documentation
¶
Index ¶
- Variables
- func DefaultRoot(home string) string
- func EnsureNoLiveSessions(stateDir string) error
- func ReapStaleSessions(stateDir string) (int, error)
- func WriteSessionMetadata(sessionDir string, metadata SessionMetadata) error
- type Environment
- type EnvironmentNotFoundError
- type Health
- type ListIssue
- type Session
- type SessionMetadata
- type SessionStatus
- type Store
- func (s Store) BundlesDir() string
- func (s Store) CheckAvailableName(name string) error
- func (s Store) Create(manifest config.Manifest) (Environment, error)
- func (s Store) Ensure() (config.GlobalConfig, error)
- func (s Store) EnvDir(name string) string
- func (s Store) EnvironmentNames() ([]string, error)
- func (s Store) EnvsDir() string
- func (s Store) List(strict bool) ([]Environment, error)
- func (s Store) ListWithIssues(strict bool) ([]Environment, []ListIssue, error)
- func (s Store) Load(name string, strict bool) (Environment, error)
- func (s Store) LocksDir() string
- func (s Store) LogsDir() string
- func (s Store) ManifestPath(name string) string
- func (s Store) Publish(staged Environment) (Environment, error)
- func (s Store) ReadHealth(env Environment) Health
- func (s Store) Remove(name, importID string) (string, error)
- func (s Store) Save(env Environment) error
- func (s Store) SaveStaged(env Environment) error
- func (s Store) Stage(manifest config.Manifest) (Environment, error)
- func (s Store) TrashDir() string
Constants ¶
This section is empty.
Variables ¶
var ( ErrLiveSession = errors.New("environment has a live session") ErrSessionStateIndeterminate = errors.New("environment session state is indeterminate") )
var ErrEnvironmentNotFound = errors.New("environment not found")
Functions ¶
func DefaultRoot ¶
func EnsureNoLiveSessions ¶
EnsureNoLiveSessions fails closed: a proven live session blocks removal, and malformed/unreadable state also blocks removal because it is not proof of staleness.
func ReapStaleSessions ¶
ReapStaleSessions removes only markers whose PID is gone or whose process start identity no longer matches. Indeterminate markers are preserved and returned as an error for diagnostics.
func WriteSessionMetadata ¶
func WriteSessionMetadata(sessionDir string, metadata SessionMetadata) error
Types ¶
type Environment ¶
type EnvironmentNotFoundError ¶
type EnvironmentNotFoundError struct{ Name string }
func (*EnvironmentNotFoundError) Error ¶
func (e *EnvironmentNotFoundError) Error() string
func (*EnvironmentNotFoundError) Is ¶
func (e *EnvironmentNotFoundError) Is(target error) bool
type Session ¶
type Session struct {
Dir string
Kind string
Metadata SessionMetadata
Status SessionStatus
Err error
}
func InspectSessions ¶
InspectSessions examines both interactive shell and exec-style session markers. Malformed or unreadable metadata is indeterminate, never stale.
type SessionMetadata ¶
type SessionMetadata struct {
Schema int `json:"schema"`
PID int `json:"pid"`
ProcessStart string `json:"process_start"`
CreatedAt time.Time `json:"created_at"`
}
func NewSessionMetadata ¶
func NewSessionMetadata() (SessionMetadata, error)
NewSessionMetadata records the same PID/start-time identity used by advisory lock metadata, so PID reuse cannot make an abandoned session look live.
func NewSessionMetadataForPID ¶
func NewSessionMetadataForPID(pid int) (SessionMetadata, error)
type SessionStatus ¶
type SessionStatus string
const ( SessionLive SessionStatus = "live" SessionStale SessionStatus = "stale" SessionIndeterminate SessionStatus = "indeterminate" )
type Store ¶
func FromProcess ¶
func (Store) BundlesDir ¶
func (Store) CheckAvailableName ¶
func (Store) EnvironmentNames ¶
func (Store) ListWithIssues ¶
func (s Store) ListWithIssues(strict bool) ([]Environment, []ListIssue, error)
ListWithIssues returns every loadable environment and reports corrupt entries independently so one damaged manifest does not hide unrelated environments.
func (Store) ManifestPath ¶
func (Store) Publish ¶
func (s Store) Publish(staged Environment) (Environment, error)
func (Store) ReadHealth ¶
func (s Store) ReadHealth(env Environment) Health
func (Store) Save ¶
func (s Store) Save(env Environment) error
func (Store) SaveStaged ¶
func (s Store) SaveStaged(env Environment) error