Documentation
¶
Index ¶
- Constants
- Variables
- func GetUUID() string
- type AuthMsg
- func (*AuthMsg) Descriptor() ([]byte, []int)
- func (m *AuthMsg) GetNodeId() string
- func (m *AuthMsg) GetPassword() string
- func (*AuthMsg) ProtoMessage()
- func (m *AuthMsg) Reset()
- func (m *AuthMsg) String() string
- func (m *AuthMsg) XXX_DiscardUnknown()
- func (m *AuthMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AuthMsg) XXX_Merge(src proto.Message)
- func (m *AuthMsg) XXX_Size() int
- func (m *AuthMsg) XXX_Unmarshal(b []byte) error
- type BatchData
- type BindNodeIdMsg
- func (*BindNodeIdMsg) Descriptor() ([]byte, []int)
- func (m *BindNodeIdMsg) GetNodeId() string
- func (*BindNodeIdMsg) ProtoMessage()
- func (m *BindNodeIdMsg) Reset()
- func (m *BindNodeIdMsg) String() string
- func (m *BindNodeIdMsg) XXX_DiscardUnknown()
- func (m *BindNodeIdMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BindNodeIdMsg) XXX_Merge(src proto.Message)
- func (m *BindNodeIdMsg) XXX_Size() int
- func (m *BindNodeIdMsg) XXX_Unmarshal(b []byte) error
- type ClientsMsg
- func (*ClientsMsg) Descriptor() ([]byte, []int)
- func (m *ClientsMsg) GetData() []byte
- func (m *ClientsMsg) GetReceiveClientIds() []string
- func (*ClientsMsg) ProtoMessage()
- func (m *ClientsMsg) Reset()
- func (m *ClientsMsg) String() string
- func (m *ClientsMsg) XXX_DiscardUnknown()
- func (m *ClientsMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ClientsMsg) XXX_Merge(src proto.Message)
- func (m *ClientsMsg) XXX_Size() int
- func (m *ClientsMsg) XXX_Unmarshal(b []byte) error
- type Context
- type DefaultPlugin
- type Msg
- func (*Msg) Descriptor() ([]byte, []int)
- func (m *Msg) GetData() []byte
- func (m *Msg) GetMsgType() int32
- func (*Msg) ProtoMessage()
- func (m *Msg) Reset()
- func (m *Msg) String() string
- func (m *Msg) XXX_DiscardUnknown()
- func (m *Msg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Msg) XXX_Merge(src proto.Message)
- func (m *Msg) XXX_Size() int
- func (m *Msg) XXX_Unmarshal(b []byte) error
- type Node
- type NodeConf
- func (conf *NodeConf) WithAddr(addr string) *NodeConf
- func (conf *NodeConf) WithClientInterval(pingInterval int64) *NodeConf
- func (conf *NodeConf) WithInternalPort(port int64) *NodeConf
- func (conf *NodeConf) WithPassword(password string) *NodeConf
- func (conf *NodeConf) WithPlugin(plugin Plugin) *NodeConf
- func (conf *NodeConf) WithPort(port int64) *NodeConf
- type NodeInfo
- func (*NodeInfo) Descriptor() ([]byte, []int)
- func (m *NodeInfo) GetClientAddress() string
- func (m *NodeInfo) GetClientCount() int64
- func (m *NodeInfo) GetTimestamp() int64
- func (*NodeInfo) ProtoMessage()
- func (m *NodeInfo) Reset()
- func (m *NodeInfo) String() string
- func (m *NodeInfo) XXX_DiscardUnknown()
- func (m *NodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NodeInfo) XXX_Merge(src proto.Message)
- func (m *NodeInfo) XXX_Size() int
- func (m *NodeInfo) XXX_Unmarshal(b []byte) error
- type Plugin
- type RedisNode
- type Session
Constants ¶
View Source
const ( DefaultPassword = "password" DefaultNodePingInterval = 10 NodeAddress = "node_address" )
Variables ¶
View Source
var PingMsg []byte
Functions ¶
Types ¶
type AuthMsg ¶
type AuthMsg struct {
NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*AuthMsg) Descriptor ¶
func (*AuthMsg) GetPassword ¶
func (*AuthMsg) ProtoMessage ¶
func (*AuthMsg) ProtoMessage()
func (*AuthMsg) XXX_DiscardUnknown ¶
func (m *AuthMsg) XXX_DiscardUnknown()
func (*AuthMsg) XXX_Marshal ¶
func (*AuthMsg) XXX_Unmarshal ¶
type BindNodeIdMsg ¶
type BindNodeIdMsg struct {
NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*BindNodeIdMsg) Descriptor ¶
func (*BindNodeIdMsg) Descriptor() ([]byte, []int)
func (*BindNodeIdMsg) GetNodeId ¶
func (m *BindNodeIdMsg) GetNodeId() string
func (*BindNodeIdMsg) ProtoMessage ¶
func (*BindNodeIdMsg) ProtoMessage()
func (*BindNodeIdMsg) Reset ¶
func (m *BindNodeIdMsg) Reset()
func (*BindNodeIdMsg) String ¶
func (m *BindNodeIdMsg) String() string
func (*BindNodeIdMsg) XXX_DiscardUnknown ¶
func (m *BindNodeIdMsg) XXX_DiscardUnknown()
func (*BindNodeIdMsg) XXX_Marshal ¶
func (m *BindNodeIdMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*BindNodeIdMsg) XXX_Merge ¶
func (m *BindNodeIdMsg) XXX_Merge(src proto.Message)
func (*BindNodeIdMsg) XXX_Size ¶
func (m *BindNodeIdMsg) XXX_Size() int
func (*BindNodeIdMsg) XXX_Unmarshal ¶
func (m *BindNodeIdMsg) XXX_Unmarshal(b []byte) error
type ClientsMsg ¶
type ClientsMsg struct {
ReceiveClientIds []string `protobuf:"bytes,1,rep,name=receive_client_ids,json=receiveClientIds,proto3" json:"receive_client_ids,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*ClientsMsg) Descriptor ¶
func (*ClientsMsg) Descriptor() ([]byte, []int)
func (*ClientsMsg) GetData ¶
func (m *ClientsMsg) GetData() []byte
func (*ClientsMsg) GetReceiveClientIds ¶
func (m *ClientsMsg) GetReceiveClientIds() []string
func (*ClientsMsg) ProtoMessage ¶
func (*ClientsMsg) ProtoMessage()
func (*ClientsMsg) Reset ¶
func (m *ClientsMsg) Reset()
func (*ClientsMsg) String ¶
func (m *ClientsMsg) String() string
func (*ClientsMsg) XXX_DiscardUnknown ¶
func (m *ClientsMsg) XXX_DiscardUnknown()
func (*ClientsMsg) XXX_Marshal ¶
func (m *ClientsMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ClientsMsg) XXX_Merge ¶
func (m *ClientsMsg) XXX_Merge(src proto.Message)
func (*ClientsMsg) XXX_Size ¶
func (m *ClientsMsg) XXX_Size() int
func (*ClientsMsg) XXX_Unmarshal ¶
func (m *ClientsMsg) XXX_Unmarshal(b []byte) error
type Context ¶
type Context struct {
Conn protocol.Connection
ClientId string
Msg []byte
}
Params of onMsg
type DefaultPlugin ¶
type DefaultPlugin struct {
}
func (*DefaultPlugin) OnClose ¶
func (this *DefaultPlugin) OnClose(conn protocol.Connection)
func (*DefaultPlugin) OnConnect ¶
func (this *DefaultPlugin) OnConnect(conn protocol.Connection)
type Msg ¶
type Msg struct {
MsgType int32 `protobuf:"varint,1,opt,name=msg_type,json=msgType,proto3" json:"msg_type,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*Msg) Descriptor ¶
func (*Msg) GetMsgType ¶
func (*Msg) ProtoMessage ¶
func (*Msg) ProtoMessage()
func (*Msg) XXX_DiscardUnknown ¶
func (m *Msg) XXX_DiscardUnknown()
func (*Msg) XXX_Unmarshal ¶
type Node ¶
type Node interface {
// SetClientIdOnline binds the client ID to the connection
SetClientIdOnline(conn protocol.Connection, clientId string) error
// OnClientPing updates the client heartbeat status
OnClientPing(clientId string) error
// IsOnline gets the online status of the clientId
IsOnline(clientId string) bool
// SendToClientId sends a message to a clientId
SendToClientId(clientId string, req []byte) error
// SendToClientId sends a message to multiple clientIds
SendToClientIds(clientIds []string, req []byte) error
}
type NodeConf ¶
type NodeConf struct {
// contains filtered or unexported fields
}
NodeConf node config
func NewNodeConf ¶
func NewNodeConf(addr string, protocolHandler protocol.Protocol, sessionStorageHandler session_storage.SessionStorage, discoveryHandler discovery.ServiceDiscovery, onMsg func(context *Context)) *NodeConf
NewNodeConf creates a new NodeConf.
func (*NodeConf) WithClientInterval ¶
WithClientInterval sets the heartbeat interval
func (*NodeConf) WithInternalPort ¶
WithInternalPort sets the port for internal protocol
func (*NodeConf) WithPassword ¶
WithPassword sets the password for transport node
func (*NodeConf) WithPlugin ¶
WithPlugin sets the plugin
type NodeInfo ¶
type NodeInfo struct {
ClientAddress string `protobuf:"bytes,1,opt,name=client_address,json=clientAddress,proto3" json:"client_address,omitempty"`
ClientCount int64 `protobuf:"varint,2,opt,name=client_count,json=clientCount,proto3" json:"client_count,omitempty"`
Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*NodeInfo) Descriptor ¶
func (*NodeInfo) GetClientAddress ¶
func (*NodeInfo) GetClientCount ¶
func (*NodeInfo) GetTimestamp ¶
func (*NodeInfo) ProtoMessage ¶
func (*NodeInfo) ProtoMessage()
func (*NodeInfo) XXX_DiscardUnknown ¶
func (m *NodeInfo) XXX_DiscardUnknown()
func (*NodeInfo) XXX_Marshal ¶
func (*NodeInfo) XXX_Unmarshal ¶
type Plugin ¶
type Plugin interface {
OnConnect(conn protocol.Connection)
OnClose(conn protocol.Connection)
}
type Session ¶
type Session struct {
Conn protocol.Connection
ClientId string
}
func (*Session) CasClientId ¶
CasClientId sets the session uid and return oldClientId
func (*Session) LoadClientId ¶
LoadClientId returns the session uid.
func (*Session) StoreClientId ¶
StoreClientId sets the session uid.
Click to show internal directories.
Click to hide internal directories.