registry

package
Version: v0.0.0-...-b9d6073 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package registry is default registry implements.

Index

Constants

View Source
const (
	DefaultSnapshotInterval  = 10 * time.Second
	DefaultHeartbeatInterval = 10 * 1000 //ms
	DefaultTimeout           = 3 * 1000  //ms
	DefaultSnapshotDir       = "./snapshot"
)
View Source
const (
	Direct = "direct"
	Consul = "consul"
	ZK     = "zookeeper"
)

ext name

View Source
const (
	ZkRegistryNamespace = "/motan"
	ZkRegistryCommand   = "/command"
	ZkRegistryNode      = "/node"
	PathSeparator       = "/"
)
View Source
const (
	ZkNodetypeServer            = "server"
	ZkNodetypeUnavailableServer = "unavailableServer"
	ZkNodetypeClient            = "client"
	ZkNodetypeAgent             = "agent"
)

Variables

This section is empty.

Functions

func GetSanpshotConf

func GetSanpshotConf() *motan.SnapshotConf

func GetSubKey

func GetSubKey(url *motan.URL) string

func IsAgent

func IsAgent(url *motan.URL) bool

func JSONString

func JSONString(v interface{}) string

func RegistDefaultRegistry

func RegistDefaultRegistry(extFactory motan.ExtentionFactory)

func SetSanpshotConf

func SetSanpshotConf(snapshotInterval time.Duration, snapshotDir string)

func SliceByteToString

func SliceByteToString(b []byte) string

func StringToSliceByte

func StringToSliceByte(s string) []byte

func ToAgentCommandPath

func ToAgentCommandPath(url *motan.URL) string

func ToAgentNodePath

func ToAgentNodePath(url *motan.URL) string

func ToAgentNodeTypePath

func ToAgentNodeTypePath(url *motan.URL) string

func ToAgentPath

func ToAgentPath(url *motan.URL) string

func ToCommandPath

func ToCommandPath(url *motan.URL) string

func ToGroupPath

func ToGroupPath(url *motan.URL) string

func ToNodePath

func ToNodePath(url *motan.URL, nodeType string) string

func ToNodeTypePath

func ToNodeTypePath(url *motan.URL, nodeType string) string

func ToServicePath

func ToServicePath(url *motan.URL) string

Types

type ConsulRegistry

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

ConsulRegistry TODO implement

func (*ConsulRegistry) Available

func (v *ConsulRegistry) Available(serverURL *motan.URL)

func (*ConsulRegistry) Discover

func (v *ConsulRegistry) Discover(url *motan.URL) []*motan.URL

func (*ConsulRegistry) GetName

func (v *ConsulRegistry) GetName() string

func (*ConsulRegistry) GetRegisteredServices

func (v *ConsulRegistry) GetRegisteredServices() []*motan.URL

func (*ConsulRegistry) GetURL

func (v *ConsulRegistry) GetURL() *motan.URL

func (*ConsulRegistry) Initialize

func (v *ConsulRegistry) Initialize()

func (*ConsulRegistry) Register

func (v *ConsulRegistry) Register(serverURL *motan.URL)

func (*ConsulRegistry) SetURL

func (v *ConsulRegistry) SetURL(url *motan.URL)

func (*ConsulRegistry) StartSnapshot

func (v *ConsulRegistry) StartSnapshot(conf *motan.SnapshotConf)

func (*ConsulRegistry) Subscribe

func (v *ConsulRegistry) Subscribe(url *motan.URL, listener motan.NotifyListener)

func (*ConsulRegistry) UnRegister

func (v *ConsulRegistry) UnRegister(serverURL *motan.URL)

func (*ConsulRegistry) Unavailable

func (v *ConsulRegistry) Unavailable(serverURL *motan.URL)

func (*ConsulRegistry) Unsubscribe

func (v *ConsulRegistry) Unsubscribe(url *motan.URL, listener motan.NotifyListener)

type DirectRegistry

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

func (*DirectRegistry) Available

func (d *DirectRegistry) Available(serverURL *motan.URL)

func (*DirectRegistry) Discover

func (d *DirectRegistry) Discover(url *motan.URL) []*motan.URL

func (*DirectRegistry) GetName

func (d *DirectRegistry) GetName() string

func (*DirectRegistry) GetRegisteredServices

func (d *DirectRegistry) GetRegisteredServices() []*motan.URL

func (*DirectRegistry) GetURL

func (d *DirectRegistry) GetURL() *motan.URL

func (*DirectRegistry) InitRegistry

func (d *DirectRegistry) InitRegistry()

func (*DirectRegistry) Register

func (d *DirectRegistry) Register(serverURL *motan.URL)

func (*DirectRegistry) SetURL

func (d *DirectRegistry) SetURL(url *motan.URL)

func (*DirectRegistry) StartSnapshot

func (d *DirectRegistry) StartSnapshot(conf *motan.SnapshotConf)

func (*DirectRegistry) Subscribe

func (d *DirectRegistry) Subscribe(url *motan.URL, listener motan.NotifyListener)

func (*DirectRegistry) UnRegister

func (d *DirectRegistry) UnRegister(serverURL *motan.URL)

func (*DirectRegistry) Unavailable

func (d *DirectRegistry) Unavailable(serverURL *motan.URL)

func (*DirectRegistry) Unsubscribe

func (d *DirectRegistry) Unsubscribe(url *motan.URL, listener motan.NotifyListener)

type ServiceNode

type ServiceNode struct {
	Group string             `json:"group"`
	Path  string             `json:"path"`
	Nodes []SnapShotNodeInfo `json:"nodes"`
}

type SnapShotNodeInfo

type SnapShotNodeInfo struct {
	ExtInfo string `json:"extInfo"`
	Addr    string `json:"address"`
}

type ZkRegistry

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

func (*ZkRegistry) Available

func (z *ZkRegistry) Available(url *motan.URL)

func (*ZkRegistry) CreateNode

func (z *ZkRegistry) CreateNode(url *motan.URL, nodeType string) error

func (*ZkRegistry) CreatePersistent

func (z *ZkRegistry) CreatePersistent(path string, createParents bool)

func (*ZkRegistry) Discover

func (z *ZkRegistry) Discover(url *motan.URL) []*motan.URL

func (*ZkRegistry) DiscoverCommand

func (z *ZkRegistry) DiscoverCommand(url *motan.URL) string

func (*ZkRegistry) GetName

func (z *ZkRegistry) GetName() string

func (*ZkRegistry) GetRegisteredServices

func (z *ZkRegistry) GetRegisteredServices() []*motan.URL

func (*ZkRegistry) GetURL

func (z *ZkRegistry) GetURL() *motan.URL

func (*ZkRegistry) Initialize

func (z *ZkRegistry) Initialize()

func (*ZkRegistry) Register

func (z *ZkRegistry) Register(url *motan.URL)

func (*ZkRegistry) RemoveNode

func (z *ZkRegistry) RemoveNode(url *motan.URL, nodeType string) error

func (*ZkRegistry) SetURL

func (z *ZkRegistry) SetURL(url *motan.URL)

func (*ZkRegistry) StartSnapshot

func (z *ZkRegistry) StartSnapshot(conf *motan.SnapshotConf)

func (*ZkRegistry) Subscribe

func (z *ZkRegistry) Subscribe(url *motan.URL, listener motan.NotifyListener)

func (*ZkRegistry) SubscribeCommand

func (z *ZkRegistry) SubscribeCommand(url *motan.URL, listener motan.CommandNotifyListener)

func (*ZkRegistry) UnRegister

func (z *ZkRegistry) UnRegister(url *motan.URL)

func (*ZkRegistry) UnSubscribeCommand

func (z *ZkRegistry) UnSubscribeCommand(url *motan.URL, listener motan.CommandNotifyListener)

func (*ZkRegistry) Unavailable

func (z *ZkRegistry) Unavailable(url *motan.URL)

func (*ZkRegistry) Unsubscribe

func (z *ZkRegistry) Unsubscribe(url *motan.URL, listener motan.NotifyListener)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL