proxy

package
v0.0.0-...-90f6a64 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2016 License: GPL-3.0, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

func LoadConf

func LoadConf(configFile string) (*Config, error)

加载配置文件

type Server

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

proxy-server

func New

func New(addr string, debugVarAddr string, conf *Config) *Server

创建一个 proxy-server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Info

func (s *Server) Info() models.ProxyInfo

func (*Server) Join

func (s *Server) Join()

func (*Server) SetMyselfOnline

func (s *Server) SetMyselfOnline() error

通过调用dashboard将自己的状态设置为online

type TopoUpdate

type TopoUpdate interface {
	OnGroupChange(groupId int)
	OnSlotChange(slotId int)
}

type Topology

type Topology struct {
	ProductName string // 集群项目名称
	// contains filtered or unexported fields
}

集群拓扑信息管理对象,封装了一些获取集群信息的操作

func NewTopo

func NewTopo(ProductName string, zkAddr string, f ZkFactory, provider string, zkSessionTimeout int) *Topology

创建集群拓扑管理对象

func (*Topology) Close

func (top *Topology) Close(proxyName string)

关闭topology对象,删除zk上的相关节点

func (*Topology) CreateProxyFenceNode

func (top *Topology) CreateProxyFenceNode(pi *models.ProxyInfo) (string, error)

在fence节点下创建proxy信息

func (*Topology) CreateProxyInfo

func (top *Topology) CreateProxyInfo(pi *models.ProxyInfo) (string, error)

在zk上创建proxy信息

func (*Topology) DoResponse

func (top *Topology) DoResponse(seq int, pi *models.ProxyInfo) error

回复通知,就是在 ActionResponse 的 seq 节点下创建以自己 proxy_id 命名的节点

func (*Topology) Exist

func (top *Topology) Exist(path string) (bool, error)

func (*Topology) GetActionResponsePath

func (top *Topology) GetActionResponsePath(seq int) string

根据 action 里的序号,返回 ActionResponse 里的路径

func (*Topology) GetActionSeqList

func (top *Topology) GetActionSeqList(productName string) ([]int, error)

func (*Topology) GetActionWithSeq

func (top *Topology) GetActionWithSeq(seq int64) (*models.Action, error)

根据序号获取通知信息

func (*Topology) GetActionWithSeqObject

func (top *Topology) GetActionWithSeqObject(seq int64, act *models.Action) error

根据序号获取解析后的action对象

func (*Topology) GetGroup

func (top *Topology) GetGroup(groupId int) (*models.ServerGroup, error)

func (*Topology) GetProxyInfo

func (top *Topology) GetProxyInfo(proxyName string) (*models.ProxyInfo, error)

获取指定id的proxy的信息

func (*Topology) GetSlotByIndex

func (top *Topology) GetSlotByIndex(i int) (*models.Slot, *models.ServerGroup, error)

获取指定id的slot信息,并且获取所在group的信息

func (*Topology) InitZkConn

func (top *Topology) InitZkConn()

建立信息的zk连接

func (*Topology) IsChildrenChangedEvent

func (top *Topology) IsChildrenChangedEvent(e interface{}) bool

func (*Topology) SetProxyStatus

func (top *Topology) SetProxyStatus(proxyName string, status string) error

func (*Topology) WatchChildren

func (top *Topology) WatchChildren(path string, evtbus chan interface{}) ([]string, error)

监听目录

func (*Topology) WatchNode

func (top *Topology) WatchNode(path string, evtbus chan interface{}) ([]byte, error)

监听一个指定节点

type ZkFactory

type ZkFactory func(zkAddr string, zkSessionTimeout int) (zkhelper.Conn, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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