Documentation ¶
Overview ¶
Package cluster contains Cluster implement and command process. Cluster manage group of endpoints for client and agent.
Index ¶
- Constants
- func GetCommandRegistryWarper(cluster *MotanCluster, registry motan.Registry) motan.Registry
- type ClientCommand
- type CmdList
- type Command
- type CommandRegistryWarper
- func (c *CommandRegistryWarper) Available(serverURL *motan.URL)
- func (c *CommandRegistryWarper) Discover(url *motan.URL) []*motan.URL
- func (c *CommandRegistryWarper) GetIdentity() string
- func (c *CommandRegistryWarper) GetName() string
- func (c *CommandRegistryWarper) GetRegisteredServices() []*motan.URL
- func (c *CommandRegistryWarper) GetURL() *motan.URL
- func (c *CommandRegistryWarper) Notify(registryURL *motan.URL, urls []*motan.URL)
- func (c *CommandRegistryWarper) NotifyCommand(registryURL *motan.URL, commandType int, commandInfo string)
- func (c *CommandRegistryWarper) Register(serverURL *motan.URL)
- func (c *CommandRegistryWarper) SetURL(url *motan.URL)
- func (c *CommandRegistryWarper) StartSnapshot(conf *motan.SnapshotConf)
- func (c *CommandRegistryWarper) Subscribe(url *motan.URL, listener motan.NotifyListener)
- func (c *CommandRegistryWarper) UnRegister(serverURL *motan.URL)
- func (c *CommandRegistryWarper) Unavailable(serverURL *motan.URL)
- func (c *CommandRegistryWarper) Unsubscribe(url *motan.URL, listener motan.NotifyListener)
- type MotanCluster
- func (m *MotanCluster) AddRegistry(registry motan.Registry)
- func (m *MotanCluster) Call(request motan.Request) motan.Response
- func (m *MotanCluster) Destroy()
- func (m *MotanCluster) GetIdentity() string
- func (m *MotanCluster) GetName() string
- func (m *MotanCluster) GetRefers() []motan.EndPoint
- func (m *MotanCluster) GetURL() *motan.URL
- func (m *MotanCluster) InitCluster() bool
- func (m *MotanCluster) IsAvailable() bool
- func (m *MotanCluster) Notify(registryURL *motan.URL, urls []*motan.URL)
- func (m *MotanCluster) NotifyAgentCommand(commandInfo string)
- func (m *MotanCluster) SetExtFactory(factory motan.ExtentionFactory)
- func (m *MotanCluster) SetHaStrategy(haStrategy motan.HaStrategy)
- func (m *MotanCluster) SetLoadBalance(loadBalance motan.LoadBalance)
- func (m *MotanCluster) SetURL(url *motan.URL)
Constants ¶
View Source
const ( CMDTrafficControl = iota CMDDegrade //service degrade )
View Source
const ( AgentCmd = iota ServiceCmd )
View Source
const (
RuleProtocol = "rule"
)
Variables ¶
This section is empty.
Functions ¶
func GetCommandRegistryWarper ¶
func GetCommandRegistryWarper(cluster *MotanCluster, registry motan.Registry) motan.Registry
Types ¶
type ClientCommand ¶
type ClientCommand struct { Index int `json:"index"` Version string `json:"version"` CommandType int `json:"commandType"` Dc string `json:"dc"` Pattern string `json:"pattern"` MergeGroups []string `json:"mergeGroups"` RouteRules []string `json:"routeRules"` Remark string `json:"remark"` }
func (*ClientCommand) MatchCmdPattern ¶
func (c *ClientCommand) MatchCmdPattern(url *motan.URL) bool
type CmdList ¶
type CmdList []ClientCommand
type Command ¶
type Command struct {
ClientCommandList []ClientCommand `json:"clientCommandList"`
}
func ParseCommand ¶
type CommandRegistryWarper ¶
type CommandRegistryWarper struct {
// contains filtered or unexported fields
}
CommandRegistryWarper warper registry for every cluster
func (*CommandRegistryWarper) Available ¶
func (c *CommandRegistryWarper) Available(serverURL *motan.URL)
func (*CommandRegistryWarper) Discover ¶
func (c *CommandRegistryWarper) Discover(url *motan.URL) []*motan.URL
func (*CommandRegistryWarper) GetIdentity ¶
func (c *CommandRegistryWarper) GetIdentity() string
func (*CommandRegistryWarper) GetName ¶
func (c *CommandRegistryWarper) GetName() string
func (*CommandRegistryWarper) GetRegisteredServices ¶
func (c *CommandRegistryWarper) GetRegisteredServices() []*motan.URL
func (*CommandRegistryWarper) GetURL ¶
func (c *CommandRegistryWarper) GetURL() *motan.URL
func (*CommandRegistryWarper) Notify ¶
func (c *CommandRegistryWarper) Notify(registryURL *motan.URL, urls []*motan.URL)
func (*CommandRegistryWarper) NotifyCommand ¶
func (c *CommandRegistryWarper) NotifyCommand(registryURL *motan.URL, commandType int, commandInfo string)
func (*CommandRegistryWarper) Register ¶
func (c *CommandRegistryWarper) Register(serverURL *motan.URL)
func (*CommandRegistryWarper) SetURL ¶
func (c *CommandRegistryWarper) SetURL(url *motan.URL)
func (*CommandRegistryWarper) StartSnapshot ¶
func (c *CommandRegistryWarper) StartSnapshot(conf *motan.SnapshotConf)
func (*CommandRegistryWarper) Subscribe ¶
func (c *CommandRegistryWarper) Subscribe(url *motan.URL, listener motan.NotifyListener)
func (*CommandRegistryWarper) UnRegister ¶
func (c *CommandRegistryWarper) UnRegister(serverURL *motan.URL)
func (*CommandRegistryWarper) Unavailable ¶
func (c *CommandRegistryWarper) Unavailable(serverURL *motan.URL)
func (*CommandRegistryWarper) Unsubscribe ¶
func (c *CommandRegistryWarper) Unsubscribe(url *motan.URL, listener motan.NotifyListener)
type MotanCluster ¶
type MotanCluster struct { Context *motan.Context Registrys []motan.Registry HaStrategy motan.HaStrategy LoadBalance motan.LoadBalance Refers []motan.EndPoint Filters []motan.Filter // contains filtered or unexported fields }
func NewCluster ¶
func NewCluster(url *motan.URL, proxy bool) *MotanCluster
func (*MotanCluster) AddRegistry ¶
func (m *MotanCluster) AddRegistry(registry motan.Registry)
func (*MotanCluster) Destroy ¶
func (m *MotanCluster) Destroy()
func (*MotanCluster) GetIdentity ¶
func (m *MotanCluster) GetIdentity() string
func (*MotanCluster) GetName ¶
func (m *MotanCluster) GetName() string
func (*MotanCluster) GetRefers ¶
func (m *MotanCluster) GetRefers() []motan.EndPoint
func (*MotanCluster) GetURL ¶
func (m *MotanCluster) GetURL() *motan.URL
func (*MotanCluster) InitCluster ¶
func (m *MotanCluster) InitCluster() bool
func (*MotanCluster) IsAvailable ¶
func (m *MotanCluster) IsAvailable() bool
func (*MotanCluster) Notify ¶
func (m *MotanCluster) Notify(registryURL *motan.URL, urls []*motan.URL)
func (*MotanCluster) NotifyAgentCommand ¶
func (m *MotanCluster) NotifyAgentCommand(commandInfo string)
func (*MotanCluster) SetExtFactory ¶
func (m *MotanCluster) SetExtFactory(factory motan.ExtentionFactory)
func (*MotanCluster) SetHaStrategy ¶
func (m *MotanCluster) SetHaStrategy(haStrategy motan.HaStrategy)
func (*MotanCluster) SetLoadBalance ¶
func (m *MotanCluster) SetLoadBalance(loadBalance motan.LoadBalance)
func (*MotanCluster) SetURL ¶
func (m *MotanCluster) SetURL(url *motan.URL)
Click to show internal directories.
Click to hide internal directories.