Help us shape the future of Go! Take the 2026 Go Developer Survey

registrar

package
v1.7.35 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registrar

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

Registrar stores one-to-one name<->key mappings. Names and keys must be unique. Registrar is safe for concurrent access.

func NewRegistrar

func NewRegistrar() *Registrar

NewRegistrar creates a new Registrar with the empty indexes.

func (*Registrar) ReleaseByKey

func (r *Registrar) ReleaseByKey(key string)

ReleaseByKey release the reserved name<->key mapping by key.

func (*Registrar) ReleaseByName

func (r *Registrar) ReleaseByName(name string)

ReleaseByName releases the reserved name<->key mapping by name. Once released, the name and the key can be reserved again.

func (*Registrar) Reserve

func (r *Registrar) Reserve(name, key string) error

Reserve registers a name<->key mapping, name or key must not be empty. Reserve is idempotent. Attempting to reserve a conflict key<->name mapping results in an error. A name<->key reservation is globally unique.

type ReservedErr added in v1.7.31

type ReservedErr struct {
	Field string
	Name  string
	Key   string
}

func (*ReservedErr) Conflict added in v1.7.31

func (e *ReservedErr) Conflict()

func (*ReservedErr) Error added in v1.7.31

func (e *ReservedErr) Error() string

Jump to

Keyboard shortcuts

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