cluster

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: Apache-2.0 Imports: 17 Imported by: 4

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

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

func (c *HTTPCluster) Call(request core.Request) core.Response

func (*HTTPCluster) CanServe

func (c *HTTPCluster) CanServe(uri string) (string, bool)

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

func (c *HTTPCluster) Notify(registryURL *core.URL, urls []*core.URL)

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

func (m *MotanCluster) Call(request motan.Request) (res 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) 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

Jump to

Keyboard shortcuts

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