kubernetes

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: Apache-2.0 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// all pod annotation key
	DubboIOAnnotationKey = "dubbo.io/annotation"

	DubboIOLabelKey   = "dubbo.io/label"
	DubboIOLabelValue = "dubbo.io-value"
)
View Source
const (
	Create eventType = iota
	Update
	Delete
)

Variables

View Source
var (
	ErrWatcherSetAlreadyStopped = perrors.New("the watcher-set already be stopped")
	ErrKVPairNotFound           = perrors.New("k/v pair not found")
)
View Source
var (
	ErrDubboLabelAlreadyExist = perrors.New("dubbo label already exist")
)

Functions

func ValidateClient

func ValidateClient(container clientFacade) error

ValidateClient validate the kubernetes client

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewMockClient

func NewMockClient(namespace string, mockClientGenerator func() (kubernetes.Interface, error)) (*Client, error)

NewMockClient export for registry package test

func (*Client) Close

func (c *Client) Close()

Stop read the client status

func (*Client) Create

func (c *Client) Create(k, v string) error

Create create k/v pair in watcher-set

func (*Client) Done

func (c *Client) Done() <-chan struct{}

Done read the client status

func (*Client) GetChildren

func (c *Client) GetChildren(k string) ([]string, []string, error)

GetChildren get k children list from kubernetes-watcherSet

func (*Client) Valid

func (c *Client) Valid() bool

Valid Valid the client if return false, the client is die

func (*Client) Watch

func (c *Client) Watch(k string) (<-chan *WatcherEvent, <-chan struct{}, error)

Watch watch on spec key

func (*Client) WatchWithPrefix

func (c *Client) WatchWithPrefix(prefix string) (<-chan *WatcherEvent, <-chan struct{}, error)

Watch watch on spec prefix

type EventListener

type EventListener struct {
	// contains filtered or unexported fields
}

func NewEventListener

func NewEventListener(client *Client) *EventListener

func (*EventListener) Close

func (l *EventListener) Close()

func (*EventListener) ListenServiceEvent

func (l *EventListener) ListenServiceEvent(key string, listener remoting.DataListener)

this func is invoked by kubernetes ConsumerRegistry::Registry/ kubernetes ConsumerRegistry::get/kubernetes ConsumerRegistry::getListener registry.go:Listen -> listenServiceEvent -> listenDirEvent -> ListenServiceNodeEvent

|
--------> ListenServiceNodeEvent

func (*EventListener) ListenServiceNodeEvent

func (l *EventListener) ListenServiceNodeEvent(key string, listener ...remoting.DataListener) bool

Listen on a spec key this method will return true when spec key deleted, this method will return false when deep layer connection lose

func (*EventListener) ListenServiceNodeEventWithPrefix

func (l *EventListener) ListenServiceNodeEventWithPrefix(prefix string, listener ...remoting.DataListener)

Listen on a set of key with spec prefix

type Watcher

type Watcher interface {
	// the watcher's id
	ID() string
	// result stream
	ResultChan() <-chan *WatcherEvent
	// contains filtered or unexported methods
}

Watcher

type WatcherEvent

type WatcherEvent struct {
	// event-type
	EventType eventType `json:"-"`
	// the dubbo-go should consume the key
	Key string `json:"k"`
	// the dubbo-go should consume the value
	Value string `json:"v"`
}

WatcherEvent watch event is element in watcherSet

type WatcherSet

type WatcherSet interface {

	// put the watch event to the watch set
	Put(object *WatcherEvent) error
	// if prefix is false,
	// the len([]*WatcherEvent) == 1
	Get(key string, prefix bool) ([]*WatcherEvent, error)
	// watch the spec key or key prefix
	Watch(key string, prefix bool) (Watcher, error)
	// check the watcher set status
	Done() <-chan struct{}
}

Watchable WatcherSet

Jump to

Keyboard shortcuts

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