node

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: 3 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 Event
	Watcher() Watcher
	// List All Node
	Lister() Lister
	// node节点
	GetStore() cache.Store
}

CronJobInformer provides access to a shared informer and lister for CronJobs.

type Lister

type Lister interface {
	// List lists all Node
	List(context.Context, node.Type) ([]*node.Node, error)
	// List all
	ListAll(context.Context) ([]*node.Node, error)
}

Lister 获取所有执行节点

type NodeEventHandler

type NodeEventHandler interface {
	OnAdd(node *node.Node)
	OnUpdate(oldNode, newNode *node.Node)
	OnDelete(node *node.Node)
}

NodeEventHandler 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 NodeEventHandlerFuncs

type NodeEventHandlerFuncs struct {
	AddFunc    func(obj *node.Node)
	UpdateFunc func(oldObj, newObj *node.Node)
	DeleteFunc func(obj *node.Node)
}

NodeEventHandlerFuncs 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 (NodeEventHandlerFuncs) OnAdd

func (r NodeEventHandlerFuncs) OnAdd(obj *node.Node)

OnAdd calls AddFunc if it's not nil.

func (NodeEventHandlerFuncs) OnDelete

func (r NodeEventHandlerFuncs) OnDelete(obj *node.Node)

OnDelete calls DeleteFunc if it's not nil.

func (NodeEventHandlerFuncs) OnUpdate

func (r NodeEventHandlerFuncs) OnUpdate(oldObj, newObj *node.Node)

OnUpdate calls UpdateFunc if it's not nil.

type NodeFilterHandler

type NodeFilterHandler func(obj *node.Node) (error, bool)

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.
	AddNodeEventHandler(handler NodeEventHandler)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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