Help us shape the future of Go! Take the 2026 Go Developer Survey

state

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package state contains logic for managing registry state which the server persists.

Index

Constants

This section is empty.

Variables

View Source
var ErrRegistryNotFound = errors.New("registry not found")

ErrRegistryNotFound is returned when a registry can't be found.

Functions

This section is empty.

Types

type RegistryStateService

type RegistryStateService interface {
	// Initialize populates the state store with the set of sources and registries.
	// It is intended that this is called at application startup, and it
	// will overwrite any previous state.
	Initialize(ctx context.Context, cfg *config.Config) error
	// ListSyncStatuses lists all available sync statuses.
	ListSyncStatuses(ctx context.Context) (map[string]*status.SyncStatus, error)
	// GetSyncStatus lists the status of the named source.
	GetSyncStatus(ctx context.Context, registryName string) (*status.SyncStatus, error)
	// UpdateSyncStatus overrides the value of the named source with the syncStatus parameter.
	UpdateSyncStatus(ctx context.Context, registryName string, syncStatus *status.SyncStatus) error
	// GetNextSyncJob returns the next source configuration that needs syncing.
	// The predicate function is used to filter sources based on their config and sync status.
	// The source configs are cached from the Initialize call.
	GetNextSyncJob(
		ctx context.Context,
		predicate func(*config.SourceConfig, *status.SyncStatus) bool,
	) (*config.SourceConfig, error)
}

RegistryStateService provides methods for inspecting the sync state of a service.

func NewDBStateService added in v0.3.1

func NewDBStateService(pool *pgxpool.Pool) RegistryStateService

NewDBStateService creates a new database-backed registry state service

func NewStateService added in v0.3.2

func NewStateService(pool *pgxpool.Pool) (RegistryStateService, error)

NewStateService creates a database-backed RegistryStateService. The pool parameter must not be nil.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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