namespaces

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 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

Overview

Package namespaces keeps the namespaces in the database and in a cache (NS-02).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

func New

func New(ctx context.Context, s *store.Store, seed []model.Namespace, topics Topics, logger *slog.Logger) (*Registry, error)

New stores the seed namespaces that do not exist yet and loads all namespaces.

func (*Registry) Delete

func (this *Registry) Delete(ctx context.Context, name string) error

Delete removes a namespace without resources together with its topics (NS-05).

func (*Registry) Get

func (this *Registry) Get(name string) (model.Namespace, bool)

func (*Registry) List

func (this *Registry) List() []model.Namespace

func (*Registry) Put

func (this *Registry) Put(ctx context.Context, ns model.Namespace) (result model.Namespace, created bool, err error)

Put creates or updates a namespace; its topics are written first, so that a namespace never exists without them. A level that becomes registered gets its resources registered (NS-05).

func (*Registry) Reload

func (this *Registry) Reload(ctx context.Context) error

func (*Registry) Run

func (this *Registry) Run(ctx context.Context, interval time.Duration)

Run reloads the namespaces periodically, so that changes of other replicas arrive, and writes missing topics.

type Topics

type Topics interface {
	EnsureTopics(ctx context.Context, ns model.Namespace) error
	RemoveTopics(ctx context.Context, name string) error
}

Topics creates and removes the permissions-v2 topics of a namespace (NS-05).

Jump to

Keyboard shortcuts

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