unimap

package
v0.0.0-...-7b725e0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package unimap combines relocation maps into a composite map and supports concurrent access and updates

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Composite

type Composite interface {
	// Add updates the composite mapping by adding a mapping with the given namespace and name. If a mapping with the
	// given namespace and name already exists, it is replaced providing it is consistent with all other mappings. If
	// the named mapping is not consistent with all other mappings in the same namespace, the mapping is removed from
	// the composite mapping for the namespace and error is returned.
	Add(namespace string, name string, mapping map[string]string) error

	// Delete updates the composite mapping by removing a mapping with the given namespace and name. If there is no
	// mapping with the given namespace and name, an error is returned.
	Delete(namespace string, name string) error

	// Map applies the composite mapping for the given namespace to the given name and returns the mapped value. If the
	// given namespace is not known or the given name is not in the domain of the composite mapping for the namespace,
	// the given name is returned. In other words, the default composite mapping for any namespace is the identity
	// function.
	Map(namespace string, name string) string

	// Dump returns a string representing the state of the composite.
	Dump() string
}

Composite is an interface to a collection, indexed by namespace, of consistent mappings from string to string. The mappings are consistent in the sense that no two mappings map a given pair to distinct results.

func New

func New(stopCh <-chan struct{}) Composite

Jump to

Keyboard shortcuts

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