status

package
v0.30.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package status keeps the latest status the renderer reported for each service of each preview. Memory is the source of truth for reads; with a Persistence, each preview's status is also written at most once per flush interval and read back on start.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lister

type Lister interface {
	ListPreviewFiles(ctx context.Context) ([]string, error)
}

Lister lists the previews whose file is in the gitops repo: *store.GitHubStore.

type Persistence added in v0.30.0

type Persistence interface {
	// List returns, by preview, the persisted status of each service.
	List(ctx context.Context) (map[string]map[string]preview.ServiceStatus, error)
	// Names returns the previews that have persisted status.
	Names(ctx context.Context) ([]string, error)
	// Write persists the status snapshot returns for the preview slug,
	// calling snapshot at each attempt and writing nothing once it reports
	// the preview gone.
	Write(ctx context.Context, slug string, snapshot func() (map[string]preview.ServiceStatus, bool)) error
	// Delete removes the persisted status of slug, already absent being no
	// error.
	Delete(ctx context.Context, slug string) error
}

Persistence keeps each preview's status outside the process: internal/status/kube keeps it in ConfigMaps.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the status of every preview, in memory and, with a Kubernetes client, in ConfigMaps. Its methods are safe for concurrent use.

func NewMemory

func NewMemory() *Store

NewMemory returns a Store kept in memory only.

func NewPersisted added in v0.30.0

func NewPersisted(p Persistence) *Store

NewPersisted returns an empty Store persisted through p, which must not be nil.

func (*Store) Close

func (s *Store) Close(ctx context.Context)

Close stops what Start runs and, when s is persisted, deletes the queued ConfigMaps and writes the dirty previews once, within ctx.

func (*Store) CollectGarbage

func (s *Store) CollectGarbage()

CollectGarbage asks for a garbage collection (collectGarbage) in the background, once Start ran. It does not wait: requests made while one runs make one more run.

func (*Store) Delete

func (s *Store) Delete(slugs ...string)

Delete forgets the status of the previews slugs and queues the deletion of their ConfigMaps. It does not wait for Kubernetes.

func (*Store) Load

func (s *Store) Load(ctx context.Context) error

Load reads every preview's status back from its ConfigMap. It reads nothing when s is memory-only. A failed listing is returned.

func (*Store) Preview

func (s *Store) Preview(slug string) map[string]preview.ServiceStatus

Preview returns the status of the services of the preview slug, by service; none when nothing is known.

func (*Store) Record

func (s *Store) Record(slug, service string, e preview.ServiceStatus) (bool, bool)

Record sets the status of service in the preview slug to e, unless e is older than the stored entry. It reports whether e was recorded and, when it was, whether it is the first ready recorded in this process for that service at e's revision.

func (*Store) Start

func (s *Store) Start(ctx context.Context, lister Lister)

Start runs, until Close, the garbage collector over lister and, when s is persisted, the ConfigMap writer, and asks for a first garbage collection.

Directories

Path Synopsis
Package kube keeps the status of the previews (package status) in one ConfigMap per preview in badil's namespace.
Package kube keeps the status of the previews (package status) in one ConfigMap per preview in badil's namespace.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL