devstate

package
v0.0.0-...-3776344 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Remove

func Remove(appDir string) error

Remove deletes the state file. No error if already absent.

func StatePath

func StatePath(appDir string) string

StatePath returns the full path to the state file for the given app directory.

func Write

func Write(appDir string, state *DevState) error

Write atomically writes the state file using a temp file + rename.

Types

type DevState

type DevState struct {
	Version        int              `json:"version"`
	ContainerID    string           `json:"containerId"`
	ContainerName  string           `json:"containerName"`
	ComposeProject string           `json:"composeProject"`
	Image          string           `json:"image"`
	HostPort       string           `json:"hostPort"`
	AppDir         string           `json:"appDir"`
	BlueprintFile  string           `json:"blueprintFile"`
	ServiceName    string           `json:"serviceName"`
	Runtime        string           `json:"runtime"`
	Handlers       []HandlerSummary `json:"handlers"`
	StartedAt      time.Time        `json:"startedAt"`
	PID            int              `json:"pid"`
	Detached       bool             `json:"detached"`
}

DevState tracks the running dev environment for coordination between dev run, dev stop, dev status, and dev logs commands.

func Load

func Load(appDir string) (*DevState, error)

Load reads and parses the state file. Returns nil if not found.

func (*DevState) IsProcessAlive

func (s *DevState) IsProcessAlive() bool

IsProcessAlive checks whether the PID recorded in the state is still running. Returns false for PID 0 (detached mode) or if the process is gone.

type HandlerSummary

type HandlerSummary struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Method string `json:"method,omitempty"`
	Path   string `json:"path,omitempty"`
}

HandlerSummary is a minimal handler description for status display.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL