package registrar
import "github.com/docker/docker/pkg/registrar"
Package registrar provides name registration. It reserves a name to a given key.
Index ¶
- Variables
- type Registrar
- func NewRegistrar() *Registrar
- func (r *Registrar) Delete(key string)
- func (r *Registrar) Get(name string) (string, error)
- func (r *Registrar) GetAll() map[string][]string
- func (r *Registrar) GetNames(key string) ([]string, error)
- func (r *Registrar) Release(name string)
- func (r *Registrar) Reserve(name, key string) error
Variables ¶
var ( // ErrNameReserved is an error which is returned when a name is requested to be reserved that already is reserved ErrNameReserved = errors.New("name is reserved") // ErrNameNotReserved is an error which is returned when trying to find a name that is not reserved ErrNameNotReserved = errors.New("name is not reserved") // ErrNoSuchKey is returned when trying to find the names for a key which is not known ErrNoSuchKey = errors.New("provided key does not exist") )
Types ¶
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
Registrar stores indexes a list of keys and their registered names as well as indexes names and the key that they are registred to Names must be unique. Registrar is safe for concurrent access.
func NewRegistrar ¶
func NewRegistrar() *Registrar
NewRegistrar creates a new Registrar with the an empty index
func (*Registrar) Delete ¶
Delete removes all reservations for the passed in key. All names reserved to this key are released.
func (*Registrar) Get ¶
Get returns the key that the passed in name is reserved to
func (*Registrar) GetAll ¶
GetAll returns all registered names
func (*Registrar) GetNames ¶
GetNames lists all the reserved names for the given key
func (*Registrar) Release ¶
Release releases the reserved name Once released, a name can be reserved again
func (*Registrar) Reserve ¶
Reserve registers a key to a name Reserve is idempotent Attempting to reserve a key to a name that already exists results in an `ErrNameReserved` A name reservation is globally unique
Source Files ¶
- Version
- v1.11.1
- Published
- Apr 26, 2016
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 1 hour ago –
Tools for package owners.