state

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RegistryStateService

type RegistryStateService interface {
	// Initialize populates the state store with the set of registries.
	// It is intended that this is called at application startup, and it
	// will overwrite any previous state.
	Initialize(ctx context.Context, registryConfigs []config.RegistryConfig) error
	// ListSyncStatuses lists all available sync statuses.
	ListSyncStatuses(ctx context.Context) (map[string]*status.SyncStatus, error)
	// GetSyncStatus lists the status of the named registry.
	GetSyncStatus(ctx context.Context, registryName string) (*status.SyncStatus, error)
	// UpdateSyncStatus overrides the value of the named registry with the syncStatus parameter.
	UpdateSyncStatus(ctx context.Context, registryName string, syncStatus *status.SyncStatus) error
	// UpdateStatusAtomically is used to carry out atomic updates on a sync status.
	// Implementations will fetch the existing state, apply the testAndUpdateFn
	// function to the current state, and update the state if it is mutated by
	// that function - all as a single atomic action. testAndUpdateFn returns a boolean
	// to indicate whether the  sync status was modified, and this is returned by
	// TestAndUpdateStatus when done.
	UpdateStatusAtomically(
		ctx context.Context,
		registryName string,
		testAndUpdateFn func(syncStatus *status.SyncStatus) bool,
	) (bool, error)
}

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

func NewFileStateService

func NewFileStateService(statusPersistence status.StatusPersistence) RegistryStateService

NewFileStateService creates a new file-based registry state service

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