Documentation ¶
Overview ¶
Package cluster contains Cluster implement and command process. Cluster manage group of endpoints for client and agent.
Index ¶
- Constants
- func GetCommandRegistryWrapper(cluster *MotanCluster, registry motan.Registry) motan.Registry
- type ClientCommand
- type CmdList
- type Command
- type CommandRegistryWrapper
- func (c *CommandRegistryWrapper) Available(serverURL *motan.URL)
- func (c *CommandRegistryWrapper) Discover(url *motan.URL) []*motan.URL
- func (c *CommandRegistryWrapper) GetIdentity() string
- func (c *CommandRegistryWrapper) GetName() string
- func (c *CommandRegistryWrapper) GetRegisteredServices() []*motan.URL
- func (c *CommandRegistryWrapper) GetURL() *motan.URL
- func (c *CommandRegistryWrapper) Notify(registryURL *motan.URL, urls []*motan.URL)
- func (c *CommandRegistryWrapper) NotifyCommand(registryURL *motan.URL, commandType int, commandInfo string)
- func (c *CommandRegistryWrapper) Register(serverURL *motan.URL)
- func (c *CommandRegistryWrapper) SetURL(url *motan.URL)
- func (c *CommandRegistryWrapper) StartSnapshot(conf *motan.SnapshotConf)
- func (c *CommandRegistryWrapper) Subscribe(url *motan.URL, listener motan.NotifyListener)
- func (c *CommandRegistryWrapper) UnRegister(serverURL *motan.URL)
- func (c *CommandRegistryWrapper) Unavailable(serverURL *motan.URL)
- func (c *CommandRegistryWrapper) Unsubscribe(url *motan.URL, listener motan.NotifyListener)
- type HTTPCluster
- func (c *HTTPCluster) Call(request core.Request) core.Response
- func (c *HTTPCluster) CanServe(uri string) (string, bool)
- func (c *HTTPCluster) Destroy()
- func (c *HTTPCluster) GetIdentity() string
- func (c *HTTPCluster) GetName() string
- func (c *HTTPCluster) GetURL() *core.URL
- func (c *HTTPCluster) IsAvailable() bool
- func (c *HTTPCluster) Notify(registryURL *core.URL, urls []*core.URL)
- func (c *HTTPCluster) SetProxy(proxy bool)
- func (c *HTTPCluster) SetSerialization(s core.Serialization)
- func (c *HTTPCluster) SetURL(url *core.URL)
- type MotanCluster
- func (m *MotanCluster) AddRegistry(registry motan.Registry)
- func (m *MotanCluster) Call(request motan.Request) (res 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) IsAvailable() bool
- func (m *MotanCluster) Notify(registryURL *motan.URL, urls []*motan.URL)
- func (m *MotanCluster) NotifyAgentCommand(commandInfo string)
- func (m *MotanCluster) SetExtFactory(factory motan.ExtensionFactory)
- func (m *MotanCluster) SetHaStrategy(haStrategy motan.HaStrategy)
- func (m *MotanCluster) SetLoadBalance(loadBalance motan.LoadBalance)
- func (m *MotanCluster) SetURL(url *motan.URL)
- func (m *MotanCluster) ShuffleEndpoints(endpoints []motan.EndPoint) []motan.EndPoint
Constants ¶
View Source
const ( CMDTrafficControl = iota CMDDegrade //service degrade CMDSwitcher )
View Source
const ( AgentCmd = iota ServiceCmd )
View Source
const (
HTTPProxyPreloadKey = "preload"
)
View Source
const (
RuleProtocol = "rule"
)
Variables ¶
This section is empty.
Functions ¶
func GetCommandRegistryWrapper ¶
func GetCommandRegistryWrapper(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 CommandRegistryWrapper ¶
type CommandRegistryWrapper struct {
// contains filtered or unexported fields
}
CommandRegistryWrapper wrapper registry for every cluster
func (*CommandRegistryWrapper) Available ¶
func (c *CommandRegistryWrapper) Available(serverURL *motan.URL)
func (*CommandRegistryWrapper) Discover ¶
func (c *CommandRegistryWrapper) Discover(url *motan.URL) []*motan.URL
func (*CommandRegistryWrapper) GetIdentity ¶
func (c *CommandRegistryWrapper) GetIdentity() string
func (*CommandRegistryWrapper) GetName ¶
func (c *CommandRegistryWrapper) GetName() string
func (*CommandRegistryWrapper) GetRegisteredServices ¶
func (c *CommandRegistryWrapper) GetRegisteredServices() []*motan.URL
func (*CommandRegistryWrapper) GetURL ¶
func (c *CommandRegistryWrapper) GetURL() *motan.URL
func (*CommandRegistryWrapper) Notify ¶
func (c *CommandRegistryWrapper) Notify(registryURL *motan.URL, urls []*motan.URL)
func (*CommandRegistryWrapper) NotifyCommand ¶
func (c *CommandRegistryWrapper) NotifyCommand(registryURL *motan.URL, commandType int, commandInfo string)
func (*CommandRegistryWrapper) Register ¶
func (c *CommandRegistryWrapper) Register(serverURL *motan.URL)
func (*CommandRegistryWrapper) SetURL ¶
func (c *CommandRegistryWrapper) SetURL(url *motan.URL)
func (*CommandRegistryWrapper) StartSnapshot ¶
func (c *CommandRegistryWrapper) StartSnapshot(conf *motan.SnapshotConf)
func (*CommandRegistryWrapper) Subscribe ¶
func (c *CommandRegistryWrapper) Subscribe(url *motan.URL, listener motan.NotifyListener)
func (*CommandRegistryWrapper) UnRegister ¶
func (c *CommandRegistryWrapper) UnRegister(serverURL *motan.URL)
func (*CommandRegistryWrapper) Unavailable ¶
func (c *CommandRegistryWrapper) Unavailable(serverURL *motan.URL)
func (*CommandRegistryWrapper) Unsubscribe ¶
func (c *CommandRegistryWrapper) Unsubscribe(url *motan.URL, listener motan.NotifyListener)
type HTTPCluster ¶
type HTTPCluster struct {
// contains filtered or unexported fields
}
func NewHTTPCluster ¶
func NewHTTPCluster(url *core.URL, proxy bool, context *core.Context, extFactory core.ExtensionFactory) *HTTPCluster
func (*HTTPCluster) Destroy ¶
func (c *HTTPCluster) Destroy()
func (*HTTPCluster) GetIdentity ¶
func (c *HTTPCluster) GetIdentity() string
func (*HTTPCluster) GetName ¶
func (c *HTTPCluster) GetName() string
func (*HTTPCluster) GetURL ¶
func (c *HTTPCluster) GetURL() *core.URL
func (*HTTPCluster) IsAvailable ¶
func (c *HTTPCluster) IsAvailable() bool
func (*HTTPCluster) SetProxy ¶
func (c *HTTPCluster) SetProxy(proxy bool)
func (*HTTPCluster) SetSerialization ¶
func (c *HTTPCluster) SetSerialization(s core.Serialization)
func (*HTTPCluster) SetURL ¶
func (c *HTTPCluster) SetURL(url *core.URL)
type MotanCluster ¶
type MotanCluster struct { Context *motan.Context Registries []motan.Registry HaStrategy motan.HaStrategy LoadBalance motan.LoadBalance Refers []motan.EndPoint Filters []motan.Filter // contains filtered or unexported fields }
func NewCluster ¶
func NewCluster(context *motan.Context, extFactory motan.ExtensionFactory, 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) 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.ExtensionFactory)
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)
func (*MotanCluster) ShuffleEndpoints ¶ added in v1.0.2
func (m *MotanCluster) ShuffleEndpoints(endpoints []motan.EndPoint) []motan.EndPoint
Click to show internal directories.
Click to hide internal directories.