Documentation
¶
Overview ¶
Package networkdirectory owns signed network snapshots, bounded refresh and durable rollback protection. It never imports built-in infrastructure.
Index ¶
- Constants
- Variables
- type BlockingReason
- type Cache
- type Config
- type Directory
- func (directory *Directory) Close()
- func (directory *Directory) NetworkChanged()
- func (directory *Directory) Refresh(ctx context.Context) error
- func (directory *Directory) RefreshAliases(ctx context.Context, aliases []string) error
- func (directory *Directory) RetryAt() time.Time
- func (directory *Directory) Snapshot() (nodedirectory.Snapshot, bool)
- func (directory *Directory) TriggerRefresh()
- func (directory *Directory) Unavailability() *UnavailableError
- type FileCache
- type MemoryCache
- type Record
- type UnavailableError
Constants ¶
const ( RefreshTimeout = 6 * time.Second MirrorTimeout = 2 * time.Second RefreshInterval = 6 * time.Hour MinimumBackoff = 30 * time.Second MaximumBackoff = 30 * time.Minute MaximumTriggerBackoff = 5 * time.Minute ExplicitRetryCooldown = MinimumBackoff MaximumMirrors = 8 MirrorsPerRefresh = 3 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BlockingReason ¶
type BlockingReason string
const ( Unprovisioned BlockingReason = "unprovisioned" InvalidConfiguration BlockingReason = "invalid_network_configuration" TrustStateUnreadable BlockingReason = "trust_state_unreadable" TrustStateInvalid BlockingReason = "trust_state_invalid" TrustStateUnwritable BlockingReason = "trust_state_unwritable" )
type Cache ¶
type Cache interface {
Load(context.Context) (Record, error)
Update(context.Context, func(Record) (Record, error)) (Record, error)
}
Cache commits the signed snapshot and rollback cursor together. Update's callback must run under the same lock as the read, including across processes.
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
func (*Directory) NetworkChanged ¶ added in v0.1.5
func (directory *Directory) NetworkChanged()
NetworkChanged invalidates failure and unchanged-trigger backoff accumulated on a previous network generation so recovery does not wait behind stale outages.
func (*Directory) Refresh ¶
Refresh coalesces user retries, unknown-alias resolution and periodic refresh. Caller cancellation stops waiting, not an update another task also needs.
func (*Directory) RefreshAliases ¶ added in v0.1.5
RefreshAliases joins the current pass, including startup maintenance, and asks it to continue past usable snapshots that still lack these aliases.
func (*Directory) RetryAt ¶
RetryAt exposes only active explicit failure cooldown. Periodic schedules and longer background backoff must not postpone an explicit retry or alias refresh.
func (*Directory) TriggerRefresh ¶ added in v0.1.5
func (directory *Directory) TriggerRefresh()
TriggerRefresh advances periodic maintenance after an all-cooled plan or admission refusal. Bursts coalesce into one fetch, and repeated triggered fetches that observe an unchanged cursor back off up to MaximumTriggerBackoff.
func (*Directory) Unavailability ¶
func (directory *Directory) Unavailability() *UnavailableError
Unavailability ignores maintenance failures while a trusted snapshot is usable.
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
func NewFileCache ¶
Separate trust histories by network, including builds sharing the same user settings. A key rotation within a network must still respect its previous rollback cursor.
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
type Record ¶
type Record struct {
Cursor nodedirectory.Cursor `json:"cursor"`
Envelope []byte `json:"envelope"`
Aliases map[string]string `json:"aliases"`
}
type UnavailableError ¶
type UnavailableError struct {
}
UnavailableError carries the owner's recovery decision, independently of the diagnostic cause. RetryAt is the earliest permitted refresh, not a promise of connectivity or an instruction for applications to start another poller.
func (*UnavailableError) Error ¶
func (err *UnavailableError) Error() string
func (*UnavailableError) Is ¶
func (err *UnavailableError) Is(target error) bool
func (*UnavailableError) Unwrap ¶
func (err *UnavailableError) Unwrap() error