server

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStale

func IsStale(lf LockFile) bool

IsStale checks whether the PID in the lockfile is still alive.

func Path

func Path(home, projectID string) string

Path returns the lockfile path for the given project.

func Remove

func Remove(home, projectID string) error

Remove deletes the lockfile from disk.

func Write

func Write(home, projectID string, lf LockFile) error

Write persists a lockfile to disk, creating parent dirs as needed.

Types

type Config

type Config struct {
	Port              int
	PermissionTimeout time.Duration
}

Config controls daemon behavior.

type LockFile

type LockFile struct {
	Port  int    `json:"port"`
	Token string `json:"token"`
	PID   int    `json:"pid"`
}

LockFile is written to disk so clients can discover a running daemon.

func Read

func Read(home, projectID string) (LockFile, error)

Read loads a lockfile from disk.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the HTTP+SSE daemon.

func New

func New(a *agent.Agent, cfg Config) *Server

New constructs a Server.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, home, projectID string) error

Serve starts the HTTP server and blocks until ctx is cancelled or a signal is received. It writes a lockfile on startup and removes it on shutdown.

Jump to

Keyboard shortcuts

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