zookeeper

package
v0.0.0-...-fe632b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(root string, conn *zk.Conn) *Client

NewClient create a new zk registry client

func (*Client) Events

func (c *Client) Events() <-chan ServiceEvent

Events channel is a stream of Service and instance updates

func (*Client) Instances

func (c *Client) Instances(hostname string) []*Instance

Instances query service instances with labels

func (*Client) InstancesByHost

func (c *Client) InstancesByHost(hosts []string) []*Instance

Instances query service instances with labels

func (*Client) Service

func (c *Client) Service(hostname string) *Service

Service retrieve the service by its hostname

func (*Client) Services

func (c *Client) Services() []*Service

Services list all of the current registered services

func (*Client) Start

func (c *Client) Start() error

Start client and watch the registry

func (*Client) Stop

func (c *Client) Stop()

Stop registry client and close all channels

type Controller

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

Controller communicate with zookeeper.

func NewController

func NewController(address string, root string) (*Controller, error)

NewController create a Controller instance

func (*Controller) AppendInstanceHandler

func (c *Controller) AppendInstanceHandler(f func(*model.ServiceInstance, model.Event)) error

AppendInstanceHandler notifies about changes to the service instances for a service.

func (*Controller) AppendServiceHandler

func (c *Controller) AppendServiceHandler(f func(*model.Service, model.Event)) error

AppendServiceHandler notifies about changes to the service catalog.

func (*Controller) GetIstioServiceAccounts

func (c *Controller) GetIstioServiceAccounts(hostname model.Hostname, ports []string) []string

GetIstioServiceAccounts implements model.ServiceAccounts operation TODO

func (*Controller) GetProxyServiceInstances

func (c *Controller) GetProxyServiceInstances(proxy *model.Proxy) ([]*model.ServiceInstance, error)

func (*Controller) GetService

func (c *Controller) GetService(hostname model.Hostname) (*model.Service, error)

GetService retrieve dedicated service with specific host name

func (*Controller) GetServiceAttributes

func (sd *Controller) GetServiceAttributes(hostname model.Hostname) (*model.ServiceAttributes, error)

GetServiceAttributes implements a service catalog operation.

func (*Controller) Instances

func (c *Controller) Instances(hostname model.Hostname, ports []string,
	labels model.LabelsCollection) ([]*model.ServiceInstance, error)

Instances list all instance for a specific host name

func (*Controller) InstancesByPort

func (c *Controller) InstancesByPort(hostname model.Hostname, port int,
	labels model.LabelsCollection) ([]*model.ServiceInstance, error)

Instances list all instance for a specific host name

func (*Controller) ManagementPorts

func (c *Controller) ManagementPorts(addr string) model.PortList

func (*Controller) Run

func (c *Controller) Run(stop <-chan struct{})

Run until a signal is received

func (*Controller) Services

func (c *Controller) Services() ([]*model.Service, error)

Services list all service within zookeeper registry

func (*Controller) WorkloadHealthCheckInfo

func (c *Controller) WorkloadHealthCheckInfo(addr string) model.ProbeList

WorkloadHealthCheckInfo retrieves set of health check info by instance IP. This will be implemented later

type Instance

type Instance struct {
	Service *Service
	Host    string
	Port    *Port
	Labels  map[string]string
}

Instance is the instance of the service provider instance lables includes:

appName         name of the application which host the service itself
language		language the service is build with
rpcVer			version of the sofa rpc framework
dynamic			...
tartTime		time when this instance is started
version			version of this service instance
accepts			...
delay			...
weight			route weight of this instance
timeout			server side timeout
id				id of the service, already deprecated
pid				process id of the service instance
uniqueId		unique id of the service

type Port

type Port struct {
	Protocol string
	Port     string
}

func (*Port) Portoi

func (p *Port) Portoi() int

type Service

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

func (*Service) AddPort

func (s *Service) AddPort(port *Port)

func (*Service) Hostname

func (s *Service) Hostname() string

func (*Service) Instances

func (s *Service) Instances() map[string]*Instance

func (*Service) Ports

func (s *Service) Ports() []*Port

type ServiceEvent

type ServiceEvent struct {
	EventType ServiceEventType
	Service   *Service
	Instance  *Instance
}

type ServiceEventType

type ServiceEventType int
const (
	ServiceAdded ServiceEventType = iota
	ServiceDeleted
	ServiceInstanceAdded
	ServiceInstanceDeleted
)

Jump to

Keyboard shortcuts

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