metadata

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InterfaceSpec = spi.InterfaceSpec{
	Name:    "Metadata",
	Version: "0.1.0",
}

InterfaceSpec is the current name and version of the Metadata API.

View Source
var (
	// NullPath means no path
	NullPath = Path([]string{})
)

Functions

This section is empty.

Types

type Path

type Path []string

Path is used to identify a particle of metadata. The path can be strings separated by / as in a URL.

func (Path) Base

func (p Path) Base() string

Base returns the base of the path

func (Path) Clean

func (p Path) Clean() Path

Clean scrubs the path to remove any empty string or . or .. and collapse the path into a concise form. It's similar to path/filepath.Clean in the standard lib.

func (Path) Dir

func (p Path) Dir() Path

Dir returns the 'dir' of the path

func (Path) Index

func (p Path) Index(i int) *string

Index returns the ith component in the path

func (Path) Join

func (p Path) Join(child string) Path

Join joins the input as a child of this path

func (Path) Len

func (p Path) Len() int

Len returns the length of the path

func (Path) Rel

func (p Path) Rel(path Path) Path

Rel returns a new path that is a child of the input from this path. e.g. For a path a/b/c/d Rel(a/b/) returns c/d. NullPath is returned if the two are not relative to one another.

func (Path) Shift

func (p Path) Shift(i int) Path

Shift returns a new path that's shifted i positions to the left -- ith child of the head at index=0

func (Path) Sub

func (p Path) Sub(child Path) Path

Sub joins the child to the parent

type Plugin

type Plugin interface {

	// List returns a list of *child nodes* given a path, which is specified as a slice
	// where for i > j path[i] is the parent of path[j]
	List(path Path) (child []string, err error)

	// Get retrieves the value at path given.
	Get(path Path) (value *types.Any, err error)
}

Plugin is the interface for metadata-related operations.

Jump to

Keyboard shortcuts

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