Documentation ¶
Index ¶
- Variables
- type CustomerRemoteServiceRoute
- 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) NewMember(_ context.Context, req *clusterpb.NewMemberRequest) (*clusterpb.NewMemberResponse, error)
- func (n *Node) SessionClosed(_ context.Context, req *clusterpb.SessionClosedRequest) (*clusterpb.SessionClosedResponse, error)
- func (n *Node) Shutdown()
- func (n *Node) Startup() error
- type Options
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 ¶
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
type Node ¶
type Node struct { Options // current node options ServiceAddr string // current server service address (RPC) RpcClient *rpcClient // 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)
func (*Node) HandleNotify ¶
func (n *Node) HandleNotify(_ context.Context, req *clusterpb.NotifyMessage) (*clusterpb.MemberHandleResponse, error)
func (*Node) HandlePush ¶
func (n *Node) HandlePush(_ context.Context, req *clusterpb.PushMessage) (*clusterpb.MemberHandleResponse, error)
func (*Node) HandleRequest ¶
func (n *Node) HandleRequest(_ context.Context, req *clusterpb.RequestMessage) (*clusterpb.MemberHandleResponse, error)
func (*Node) HandleResponse ¶
func (n *Node) HandleResponse(_ context.Context, req *clusterpb.ResponseMessage) (*clusterpb.MemberHandleResponse, error)
func (*Node) Handler ¶
func (n *Node) Handler() *LocalHandler
func (*Node) NewMember ¶
func (n *Node) NewMember(_ context.Context, req *clusterpb.NewMemberRequest) (*clusterpb.NewMemberResponse, error)
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 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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.