step

package
v0.0.0-...-c01aa29 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultStoreIndexFunc

func DefaultStoreIndexFunc(obj interface{}) ([]string, error)

DefaultStoreIndexFunc todo

func DefaultStoreIndexers

func DefaultStoreIndexers() cache.Indexers

DefaultStoreIndexers todo

func MetaNamespaceKeyFunc

func MetaNamespaceKeyFunc(obj interface{}) (string, error)

MetaNamespaceKeyFunc is a convenient default KeyFunc which knows how to make keys for API objects which implement meta.Interface. The key uses the format <namespace>/<name> unless <namespace> is empty, then it's just <name>.

TODO: replace key-as-string with a key-as-struct so that this packing/unpacking won't be necessary.

Types

type ExplicitKey

type ExplicitKey string

ExplicitKey can be passed to MetaNamespaceKeyFunc if you have the key for the object but not the object itself.

type Informer

type Informer interface {
	Watcher() Watcher
	Lister() Lister
	Recorder() Recorder
	GetStore() cache.Store
}

Informer 负责事件通知

type ListOptions

type ListOptions struct {
	Key string
}

func NewListOptions

func NewListOptions() *ListOptions

func (*ListOptions) With

func (o *ListOptions) With(key string) *ListOptions

type Lister

type Lister interface {
	Get(ctx context.Context, key string) (*pipeline.Step, error)
	List(ctx context.Context) ([]*pipeline.Step, error)
}

type Recorder

type Recorder interface {
	Update(*pipeline.Step) error
}

type StepEventHandler

type StepEventHandler interface {
	OnAdd(obj *pipeline.Step)
	OnUpdate(old, new *pipeline.Step)
	OnDelete(obj *pipeline.Step)
}

StepEventHandler can handle notifications for events that happen to a resource. The events are informational only, so you can't return an error.

  • OnAdd is called when an object is added.
  • OnUpdate is called when an object is modified. Note that oldObj is the last known state of the object-- it is possible that several changes were combined together, so you can't use this to see every single change. OnUpdate is also called when a re-list happens, and it will get called even if nothing changed. This is useful for periodically evaluating or syncing something.
  • OnDelete will get the final state of the item if it is known, otherwise it will get an object of type DeletedFinalStateUnknown. This can happen if the watch is closed and misses the delete event and we don't notice the deletion until the subsequent re-list.

type StepEventHandlerFuncs

type StepEventHandlerFuncs struct {
	AddFunc    func(obj *pipeline.Step)
	UpdateFunc func(oldObj, newObj *pipeline.Step)
	DeleteFunc func(obj *pipeline.Step)
}

StepEventHandlerFuncs is an adaptor to let you easily specify as many or as few of the notification functions as you want while still implementing ResourceEventHandler.

func (StepEventHandlerFuncs) OnAdd

func (r StepEventHandlerFuncs) OnAdd(obj *pipeline.Step)

OnAdd calls AddFunc if it's not nil.

func (StepEventHandlerFuncs) OnDelete

func (r StepEventHandlerFuncs) OnDelete(obj *pipeline.Step)

OnDelete calls DeleteFunc if it's not nil.

func (StepEventHandlerFuncs) OnUpdate

func (r StepEventHandlerFuncs) OnUpdate(oldObj, newObj *pipeline.Step)

OnUpdate calls UpdateFunc if it's not nil.

type StepFilterHandler

type StepFilterHandler func(obj *pipeline.Step) error

func NewNodeFilter

func NewNodeFilter(node *node.Node) StepFilterHandler

type UpdateStepCallback

type UpdateStepCallback func(old, new *pipeline.Step)

type Watcher

type Watcher interface {
	// Run starts and runs the shared informer, returning after it stops.
	// The informer will be stopped when stopCh is closed.
	Run(ctx context.Context) error
	// AddEventHandler adds an event handler to the shared informer using the shared informer's resync
	// period.  Events to a single handler are delivered sequentially, but there is no coordination
	// between different handlers.
	AddStepEventHandler(handler StepEventHandler)
}

Watcher 负责事件通知

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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