Documentation
¶
Index ¶
- Constants
- Variables
- func GetId(key string) (uint64, error)
- func InitCluster(app, nodeName string, s2s bool, s2sPort uint)
- func SentInfo(protoID uint64, data []byte, from, to string, safe bool) error
- func SentStop(from, to string) (*model, error)
- func SentSync(protoID uint64, data []byte, from, to string, chanSize uint8, safe bool) ([]byte, error)
- func SentSyncLocal(protoID uint64, data []byte, from, to string, chanSize uint8, safe bool) ([]byte, error)
- func SetDefaultFunc(defaultFun func() bool) opt
- func SetIsGlobal(isGlobal bool) opt
- func SetLiveTime(minutes int) opt
- func SetRetry(count uint8, seconds uint32) opt
- type Data
- type Handler
- type Message
- type QuickHandel
- func (qh *QuickHandel) HandlerAsync(msg *Message) (Handler, *Message)
- func (qh *QuickHandel) HandlerInfo(msg *Message) Handler
- func (qh *QuickHandel) HandlerStop() Handler
- func (qh *QuickHandel) HandlerSync(msg *SyncMessage) ([]byte, Handler)
- func (qh *QuickHandel) Run(data Handler, opts ...opt) error
- func (qh *QuickHandel) SafeRun(data Handler, opts ...opt) error
- func (qh *QuickHandel) SafeSendInfo(to string, protoID uint64, data []byte) error
- func (qh *QuickHandel) SendInfo(to string, protoID uint64, data []byte) error
- func (qh *QuickHandel) SendStop(to string) (*model, error)
- func (qh *QuickHandel) SendSync(to string, protoID uint64, data []byte) ([]byte, error)
- type SafeHandel
- func (h *SafeHandel) HandlerAsync(msg *Message) (Handler, *Message)
- func (h *SafeHandel) HandlerInfo(msg *Message) Handler
- func (h *SafeHandel) HandlerStop() Handler
- func (h *SafeHandel) HandlerSync(msg *SyncMessage) ([]byte, Handler)
- func (h *SafeHandel) QuickRun(data Handler, opts ...opt) error
- func (h *SafeHandel) QuickSendInfo(to string, protoID uint64, data []byte) error
- func (h *SafeHandel) Run(data Handler, opts ...opt) error
- func (h *SafeHandel) SendInfo(to string, protoID uint64, data []byte) error
- func (h *SafeHandel) SendStop(to string) (*model, error)
- func (h *SafeHandel) SendSync(to string, protoID uint64, data []byte) ([]byte, error)
- type SyncMessage
Constants ¶
View Source
const ( // behavior:(app):model:(modelID) ModelNodeKey = "behavior:%s:process-on-node:%s" // behavior:(app):node:list:(nodeID) NodeListKey = "behavior:%s:node-process-list:%s" // behavior:(app):node:addr:(nodeID) NodeAddrKey = "behavior:%s:node-addr:%s:%s" // behavior:(app):dead_node DeadNodeKey = "behavior:%s:dead_node" )
View Source
const ( C2S = "c2s" S2S = "s2s" )
for NodeAddrKey
View Source
const ( MaxModelCount uint32 = 10000 SafeModelCount uint32 = 1000 WarningModelCountL1 uint32 = 5000 WarningModelCountL2 uint32 = 6000 WarningModelCountL3 uint32 = 7000 )
for retry
View Source
const ( LiveTime time.Duration = 20 * time.Minute LiveTimeWarning time.Duration = 1 * time.Minute )
LiveTime duration
View Source
const ( NullString string = "" Zero uint64 = 0 ZeroUint8 uint8 = 0 One uint64 = 1 )
default value
View Source
const ( ResultOK uint32 = iota ErrSocketErr ErrUnCodeErr ErrParamErr )
error code
View Source
const ChanMaxLen uint8 = 20
View Source
const CleanDuration time.Duration = 30 * time.Second
View Source
const (
IPVersion string = "tcp4"
)
conn
View Source
const IsGlobal = false
IsGlobal modify
View Source
const RedisAddr = "127.0.0.1:6379"
Variables ¶
View Source
var ClusterCenter *clusterCenter
go-zero的redis可以处理集群,所以用它的redis
Functions ¶
func InitCluster ¶
func SentSyncLocal ¶
func SetDefaultFunc ¶
func SetDefaultFunc(defaultFun func() bool) opt
func SetIsGlobal ¶
func SetIsGlobal(isGlobal bool) opt
func SetLiveTime ¶
func SetLiveTime(minutes int) opt
Types ¶
type Handler ¶
type Handler interface { HandlerStop() Handler HandlerInfo(*Message) Handler HandlerSync(*SyncMessage) ([]byte, Handler) }
func OnThisNode ¶
type QuickHandel ¶
type QuickHandel struct {
Name string
}
func (*QuickHandel) HandlerAsync ¶
func (qh *QuickHandel) HandlerAsync(msg *Message) (Handler, *Message)
func (*QuickHandel) HandlerInfo ¶
func (qh *QuickHandel) HandlerInfo(msg *Message) Handler
func (*QuickHandel) HandlerStop ¶
func (qh *QuickHandel) HandlerStop() Handler
func (*QuickHandel) HandlerSync ¶
func (qh *QuickHandel) HandlerSync(msg *SyncMessage) ([]byte, Handler)
func (*QuickHandel) Run ¶
func (qh *QuickHandel) Run(data Handler, opts ...opt) error
func (*QuickHandel) SafeRun ¶
func (qh *QuickHandel) SafeRun(data Handler, opts ...opt) error
func (*QuickHandel) SafeSendInfo ¶
func (qh *QuickHandel) SafeSendInfo(to string, protoID uint64, data []byte) error
func (*QuickHandel) SendInfo ¶
func (qh *QuickHandel) SendInfo(to string, protoID uint64, data []byte) error
func (*QuickHandel) SendStop ¶
func (qh *QuickHandel) SendStop(to string) (*model, error)
type SafeHandel ¶
type SafeHandel struct {
Name string
}
func (*SafeHandel) HandlerAsync ¶
func (h *SafeHandel) HandlerAsync(msg *Message) (Handler, *Message)
func (*SafeHandel) HandlerInfo ¶
func (h *SafeHandel) HandlerInfo(msg *Message) Handler
func (*SafeHandel) HandlerStop ¶
func (h *SafeHandel) HandlerStop() Handler
func (*SafeHandel) HandlerSync ¶
func (h *SafeHandel) HandlerSync(msg *SyncMessage) ([]byte, Handler)
func (*SafeHandel) QuickRun ¶
func (h *SafeHandel) QuickRun(data Handler, opts ...opt) error
func (*SafeHandel) QuickSendInfo ¶
func (h *SafeHandel) QuickSendInfo(to string, protoID uint64, data []byte) error
func (*SafeHandel) Run ¶
func (h *SafeHandel) Run(data Handler, opts ...opt) error
func (*SafeHandel) SendInfo ¶
func (h *SafeHandel) SendInfo(to string, protoID uint64, data []byte) error
func (*SafeHandel) SendStop ¶
func (h *SafeHandel) SendStop(to string) (*model, error)
type SyncMessage ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.