Documentation
¶
Overview ¶
Package catalogsync keeps the Controller's copy of the central catalog: it fetches the signed snapshot index, verifies it against the trusted keys, refuses anything not newer than what it has, checks every object's hash and size, and stores the snapshot in one transaction. A failed sync changes nothing: the last good snapshot stays in use.
Index ¶
Constants ¶
const DefaultURL = "https://catalog.shardkeep.gg/v1/"
DefaultURL is the central catalog.
Variables ¶
var ( // ErrNotNewer means the published snapshot is the one already stored: // nothing to do. ErrNotNewer = errors.New("the published catalog snapshot is the stored one") // ErrReplay means the published snapshot is older than the stored one: // an old snapshot replayed, or a stale mirror. It is refused. ErrReplay = errors.New("the published catalog snapshot is older than the stored one") )
var TrustedKeys = []string{
"ed25519:W6kFOkvxst2Hi83muQVc5vb+CVrrNbnrY4YjCpXOyyk=",
"ed25519:YKn+mA9Gm8XiWChsFVBMgQqKR9WmhZPzdVtMzO6Xyw8=",
}
TrustedKeys are the public keys of the central catalog this release accepts snapshots from. A new key ships here before the catalog switches to it, and an old one is removed in the release after; see the catalog repository's deploy/README.md.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// URL is the snapshot directory, ending in /v1/ (a mirror works too).
URL string
Trusted []format.PublicKey
Store *store.Store
Client *http.Client
// UserAgent identifies the Controller (its version, nothing else).
UserAgent string
Logger *slog.Logger
// Interval between syncs (default an hour).
Interval time.Duration
Now func() time.Time
}
Config wires the syncer.
type Status ¶
type Status struct {
LastAttempt time.Time
LastSuccess time.Time
// Error is the last attempt's error, empty after a success.
Error string
}
Status is the outcome of the latest sync attempts.