config

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Namespace string `json:"namespace"`
	Key       string `json:"key"`
	Value     string `json:"value"`
	UpdatedAt string `json:"updated_at"`
}

Entry represents a config entry with its metadata.

type Store

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

Store manages the shared configuration key-value store.

func NewStore

func NewStore(q db.Querier, bus *events.Bus, logger *slog.Logger) *Store

NewStore creates a new config store.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, namespace, key string) error

Delete removes a config entry.

func (*Store) DeleteNamespace

func (s *Store) DeleteNamespace(ctx context.Context, namespace string) error

DeleteNamespace removes all entries in a namespace.

func (*Store) Get

func (s *Store) Get(ctx context.Context, namespace, key string) (*Entry, error)

Get retrieves a single config entry.

func (*Store) ListAll

func (s *Store) ListAll(ctx context.Context) ([]Entry, error)

ListAll returns every config entry.

func (*Store) ListNamespace

func (s *Store) ListNamespace(ctx context.Context, namespace string) ([]Entry, error)

ListNamespace returns all config entries in a namespace.

func (*Store) ListNamespaces

func (s *Store) ListNamespaces(ctx context.Context) ([]string, error)

ListNamespaces returns all distinct namespace names.

func (*Store) ListSubscribers

func (s *Store) ListSubscribers(ctx context.Context, namespace string) ([]db.Service, error)

ListSubscribers returns the services subscribed to a namespace.

func (*Store) ListSubscriptions

func (s *Store) ListSubscriptions(ctx context.Context, serviceID string) ([]string, error)

ListSubscriptions returns the namespaces a service is subscribed to.

func (*Store) Set

func (s *Store) Set(ctx context.Context, namespace, key, value string) (*Entry, error)

Set creates or updates a config entry. Publishes a config_updated event so subscribers are notified.

func (*Store) Subscribe

func (s *Store) Subscribe(ctx context.Context, serviceID, namespace string) error

Subscribe registers a service as interested in a config namespace.

func (*Store) Unsubscribe

func (s *Store) Unsubscribe(ctx context.Context, serviceID, namespace string) error

Unsubscribe removes a service's subscription to a namespace.

Jump to

Keyboard shortcuts

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