Documentation ¶
Index ¶
- Constants
- Variables
- func GetInClusterKubernetesClient() (kubernetes.Interface, error)
- func ValidateClient(container clientFacade) error
- type Client
- func (c *Client) Close()
- func (c *Client) Create(k, v string) error
- func (c *Client) Done() <-chan struct{}
- func (c *Client) GetChildren(k string) ([]string, []string, error)
- func (c *Client) Valid() bool
- func (c *Client) Watch(k string) (<-chan *WatcherEvent, <-chan struct{}, error)
- func (c *Client) WatchWithPrefix(prefix string) (<-chan *WatcherEvent, <-chan struct{}, error)
- type EventListener
- func (l *EventListener) Close()
- func (l *EventListener) ListenServiceEvent(key string, listener remoting.DataListener)
- func (l *EventListener) ListenServiceNodeEvent(key string, listener ...remoting.DataListener) bool
- func (l *EventListener) ListenServiceNodeEventWithPrefix(prefix string, listener ...remoting.DataListener)
- type Watcher
- type WatcherEvent
- type WatcherSet
Constants ¶
const ( // all pod annotation key DubboIOAnnotationKey = "dubbo.io/annotation" // all pod label key and value pair DubboIOLabelKey = "dubbo.io/label" DubboIOConsumerLabelValue = "dubbo.io.consumer" DubboIOProviderLabelValue = "dubbo.io.provider" )
const ( Create eventType = iota Update Delete )
Variables ¶
var ( ErrWatcherSetAlreadyStopped = perrors.New("the watcher-set already be stopped") ErrKVPairNotFound = perrors.New("k/v pair not found") )
var ErrDubboLabelAlreadyExist = perrors.New("dubbo label already exist")
Functions ¶
func GetInClusterKubernetesClient ¶
func GetInClusterKubernetesClient() (kubernetes.Interface, error)
GetInClusterKubernetesClient current pod running in kubernetes-cluster
func ValidateClient ¶
func ValidateClient(container clientFacade) error
ValidateClient validates the kubernetes client
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewMockClient ¶
NewMockClient exports for registry package test
func (*Client) GetChildren ¶
GetChildren gets k children list from kubernetes-watcherSet
func (*Client) Watch ¶
func (c *Client) Watch(k string) (<-chan *WatcherEvent, <-chan struct{}, error)
Watch watches on spec key
func (*Client) WatchWithPrefix ¶
func (c *Client) WatchWithPrefix(prefix string) (<-chan *WatcherEvent, <-chan struct{}, error)
WatchWithPrefix watches 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 returns true when spec key deleted, this method returns 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 thread-safe