kubernetes: github.com/CyrusBiotechnology/kubernetes/pkg/registry/generic Index | Files | Directories

package generic

import "github.com/CyrusBiotechnology/kubernetes/pkg/registry/generic"

Package generic provides a generic object store interface and a generic label/field matching type.

Index

Package Files

doc.go matcher.go options.go storage_decorator.go

func MergeFieldsSets Uses

func MergeFieldsSets(source fields.Set, fragment fields.Set) fields.Set

MergeFieldsSets merges a fields'set from fragment into the source.

func ObjectMetaFieldsSet Uses

func ObjectMetaFieldsSet(objectMeta api.ObjectMeta, hasNamespaceField bool) fields.Set

ObjectMetaFieldsSet returns a fields set that represents the ObjectMeta.

func UndecoratedStorage Uses

func UndecoratedStorage(
    storageInterface storage.Interface,
    capacity int,
    objectType runtime.Object,
    resourcePrefix string,
    scopeStrategy rest.NamespaceScopedStrategy,
    newListFunc func() runtime.Object) storage.Interface

Returns given 'storageInterface' without any decoration.

type AttrFunc Uses

type AttrFunc func(obj runtime.Object) (label labels.Set, field fields.Set, err error)

AttrFunc returns label and field sets for List or Watch to compare against, or an error.

type Matcher Uses

type Matcher interface {
    // Matches should return true if obj matches this matcher's requirements.
    Matches(obj runtime.Object) (matchesThisObject bool, err error)

    // If this matcher matches a single object, return the key for that
    // object and true here. This will greatly increase efficiency. You
    // must still implement Matches(). Note that key does NOT need to
    // include the object's namespace.
    MatchesSingle() (key string, matchesSingleObject bool)
}

Matcher can return true if an object matches the Matcher's selection criteria. If it is known that the matcher will match only a single object then MatchesSingle should return the key of that object and true. This is an optimization only--Matches() should continue to work.

func MatchOnKey Uses

func MatchOnKey(key string, f func(obj runtime.Object) (bool, error)) Matcher

MatchOnKey returns a matcher that will send only the object matching key through the matching function f. For testing! Note: use SelectionPredicate above for real code!

func MatcherFunc Uses

func MatcherFunc(f func(obj runtime.Object) (bool, error)) Matcher

MatcherFunc makes a matcher from the provided function. For easy definition of matchers for testing. Note: use SelectionPredicate above for real code!

type RESTOptions Uses

type RESTOptions struct {
    Storage                 pkgstorage.Interface
    Decorator               StorageDecorator
    DeleteCollectionWorkers int
}

RESTOptions is set of configuration options to generic registries.

type SelectionPredicate Uses

type SelectionPredicate struct {
    Label    labels.Selector
    Field    fields.Selector
    GetAttrs AttrFunc
}

SelectionPredicate implements a generic predicate that can be passed to GenericRegistry's List or Watch methods. Implements the Matcher interface.

func (*SelectionPredicate) Matches Uses

func (s *SelectionPredicate) Matches(obj runtime.Object) (bool, error)

Matches returns true if the given object's labels and fields (as returned by s.GetAttrs) match s.Label and s.Field. An error is returned if s.GetAttrs fails.

func (*SelectionPredicate) MatchesSingle Uses

func (s *SelectionPredicate) MatchesSingle() (string, bool)

MatchesSingle will return (name, true) if and only if s.Field matches on the object's name.

type StorageDecorator Uses

type StorageDecorator func(
    storageInterface storage.Interface,
    capacity int,
    objectType runtime.Object,
    resourcePrefix string,
    scopeStrategy rest.NamespaceScopedStrategy,
    newListFunc func() runtime.Object) storage.Interface

StorageDecorator is a function signature for producing a storage.Interface from given parameters.

Directories

PathSynopsis
registryPackage etcd has a generic implementation of a registry that stores things in etcd.
restPackage rest has generic implementations of resources used for REST responses

Package generic imports 6 packages (graph). Updated 2017-04-15. Refresh now. Tools for package owners. This is a quick bug-fix fork (has fewer than three commits, and only during the week it was created).