registrar

package
v1.7.21 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 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.

Jump to

Keyboard shortcuts

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