Documentation
¶
Overview ¶
Package state owns bitc's on-disk layout (spec 9).
Index ¶
- Constants
- func AccountDir(e *config.Effective) (string, error)
- func AppendHistory(path string, e Event, red *redact.Set) error
- func Check(root string) error
- func Install16(secret []byte) string
- func InstallSecret(dir string) ([]byte, error)
- func MkdirPrivate(path string) error
- func WriteFileAtomic(path string, b []byte) error
- type Event
- type Layout
- func (l Layout) AdmitLock() string
- func (l Layout) GroupUnitLock(g string, j int) string
- func (l Layout) History() string
- func (l Layout) JobDir(wt8, name string) string
- func (l Layout) JobsDir() string
- func (l Layout) NestLock(p string, i, depth int) string
- func (l Layout) PoolDir(p string) string
- func (l Layout) Reservations() string
- func (l Layout) Schema() string
- func (l Layout) SlotLock(p string, i int) string
- func (l Layout) Tickets(p string) string
Constants ¶
const SchemaVersion = 1
SchemaVersion is the state-dir schema this binary writes and understands.
Variables ¶
This section is empty.
Functions ¶
func AccountDir ¶
AccountDir is <passwd home>/.local/state/bitc/account (spec 2, 9). No env, flag or key moves it, so a private BITC_DIR or BITC_CONFIG cannot multiply the cap; only [test] accounting_dir.
func AppendHistory ¶
AppendHistory appends one redacted JSON line with a single O_APPEND write.
func Check ¶ added in v0.1.2
Check runs Open's refusals on an existing state dir without creating or writing anything; a missing dir passes, since the first command creates it 0700.
func InstallSecret ¶
InstallSecret returns the 32-byte install secret, creating it once. The file appears atomically (a full temp file linked into place), so no reader sees a partial secret; a file of any other length is an error rather than a key.
func MkdirPrivate ¶
MkdirPrivate creates path and missing parents with 0700 and checks path itself: owned by the user, not group- or world-accessible.
func WriteFileAtomic ¶
WriteFileAtomic writes b to path (0600) through a temp file and rename.
Types ¶
type Event ¶
type Event struct {
TS string `json:"ts"`
Event string `json:"event"` // start | end | starved | fallback | reaped
Pool string `json:"pool"`
Slot int `json:"slot,omitempty"`
Job string `json:"job"`
Pid int `json:"pid"`
Nested bool `json:"nested,omitempty"`
Argv []string `json:"argv"`
ArgvTruncated bool `json:"argv_truncated,omitempty"`
Cwd string `json:"cwd"`
Provider string `json:"provider"`
Resource string `json:"resource,omitempty"`
Sha string `json:"sha,omitempty"`
WaitMS *int64 `json:"wait_ms,omitempty"`
RunMS *int64 `json:"run_ms,omitempty"`
Exit *int `json:"exit,omitempty"`
Outcome string `json:"outcome,omitempty"`
Reason string `json:"reason,omitempty"`
}
Event is one history.jsonl line (spec 9). Refusals write nothing.