rest

package
v0.0.0-...-e42c45c Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: AGPL-3.0 Imports: 21 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(storageObj, legacyObj runtime.Object) bool

Compare asserts on the equality of objects returned from both stores (object storage and legacy storage)

func StartPeriodicDataSyncer

func StartPeriodicDataSyncer(ctx context.Context, cfg *SyncerConfig, metrics *DualWriterMetrics) error

StartPeriodicDataSyncer starts a background job that will execute the DataSyncer, syncing the data from the hosted grafana backend into the unified storage backend. This is run in the grafana instance.

Types

type DualWriteBuilder

type DualWriteBuilder func(gr schema.GroupResource, legacy Storage, unified Storage) (Storage, error)

Function that will create a dual writer

type DualWriter

type DualWriter interface {
	Storage
	Mode() DualWriterMode
}

type DualWriterMetrics

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

func NewDualWriterMetrics

func NewDualWriterMetrics(reg prometheus.Registerer) *DualWriterMetrics

type DualWriterMode

type DualWriterMode int
const (
	// Mode0 represents writing to and reading from solely LegacyStorage. This mode is enabled when the
	// Unified Storage is disabled. All reads and writes are made to LegacyStorage. None are made to Storage.
	Mode0 DualWriterMode = iota
	// Mode1 represents writing to and reading from LegacyStorage for all primary functionality while additionally
	// reading and writing to Storage on a best effort basis for the sake of collecting metrics.
	Mode1
	// Mode2 is the dual writing mode that represents writing to LegacyStorage and Storage and reading from LegacyStorage.
	// The objects written to storage will include any labels and annotations.
	// When reading values, the results will be from LegacyStorage.
	Mode2
	// Mode3 represents writing to LegacyStorage and Storage and reading from Storage.
	// NOTE: Requesting mode3 will only happen when after a background sync job succeeds
	Mode3
	// Mode4 represents writing and reading from Storage.
	// NOTE: Requesting mode4 will only happen when after a background sync job succeeds
	Mode4
	// Mode5 uses storage regardless of the background sync state
	Mode5
)

func SetDualWritingMode

func SetDualWritingMode(
	ctx context.Context,
	kvs NamespacedKVStore,
	cfg *SyncerConfig,
	metrics *DualWriterMetrics,
) (DualWriterMode, error)

type NamespacedKVStore

type NamespacedKVStore interface {
	Get(ctx context.Context, key string) (string, bool, error)
	Set(ctx context.Context, key, value string) error
}

type ServerLockService

type ServerLockService interface {
	LockExecuteAndRelease(ctx context.Context, actionName string, maxInterval time.Duration, fn func(ctx context.Context)) error
}

type Storage

Storage is a storage implementation that satisfies the same interfaces as genericregistry.Store.

type SyncerConfig

type SyncerConfig struct {
	Kind        string
	RequestInfo *request.RequestInfo

	Mode              DualWriterMode
	LegacyStorage     Storage
	Storage           Storage
	ServerLockService ServerLockService
	SkipDataSync      bool

	DataSyncerInterval     time.Duration
	DataSyncerRecordsLimit int
}

func (*SyncerConfig) Validate

func (s *SyncerConfig) Validate() error

Jump to

Keyboard shortcuts

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