config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) GetAPIKey added in v0.4.0

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

GetAPIKey returns the persisted Pulse API key, or empty string if one has never been stored. Typed wrapper around Get so the config package's EnsureAPIKey helper can consume this store through a small interface.

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) SetAPIKey added in v0.4.0

func (s *Store) SetAPIKey(ctx context.Context, value string) error

SetAPIKey persists a new Pulse API key. Typed wrapper around Set.

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