Documentation
¶
Overview ¶
Package gc is the owner garbage collector (ADR-0170): it deletes every object whose controller OwnerReference names an owner that no longer exists, or exists under another UID. It runs beside the controller in background mode: a watch on each owner kind collects a deleted owner's children soon after the delete, and a periodic sweep over every child kind catches what a crash or a dropped watch missed.
Index ¶
Constants ¶
const DefaultInterval = 5 * time.Minute
DefaultInterval is the sweep period when Deps.Interval is 0 (config controller.gcSweepInterval).
Variables ¶
This section is empty.
Functions ¶
func DeleteBucket ¶ added in v0.9.0
DeleteBucket purges b's objects, deletes b at its resourceVersion, then purges its prefix again at once unless a Bucket of that name exists again, so an object written in between does not reach a later Bucket of the same name (ADR-0199 Decision 7). A Bucket already gone is purged the same way; a Conflict is returned with its kind.
func InUse ¶ added in v0.9.0
func InUse(ctx context.Context, s store.Store, obj v1.Object, skip func(v1.Object) bool) (v1.ObjectRef, bool, error)
InUse returns the first object in obj's namespace that still uses obj and that skip does not skip (nil skips none), as the deletion protections bind it (ADR-0199 Decision 6): a Function another Function links to (ADR-0064), a KVStore a Function's spec.kv names (ADR-0073), a Bucket a Function's or CatalogService's spec.blob, an EventSource's spec.blob.bucket, a Route's spec.rules[].backend.static.bucket or a Site's spec.bucket.name names (ADR-0080). Nothing uses an object of another kind.
Types ¶
type BucketPurger ¶ added in v0.9.0
type BucketPurger interface {
// Purge deletes every object; it is idempotent.
Purge(ctx context.Context, ns v1.NamespaceName, bucket v1.ObjectName) error
}
BucketPurger deletes every object of a Bucket's substrate prefix (ADR-0199 Decision 7).
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector deletes dead-owned children. Its passes are stateless and may run concurrently.
func (*Collector) CollectNamespace ¶
CollectNamespace runs one pass over every child kind in ns (empty ns is every namespace). List errors are returned joined. Safe beside Run.
type Deps ¶
type Deps struct {
Store store.Store
Purger BucketPurger
Interval time.Duration
Logger *slog.Logger
}
Deps configures a Collector. Store and Purger are required; Interval 0 ⇒ DefaultInterval, < 0 ⇒ fault.Invalid.