package generic
import "k8s.io/kubernetes/pkg/registry/generic"
Package generic provides a generic object store interface and a generic label/field matching type.
Index ¶
- func FilterList(list runtime.Object, m Matcher, d DecoratorFunc) (filtered runtime.Object, err error)
- type AttrFunc
- type DecoratorFunc
- type Matcher
- func MatchOnKey(key string, f func(obj runtime.Object) (bool, error)) Matcher
- func MatcherFunc(f func(obj runtime.Object) (bool, error)) Matcher
- type Registry
- type SelectionPredicate
Functions ¶
func FilterList ¶
func FilterList(list runtime.Object, m Matcher, d DecoratorFunc) (filtered runtime.Object, err error)
FilterList filters any list object that conforms to the api conventions, provided that 'm' works with the concrete type of list. d is an optional decorator for the returned functions. Only matching items are decorated.
Types ¶
type AttrFunc ¶
AttrFunc returns label and field sets for List or Watch to compare against, or an error.
type DecoratorFunc ¶
DecoratorFunc can mutate the provided object prior to being returned.
type Matcher ¶
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 ¶
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 ¶
MatcherFunc makes a matcher from the provided function. For easy definition of matchers for testing. Note: use SelectionPredicate above for real code!
type Registry ¶
type Registry interface { ListPredicate(api.Context, Matcher) (runtime.Object, error) CreateWithName(ctx api.Context, id string, obj runtime.Object) error UpdateWithName(ctx api.Context, id string, obj runtime.Object) error Get(ctx api.Context, id string) (runtime.Object, error) Delete(ctx api.Context, id string, options *api.DeleteOptions) (runtime.Object, error) WatchPredicate(ctx api.Context, m Matcher, resourceVersion string) (watch.Interface, error) }
Registry knows how to store & list any runtime.Object. Can be used for any object types which don't require special features from the storage layer. DEPRECATED: replace with direct implementation of RESTStorage
type SelectionPredicate ¶
SelectionPredicate implements a generic predicate that can be passed to GenericRegistry's List or Watch methods. Implements the Matcher interface.
func (*SelectionPredicate) Matches ¶
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 ¶
func (s *SelectionPredicate) MatchesSingle() (string, bool)
MatchesSingle will return (name, true) iff s.Field matches on the object's name.
Source Files ¶
doc.go registry.go
Directories ¶
Path | Synopsis |
---|---|
pkg/registry/generic/etcd | Package etcd has a generic implementation of a registry that stores things in etcd. |
pkg/registry/generic/rest | Package rest has generic implementations of resources used for REST responses |
- Version
- v0.18.2
- Published
- Jun 8, 2015
- Platform
- js/wasm
- Imports
- 5 packages
- Last checked
- 1 minute ago –
Tools for package owners.