registry

package
v0.2.43 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry[T any] struct {
	// contains filtered or unexported fields
}

Registry is a minimal, in-memory fallback implementation for any Named type.

func New

func New[T any]() *Registry[T]

New creates a new Registry instance.

func (*Registry[T]) Add

func (d *Registry[T]) Add(name string, a T)

Add stores a value in memory by its name.

func (*Registry[T]) List

func (d *Registry[T]) List(ctx context.Context) ([]T, error)

List retrieves all values stored in memory.

func (*Registry[T]) Lookup

func (d *Registry[T]) Lookup(ctx context.Context, name string) (T, error)

Lookup retrieves a value by its name from memory.

func (*Registry[T]) Remove

func (d *Registry[T]) Remove(name string)

Remove deletes a value by name from the registry. No-op when name is not present. Each successful removal bumps the internal version so that observers can detect changes.

func (*Registry[T]) Version

func (d *Registry[T]) Version() int64

Version returns a monotonically increasing counter that changes whenever the registry content is modified via Add or Remove. It is safe for concurrent use.

Jump to

Keyboard shortcuts

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