Documentation
¶
Overview ¶
Package daemon owns CodeGrapher's single-user background freshness process.
Index ¶
- func Run(parent context.Context, ...) error
- func RunFromEnvironment(ctx context.Context, projectPath string) error
- type Health
- type Lifecycle
- type Manager
- func (m *Manager) BrowserLink(ctx context.Context) (string, error)
- func (m *Manager) Restart(ctx context.Context, projectPath string) (Status, error)
- func (m *Manager) Start(ctx context.Context, projectPath string) (Status, error)
- func (m *Manager) Status(ctx context.Context) (Status, error)
- func (m *Manager) Stop(ctx context.Context) (Status, error)
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Health ¶
type Health struct {
Live bool `json:"live"`
WatchReady bool `json:"watchReady"`
IndexCurrent bool `json:"indexCurrent"`
PendingDirtyPaths int `json:"pendingDirtyPaths"`
WholeTreeDirty bool `json:"wholeTreeDirty"`
AcceptedGeneration uint64 `json:"acceptedGeneration"`
CompletedGeneration uint64 `json:"completedGeneration"`
LastSuccessfulUpdate time.Time `json:"lastSuccessfulUpdate,omitempty"`
LastReconciliation time.Time `json:"lastReconciliation,omitempty"`
LastOperationDuration string `json:"lastOperationDuration,omitempty"`
LastError string `json:"lastError,omitempty"`
}
Health separates process liveness, native watch coverage, and graph currency.
type Manager ¶
type Manager struct {
StateDir string
Executable string
HTTPClient *http.Client
StartTimeout time.Duration
}
Manager coordinates the one daemon owned by the current user.
func NewManager ¶
NewManager resolves default process and state locations.
func (*Manager) BrowserLink ¶ added in v0.8.0
BrowserLink returns the fragment-secret URL intended for the local user. Neither control status nor the public API contains this secret.
func (*Manager) Restart ¶
Restart stops the current owner and starts projectPath. An empty path reuses the current daemon's project.
func (*Manager) Start ¶
Start launches the daemon and waits for watch coverage, startup sync, and the startup generation barrier. A live daemon for the same path is idempotent.
type Status ¶
type Status struct {
SchemaVersion int `json:"schemaVersion"`
ControlAPIVersion int `json:"controlApiVersion"`
Lifecycle Lifecycle `json:"lifecycle"`
PID int `json:"pid,omitempty"`
ProjectPath string `json:"projectPath,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
BrowserEndpoint string `json:"browserEndpoint,omitempty"`
StartedAt time.Time `json:"startedAt,omitempty"`
ReadyAt time.Time `json:"readyAt,omitempty"`
StoppedAt time.Time `json:"stoppedAt,omitempty"`
LogPath string `json:"logPath,omitempty"`
Health Health `json:"health"`
}
Status is safe to print or encode: lifecycle credentials are never exposed.