Documentation
¶
Overview ¶
Package rails is the shared remote safety rails (spec 8.3).
Index ¶
- func CapNote(daily, spent, committed, job config.Micros) string
- func Check(ctx context.Context, j *remote.Job) (func(), error)
- func DropOrphan(dir, name string)
- func LedgerToday(dir string, now time.Time) config.Micros
- func LiveReservations(dir string) map[string]bool
- func OrphanNames(dir string) map[string]bool
- func Pause(dir, why string, window time.Duration) error
- func Paused(dir string, b config.Breaker, now time.Time) (string, bool)
- func PruneReservationsIn(dir string, dry bool) []string
- func RecordFailure(dir string) error
- type Ledger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check runs breaker, launch lock, cap and max_live (spec 8.3) and records a reservation; the release func drops the reservation (at the job's ledger end) and is idempotent.
func DropOrphan ¶
func DropOrphan(dir, name string)
DropOrphan removes the orphan reservation for name (its resource was confirmed gone).
func LedgerToday ¶
LedgerToday is today's (UTC) spend this host saw: the cost of every ended job that created a resource. Open launches are left out (their resource is in L, or their reservation counts), so a running job is counted once; a job that created nothing (a capacity fallback) costs nothing (spec 8.3, spec 14 "a running job is counted once").
func LiveReservations ¶
LiveReservations lists the names with a non-orphan reservation in dir/reservations.json.
func OrphanNames ¶
OrphanNames lists the names whose only reservation in dir/reservations.json is an orphan.
func PruneReservationsIn ¶
PruneReservationsIn drops expired reservations and those whose process is gone from dir/reservations.json under the launch lock (bounded wait) and returns the dropped names. With dry the file is left alone.
func RecordFailure ¶
RecordFailure: one record per 75 after BEGIN (spec 8.3 breaker).