Documentation
¶
Overview ¶
Package daemon owns the durable local lifecycle record for the WB daemon.
The record deliberately contains scheduler ownership, rather than command output, so a later ConnectRPC/gRPC transport and the MCP adapter can use the same queue handoff contract without reading a dashboard-only file.
Index ¶
Constants ¶
const ( StateSchemaVersion = 1 QueueSchemaVersion = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provenance ¶
type Provenance struct {
Executable string `json:"executable"`
SHA256 string `json:"sha256"`
Version string `json:"version"`
Revision string `json:"revision,omitempty"`
Built string `json:"built,omitempty"`
}
Provenance identifies the exact executable trusted to own a daemon generation. SHA256 is intentionally included even when the released version is known: a development binary can otherwise look identical to a release.
func ProvenanceForExecutable ¶
func ProvenanceForExecutable(executable, version, revision, built string) (Provenance, error)
ProvenanceForExecutable produces exact local evidence for a running binary.
func (Provenance) SameBinary ¶
func (p Provenance) SameBinary(other Provenance) bool
type Queue ¶
type Queue struct {
SchemaVersion int `json:"schema_version"`
Generation uint64 `json:"generation"`
Owner Provenance `json:"owner"`
OwnerToken string `json:"owner_token"`
HandoffFrom *Provenance `json:"handoff_from,omitempty"`
HandoffAt *time.Time `json:"handoff_at,omitempty"`
}
Queue describes durable queue ownership. Operations are added by the async scheduler lane; lifecycle code preserves this object byte-for-byte apart from a fenced owner/generation transition.
type State ¶
type State struct {
SchemaVersion int `json:"schema_version"`
Status Status `json:"status"`
PID int `json:"pid,omitempty"`
OwnerToken string `json:"owner_token,omitempty"`
Listen string `json:"listen"`
Provenance Provenance `json:"provenance"`
Queue Queue `json:"queue"`
StartedAt time.Time `json:"started_at,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
State is private local state. It is never served by the dashboard API.
func NewStarting ¶
func NewStarting(previous *State, listen string, provenance Provenance, ownerToken string, now time.Time) State
NewStarting creates the next fenced queue generation. Existing queue jobs stay in the durable queue file owned by the scheduler; this record tells the replacement scheduler exactly which binary owned the preceding generation.