proxy

package
v0.0.0-...-de897e3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2015 License: MIT Imports: 15 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
}

config.ini 可指定的配置项

func LoadConf

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

type Server

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

func New

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

debugVarAddr 指的http接口

func (*Server) Close

func (s *Server) Close() error

func (*Server) Info

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

func (*Server) Join

func (s *Server) Join()

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)

func (*Topology) CreateProxyFenceNode

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

func (*Topology) CreateProxyInfo

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

func (*Topology) DoResponse

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

func (*Topology) Exist

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

纯判断, 跟业务无任何关系

func (*Topology) GetActionResponsePath

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

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

func (*Topology) GetGroup

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

zk path:

fmt.Sprintf("/zk/codis/db_%s/servers/group_%d", productName, groupId)
这个信息是由用户更新进去,然后codis对实例进行设置

func (*Topology) GetProxyInfo

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

func (*Topology) GetSlotByIndex

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

zk path:

fmt.Sprintf("/zk/codis/db_%s/slots/slot_%d", productName, slotId)

这个接口确保了slot-id & group-id 都是有效的

func (*Topology) InitZkConn

func (top *Topology) InitZkConn()

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
对应RedisClient结构体, 及相应的功能
对应RedisClient结构体, 及相应的功能

Jump to

Keyboard shortcuts

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