Documentation
¶
Overview ¶
Package tasksd runs the task service.
It is the whole of what `tasksd serve` does, as a function, so a process that wants to run several garm components together for development can start this one the same way the binary does — with a context it cancels and a configuration it built, rather than flags and an environment. cmd/tasksd is flag parsing and a call to Serve.
Index ¶
Constants ¶
const ContractVersion = "v0.17.0"
ContractVersion is the version of the garm contracts this build was generated against, advertised beside the wire shape so a daemon can tell which contract this process implements.
Variables ¶
This section is empty.
Functions ¶
func Serve ¶
Serve runs the service until ctx is cancelled, then drains.
The order is fixed and every step before the first subscription is a refusal that changes nothing: the key set, the database and its migrations, the broker, then the endpoints. A service that came up without one of them would advertise itself and refuse every call, which reads as an outage rather than as the configuration mistake it is.
Types ¶
type Config ¶
type Config struct {
// NATS is the broker to serve on.
NATS string
// Postgres is the DSN of this service's own database. It is migrated at
// startup and the service refuses to start if it cannot be reached.
Postgres string
// GrantKeys is the JWKS document the approvals presented to decide_task
// are verified against — the key set of the token service that mints
// them. Without it no approval can be checked, and the service refuses
// to start rather than accept decisions it cannot verify.
GrantKeys []byte
// Concurrency bounds the calls in flight. Zero takes the runtime's own
// default.
Concurrency int
// ClaimTTL is how long a claim holds before anybody may release it.
// Zero takes the service's default.
ClaimTTL time.Duration
// SweepEvery is how often tasks that ran out of time are marked
// expired. Zero takes a minute.
SweepEvery time.Duration
// Signal is where a decision is delivered. Zero publishes on the broker
// this service is connected to, which is what a deployment wants; a
// process that runs the runner beside this one can hand in its own.
Signal tasks.Signaller
// Version is what the service advertises to the broker. A caller that
// leaves it empty gets a development version.
Version string
// Log is where this service writes. Zero is a text handler on stderr.
Log *slog.Logger
}
Config is everything the service needs to run. Nothing here is read from the environment: a caller that wants environment variables reads them and fills this in, which is what makes one process able to run two of these.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
tasksd
command
Command tasksd serves garm.tasks.v1 over NATS.
|
Command tasksd serves garm.tasks.v1 over NATS. |
|
internal
|
|
|
signal
Package signal publishes a decision to the run waiting for it.
|
Package signal publishes a decision to the run waiting for it. |
|
store
Package store is tasksd's Postgres: the task queue, its audit trail and the triage recorded against a task.
|
Package store is tasksd's Postgres: the task queue, its audit trail and the triage recorded against a task. |
|
tasks
Package tasks is the service behind garm.tasks.v1: who may open a task, who may see it, who may claim it and who may decide it.
|
Package tasks is the service behind garm.tasks.v1: who may open a task, who may see it, who may claim it and who may decide it. |
|
ulid
Package ulid mints task ids.
|
Package ulid mints task ids. |