cluster

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBrokenPipe represents the low-level connection has broken.
	ErrBrokenPipe = errors.New("broken low-level pipe")
	// ErrBufferExceed indicates that the current session buffer is full and
	// can not receive more data.
	ErrBufferExceed = errors.New("session send buffer exceed")
)
View Source
var (
	ErrSessionOnNotify    = errors.New("current session working on notify mode")
	ErrCloseClosedSession = errors.New("close closed session")
	ErrInvalidRegisterReq = errors.New("invalid register request")
)

Errors that could be occurred during message handling.

Functions

This section is empty.

Types

type CustomerRemoteServiceRoute added in v0.5.1

type CustomerRemoteServiceRoute func(service string, session *session.Session, members []*clusterpb.MemberInfo) *clusterpb.MemberInfo

CustomerRemoteServiceRoute customer remote service route

type LocalHandler

type LocalHandler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(currentNode *Node, pipeline pipeline.Pipeline) *LocalHandler

func (*LocalHandler) LocalService

func (h *LocalHandler) LocalService() []string

func (*LocalHandler) RemoteService

func (h *LocalHandler) RemoteService() []string

type Member

type Member struct {
	// contains filtered or unexported fields
}

func (*Member) MemberInfo

func (m *Member) MemberInfo() *clusterpb.MemberInfo

func (*Member) String added in v0.5.1

func (m *Member) String() string

type Node

type Node struct {
	Options            // current node options
	ServiceAddr string // current server service address (RPC)
	// contains filtered or unexported fields
}

Node represents a node in nano cluster, which will contains a group of services. All services will register to cluster and messages will be forwarded to the node which provides respective service

func (*Node) CloseSession

CloseSession implements the MemberServer interface

func (*Node) DelMember

func (*Node) HandleNotify

func (*Node) HandlePush

func (*Node) HandleRequest

func (*Node) HandleResponse

func (*Node) Handler

func (n *Node) Handler() *LocalHandler

func (*Node) NewMember

func (*Node) SessionClosed

SessionClosed implements the MemberServer interface

func (*Node) Shutdown

func (n *Node) Shutdown()

Shutdowns all components registered by application, that call by reverse order against register

func (*Node) Startup

func (n *Node) Startup() error

type Options

type Options struct {
	Pipeline           pipeline.Pipeline
	IsMaster           bool
	AdvertiseAddr      string
	RetryInterval      time.Duration
	ClientAddr         string
	Components         *component.Components
	Label              string
	IsWebsocket        bool
	TSLCertificate     string
	TSLKey             string
	UnregisterCallback func(Member)
	RemoteServiceRoute CustomerRemoteServiceRoute
}

Options contains some configurations for current node

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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