instance.source/v1

The record of one instance on a multisite host: its id, hostnames, PocketBase version, folder, secrets, limits, superusers, per-extension settings, whether it's blocked or runs elsewhere. Every host contract reads the same record: runtimes run it, gates admit requests for it. A source supplies the records and streams changes.

A host-scope service contract (instance.go, limits.go).

Use

A host takes its records from whichever extension provides this contract: by default its instances file (instances: { file: instances.yaml }), or a control plane's mirror (ext/mothership). In Go the record is sourcev1.Instance (multisite.Instance is the same type).

Provide

Implement sourcev1.Source: Snapshot(ctx) returns every instance, Watch(ctx) streams changes (upserts and deletes) until ctx is done. Provide it on the host's scope in a host extension's RegisterHost:

sourcev1.Contract.ProvideIn(h.Scope, mySource)

In tests, sourcetest provides it: src, scope := sourcetest.Scope(instances...) gives a sealed host scope with a fixed list, and src.Set(inst) / src.Delete(id) change it the way an edit to the instances file would.

Extensions

Extension
mothership provides
pocker requires

License

MIT