Documentation
¶
Overview ¶
Package artefactd runs the artefact service.
It is the whole of what `artefactd` 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/artefactd is flag parsing and a call to Serve.
Index ¶
Constants ¶
const ContractVersion = artefactsv1.ContractVersion
ContractVersion is the version of garm.artefacts.v1 this build serves.
It comes from the generated binding, which is stamped by the generator from buf.gen.yaml, rather than being written here — so the version a daemon compares against its catalogue and the version the binding was generated at cannot drift.
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 configuration, the object store, 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, under its own role. It
// is migrated at startup and the service refuses to start if it cannot be
// reached.
Postgres string
// Bucket is the one bucket every tenant's prefix lives in. Required: there
// is no default, because a service that invented a bucket name would create
// one and look like it worked.
Bucket string
// Endpoint is AWS_ENDPOINT_URL for anything that is not AWS. Empty means
// AWS.
Endpoint string
// Region is what the signer signs for. Empty takes us-east-1, which an
// S3-compatible store ignores and a signature still has to name.
Region string
// Blob replaces the object store, for a test. Zero builds an S3 client from
// the three fields above.
Blob blob.Store
// Codec seals an artefact's payload. Zero is codec.Null, which is what a
// development plane runs — and is NOT what a bank deploys.
Codec codec.Codec
// Clearance and Compartments are what every artefact this deployment holds
// is stamped at. Zero clearance takes artefacts.DefaultClearance, which is
// INTERNAL: the absence of a decision is not a decision to publish.
Clearance toolv1.Clearance
Compartments []string
// UploadTTL is how long a presigned PUT is good for. Zero takes the
// service's default.
UploadTTL time.Duration
// ReadTTL is how long a presigned read URL is good for. Zero takes the
// service's default, which is minutes. See README.md: a short window is the
// window in which a leaked link is live, and it also makes this service a
// hard dependency of every NEW read while doing nothing to revoke one
// already issued.
ReadTTL time.Duration
// SweepEvery is how often orphaned writes are removed and expired artefacts
// are shredded. Zero takes a minute.
SweepEvery time.Duration
// Concurrency is how many calls this process handles at once, per tool. It
// is not a goroutine count: the runtime registers one micro service instance
// per unit, each with its own subscriptions and its own $SRV.INFO identity,
// so a large number here is a large number of responders in the plane's
// discovery round rather than a cheap bound. Zero takes
// garmtool.DefaultConcurrency.
Concurrency int
// 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 except the object store's credentials, which come from the AWS SDK's default chain the way every other garm component that reaches the same bucket takes them: 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
|
|
|
artefactd
command
Command artefactd serves garm.artefacts.v1 over NATS.
|
Command artefactd serves garm.artefacts.v1 over NATS. |
|
gen
|
|
|
internal
|
|
|
artefacts
Package artefacts is the service behind garm.artefacts.v1: who may name an artefact, what its key is, what it is classified at, and who may be given a URL to it.
|
Package artefacts is the service behind garm.artefacts.v1: who may name an artefact, what its key is, what it is classified at, and who may be given a URL to it. |
|
blob
Package blob is the object store: the key namespace and the presigned URLs.
|
Package blob is the object store: the key namespace and the presigned URLs. |
|
codec
Package codec is the seal on an artefact's payload, as an interface with a null implementation.
|
Package codec is the seal on an artefact's payload, as an interface with a null implementation. |
|
store
Package store is artefactd's Postgres: the artefact record and the disclosures made against it.
|
Package store is artefactd's Postgres: the artefact record and the disclosures made against it. |
|
ulid
Package ulid mints artefact ids.
|
Package ulid mints artefact ids. |