eocontext

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 114

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEoCtxUnCloneable = errors.New("EoContext is UnCloneable. ")
View Source
var (
	FilterSkillName = config.TypeNameOf((*IFilter)(nil))
)

Functions

func DoChain

func DoChain(ctx EoContext, orgfilter Filters, append ...IFilter) error

Types

type Attrs

type Attrs map[string]string

Attrs 属性集合

type BalanceHandler

type BalanceHandler interface {
	Select(ctx EoContext) (INode, error)
}

type CompleteHandler

type CompleteHandler interface {
	Complete(ctx EoContext) error
}

type EoApp

type EoApp interface {
	Nodes() []INode
	Scheme() string
	TimeOut() time.Duration
}

type EoContext

type EoContext interface {
	RequestId() string
	AcceptTime() time.Time
	Context() context.Context
	Value(key interface{}) interface{}
	WithValue(key, val interface{})

	Scheme() string
	Assert(i interface{}) error

	SetLabel(name, value string)
	GetLabel(name string) string
	Labels() map[string]string

	GetComplete() CompleteHandler
	SetCompleteHandler(handler CompleteHandler)
	GetFinish() FinishHandler
	SetFinish(handler FinishHandler)
	GetApp() EoApp
	SetApp(app EoApp)
	GetBalance() BalanceHandler
	SetBalance(handler BalanceHandler)
	GetUpstreamHostHandler() UpstreamHostHandler
	SetUpstreamHostHandler(handler UpstreamHostHandler)

	LocalIP() net.IP
	LocalAddr() net.Addr
	LocalPort() int

	IsCloneable() bool
	Clone() (EoContext, error)
}

type Filters

type Filters []IFilter

func (Filters) Destroy

func (fs Filters) Destroy()

func (Filters) DoChain

func (fs Filters) DoChain(ctx EoContext) error

type FinishHandler

type FinishHandler interface {
	Finish(ctx EoContext) error
}

type IAttributes

type IAttributes interface {
	GetAttrs() Attrs
	GetAttrByName(name string) (string, bool)
}

IAttributes 属性接口

type IChain

type IChain interface {
	DoChain(ctx EoContext) error
	Destroy()
}

type IChainPro

type IChainPro interface {
	Destroy()
	Chain(ctx EoContext, append ...IFilter) error
}

type IFilter

type IFilter interface {
	DoFilter(ctx EoContext, next IChain) (err error)
	Destroy()
}

func ToFilter

func ToFilter(chain IChain) IFilter

type INode

type INode interface {
	IAttributes
	ID() string
	IP() string
	Port() int
	Addr() string
	Status() NodeStatus
	Up()
	Down()
	Leave()
}

INode 节点接口

type NodeStatus

type NodeStatus int

NodeStatus 节点状态类型

const (
	//Running 节点运行中状态
	Running NodeStatus = 1
	//Down 节点不可用状态
	Down NodeStatus = 2
	//Leave 节点离开状态
	Leave NodeStatus = 3
)

type PassHostMod

type PassHostMod int
const (
	PassHost PassHostMod = iota
	NodeHost
	ReWriteHost
)

type UpstreamHostHandler

type UpstreamHostHandler interface {
	PassHost() (PassHostMod, string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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