devstate

package
v0.0.0-...-bf62912 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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