runtimesettings

package
v0.1.70 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("runtime setting not found")
	ErrLocked   = errors.New("runtime setting is managed externally")
	ErrInvalid  = errors.New("invalid runtime setting value")
)

Functions

This section is empty.

Types

type MongoDBStore

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

MongoDBStore persists runtime settings in MongoDB.

func NewMongoDBStore

func NewMongoDBStore(_ context.Context, database *mongo.Database) (*MongoDBStore, error)

NewMongoDBStore uses the shared runtime_settings collection.

func (*MongoDBStore) Get

func (s *MongoDBStore) Get(ctx context.Context, key string) (string, bool, error)

Get returns a persisted value when present.

func (*MongoDBStore) Set

func (s *MongoDBStore) Set(ctx context.Context, key, value string) error

Set upserts a persisted value.

type SQLStore

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

SQLStore persists runtime settings in SQLite or PostgreSQL.

func NewSQLStore

func NewSQLStore(ctx context.Context, db sqlx.DB) (*SQLStore, error)

NewSQLStore initializes the shared runtime-settings table.

func (*SQLStore) Get

func (s *SQLStore) Get(ctx context.Context, key string) (string, bool, error)

Get returns a persisted value when present.

func (*SQLStore) Set

func (s *SQLStore) Set(ctx context.Context, key, value string) error

Set upserts a persisted value.

type Service

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

Service validates, persists, applies, and reconciles registered settings.

func New

func New(ctx context.Context, backend storage.Storage, registered []ext.RuntimeSetting) (*Service, error)

New restores registered settings and starts cross-instance reconciliation.

func (*Service) Close

func (s *Service) Close() error

Close stops background reconciliation.

func (*Service) List

func (s *Service) List() []ext.SettingDescriptor

List returns the current setting descriptors in stable key order.

func (*Service) Update

func (s *Service) Update(ctx context.Context, key, value string) (ext.SettingDescriptor, error)

Update applies and persists one setting, rolling back if persistence fails.

type Store

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

Store persists deployment-wide runtime-setting values.

Jump to

Keyboard shortcuts

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