cluster

package
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: 10 Imported by: 2

Documentation

Overview

Package cluster contains Cluster implement and command process. Cluster manage group of endpoints for client and agent.

Index

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

func (CmdList) Len

func (c CmdList) Len() int

func (CmdList) Less

func (c CmdList) Less(i, j int) bool

func (CmdList) Swap

func (c CmdList) Swap(i, j int)

type Command

type Command struct {
	ClientCommandList []ClientCommand `json:"clientCommandList"`
}

func ParseCommand

func ParseCommand(commandInfo string) *Command

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) Call

func (m *MotanCluster) Call(request motan.Request) motan.Response

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)

Jump to

Keyboard shortcuts

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