Documentation ¶
Index ¶
- Variables
- type CompInfo
- type LocalHandler
- type Member
- type Node
- func (n *Node) CloseSession(_ context.Context, req *clusterpb.CloseSessionRequest) (*clusterpb.CloseSessionResponse, error)
- func (n *Node) DelMember(_ context.Context, req *clusterpb.DelMemberRequest) (*clusterpb.DelMemberResponse, error)
- func (n *Node) HandleNotify(_ context.Context, req *clusterpb.NotifyMessage) (*clusterpb.MemberHandleResponse, error)
- func (n *Node) HandlePush(_ context.Context, req *clusterpb.PushMessage) (*clusterpb.MemberHandleResponse, error)
- func (n *Node) HandleRequest(_ context.Context, req *clusterpb.RequestMessage) (*clusterpb.MemberHandleResponse, error)
- func (n *Node) HandleResponse(_ context.Context, req *clusterpb.ResponseMessage) (*clusterpb.MemberHandleResponse, error)
- func (n *Node) Handler() *LocalHandler
- func (n *Node) Members() []*Member
- func (n *Node) NewMember(_ context.Context, req *clusterpb.NewMemberRequest) (*clusterpb.NewMemberResponse, error)
- func (n *Node) SessionClosed(_ context.Context, req *clusterpb.SessionClosedRequest) (*clusterpb.SessionClosedResponse, error)
- func (n *Node) Sessions() []*session.Session
- func (n *Node) Shutdown()
- func (n *Node) Startup() error
- func (n *Node) Type() string
- type Options
- type RemoteInfo
- type WebsocketOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBrokenPipe represents the low-level connection has broken. ErrBrokenPipe = errors.New("broken low-level pipe") // ErrBufferExceeded indicates that the current session buffer is full and // can not receive more data. ErrBufferExceeded = errors.New("session send buffer exceed") )
var ( ErrSessionOnNotify = errors.New("current session working on notify mode") ErrCloseClosedSession = errors.New("close closed session") ErrInvalidRegisterReq = errors.New("invalid register request") ErrInvalidRoute = errors.New("invalid route") ErrMemberNotRegistered = errors.New("member is not registered") ErrRPC = errors.New("broken rpc") )
Errors that could be occurred during message handling.
Functions ¶
This section is empty.
Types ¶
type CompInfo ¶
type CompInfo struct { Name string ReceiverType string HandlerType string IsRawArg bool Scheduler string }
CompInfo is the component information used by the node monitor
type LocalHandler ¶
type LocalHandler struct {
// contains filtered or unexported fields
}
LocalHandler is the container for all local registered components
func NewHandler ¶
func NewHandler(currentNode *Node, pipeline pipeline.Pipeline) *LocalHandler
NewHandler creates a LocalHandler
func (*LocalHandler) Components ¶
func (h *LocalHandler) Components() []CompInfo
Components show a sorted list of local components for the node monitor
func (*LocalHandler) LocalService ¶
func (h *LocalHandler) LocalService() []string
LocalService returns a sorted local service names
func (*LocalHandler) RemoteService ¶
func (h *LocalHandler) RemoteService() []string
RemoteService returns a sorted remote service names
func (*LocalHandler) Remotes ¶
func (h *LocalHandler) Remotes() []RemoteInfo
Remotes show a sorted remote components list for the node monitor
type Member ¶
type Member struct { IsMaster bool *clusterpb.MemberInfo }
Member is the remote component managed by cluster
type Node ¶
type Node struct { Options // current node options ServiceAddr string // current server service address // 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 ¶
func (n *Node) CloseSession(_ context.Context, req *clusterpb.CloseSessionRequest) (*clusterpb.CloseSessionResponse, error)
CloseSession implements the MemberServer interface
func (*Node) DelMember ¶
func (n *Node) DelMember(_ context.Context, req *clusterpb.DelMemberRequest) (*clusterpb.DelMemberResponse, error)
DelMember implements the MemberServer interface
func (*Node) HandleNotify ¶
func (n *Node) HandleNotify(_ context.Context, req *clusterpb.NotifyMessage) (*clusterpb.MemberHandleResponse, error)
HandleNotify implements the MemberServer interface
func (*Node) HandlePush ¶
func (n *Node) HandlePush(_ context.Context, req *clusterpb.PushMessage) (*clusterpb.MemberHandleResponse, error)
HandlePush implements the MemberServer interface
func (*Node) HandleRequest ¶
func (n *Node) HandleRequest(_ context.Context, req *clusterpb.RequestMessage) (*clusterpb.MemberHandleResponse, error)
HandleRequest implements the MemberServer interface
func (*Node) HandleResponse ¶
func (n *Node) HandleResponse(_ context.Context, req *clusterpb.ResponseMessage) (*clusterpb.MemberHandleResponse, error)
HandleResponse implements the MemberServer interface
func (*Node) NewMember ¶
func (n *Node) NewMember(_ context.Context, req *clusterpb.NewMemberRequest) (*clusterpb.NewMemberResponse, error)
NewMember implements the MemberServer interface
func (*Node) SessionClosed ¶
func (n *Node) SessionClosed(_ context.Context, req *clusterpb.SessionClosedRequest) (*clusterpb.SessionClosedResponse, error)
SessionClosed implements the MemberServer interface
type Options ¶
type Options struct { Pipeline pipeline.Pipeline IsMaster bool RegistryAddr string RegisterInterval time.Duration GateAddr string Components *component.Components Label string MonitorAddr string WebsocketOptions }
Options contains some configurations for current node
type RemoteInfo ¶
type RemoteInfo struct { Name string *clusterpb.MemberInfo }
RemoteInfo is the remote component information used by the node monitor
type WebsocketOptions ¶
type WebsocketOptions struct { IsWebsocket bool TSLCertificate string TSLKey string WSPath string // WebSocket path (eg: ws://127.0.0.1/WSPath) ServeMux *http.ServeMux // do not rely on http.DefaultServeMux, use a private mux CheckOrigin func(*http.Request) bool // check origin when websocket enabled }
WebsocketOptions contains WebSocket related configurations