Documentation
¶
Overview ¶
Package assignment implements lease-based work claims for agent sessions.
Index ¶
- Constants
- func Claim(rmiID, worker string, lease time.Duration, now time.Time, ...) (*store.Assignment, error)
- func Complete(a *store.Assignment, now time.Time) error
- func ExpireStale(a *store.Assignment, now time.Time) bool
- func Release(a *store.Assignment, now time.Time) error
- func Renew(a *store.Assignment, lease time.Duration, now time.Time) error
- func TrailerLine(rmiID string) string
Constants ¶
View Source
const ( StatusActive = "active" StatusReleased = "released" StatusExpired = "expired" StatusCompleted = "completed" )
View Source
const DefaultLease = 4 * time.Hour
DefaultLease is the default lease duration when none is specified.
Variables ¶
This section is empty.
Functions ¶
func Claim ¶
func Claim(rmiID, worker string, lease time.Duration, now time.Time, existing *store.Assignment) (*store.Assignment, error)
Claim creates an assignment for the given RMI and worker. It returns an error if the RMI already has an active, non-expired assignment.
func Complete ¶
func Complete(a *store.Assignment, now time.Time) error
Complete marks an active assignment as completed.
func ExpireStale ¶
func ExpireStale(a *store.Assignment, now time.Time) bool
ExpireStale transitions any active assignment whose lease has passed to expired.
func Release ¶
func Release(a *store.Assignment, now time.Time) error
Release marks an active assignment as released.
func Renew ¶
Renew extends an active assignment's lease. Returns an error if the assignment is not active.
func TrailerLine ¶
TrailerLine returns the git trailer string for a claimed RMI.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.