Documentation ¶
Index ¶
- Constants
- Variables
- func ActivePrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, key string, handler func(kiwi.IRcvNotice, Ntc))
- func ActivePrcPus[Pus util.IMsg](pkt kiwi.IRcvPush, key string, handler func(kiwi.IRcvPush, Pus))
- func ActivePrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, key string, handler func(kiwi.IRcvRequest, Req, Res))
- func AsyncReq(pid int64, head util.M, msg util.IMsg, onFail util.FnInt64MUint16, ...)
- func AsyncReqBytes(pid int64, svc kiwi.TSvc, code kiwi.TCode, head util.M, json bool, ...)
- func AsyncReqNode(pid, nodeId int64, head util.M, msg util.IMsg, onFail util.FnInt64MUint16, ...)
- func AsyncReqNodeBytes(pid, nodeId int64, svc kiwi.TSvc, code kiwi.TCode, head util.M, json bool, ...)
- func AsyncSubReq[ResT util.IMsg](pkt kiwi.IRcvRequest, head util.M, req util.IMsg, resFail util.FnInt64MUint16, ...)
- func BindMsgToSvcCode(msg util.IMsg, svc kiwi.TSvc, code kiwi.TCode)
- func CompletePktCount() uint64
- func ExcludeLog(svc kiwi.TSvc, codes ...kiwi.TCode)
- func GetService(svc kiwi.TSvc) (kiwi.IService, bool)
- func GlobalPrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, handler func(kiwi.IRcvNotice, Ntc))
- func GlobalPrcPus[Pus util.IMsg](pkt kiwi.IRcvPush, handler func(kiwi.IRcvPush, Pus))
- func GlobalPrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, handler func(kiwi.IRcvRequest, Req, Res))
- func GoPrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, handler func(kiwi.IRcvNotice, Ntc))
- func GoPrcPus[Pus util.IMsg](pkt kiwi.IRcvPush, handler func(kiwi.IRcvPush, Pus))
- func GoPrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, handler func(kiwi.IRcvRequest, Req, Res))
- func InitCodec()
- func InitGate(receiver kiwi.FnAgentBytes, opts ...GateOption)
- func InitNodeLocal()
- func InitNodeNet(opts ...NodeOption)
- func InitNodeTest()
- func InitPacker()
- func InitRouter()
- func IsExcludeLog(svc kiwi.TSvc, code kiwi.TCode) bool
- func MsgToSvcCode(msg util.IMsg) (svc kiwi.TSvc, code kiwi.TCode, ok bool)
- func NewNodeLocal() kiwi.INode
- func NewNodeNet(opts ...NodeOption) kiwi.INode
- func Ntf(pid int64, head util.M, msg util.IMsg) int64
- func Pus(pid int64, head util.M, msg util.IMsg) int64
- func PusNode(pid, nodeId int64, head util.M, msg util.IMsg) int64
- func ReceivePktCount() uint64
- func RegisterSvc(services ...kiwi.IService)
- func Req[ResT util.IMsg](pid int64, head util.M, msg util.IMsg) (ResT, util.M, uint16)
- func Req2(pid int64, head util.M, msg util.IMsg) (util.IMsg, util.M, uint16)
- func ReqBytes(pid int64, svc kiwi.TSvc, code kiwi.TCode, head util.M, json bool, ...) ([]byte, util.M, uint16)
- func ReqNode[ResT any](nodeId, pid int64, head util.M, msg util.IMsg) (ResT, util.M, uint16)
- func ReqNodeBytes(nodeId, pid int64, svc kiwi.TSvc, code kiwi.TCode, head util.M, json bool, ...) ([]byte, util.M, uint16)
- func ResponseSendFailCount() uint64
- func SelfPrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, handler func(kiwi.IRcvNotice, Ntc))
- func SelfPrcPus[Pus util.IMsg](pkt kiwi.IRcvPush, handler func(kiwi.IRcvPush, Pus))
- func SelfPrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, handler func(kiwi.IRcvRequest, Req, Res))
- func SharePrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, key string, handler func(kiwi.IRcvNotice, Ntc))
- func SharePrcPus[Pus util.IMsg](pkt kiwi.IRcvPush, key string, handler func(kiwi.IRcvPush, Pus))
- func SharePrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, key string, handler func(kiwi.IRcvRequest, Req, Res))
- func ShutdownAllService()
- func StartAllService()
- func StartDefault(opts ...Option)
- type Gate
- type GateOption
- func GateCheckIp(fn util.StrToBool) GateOption
- func GateConnCap(cap int32) GateOption
- func GateConnected(connected kiwi.FnAgent) GateOption
- func GateDeadlineSecs(deadline int) GateOption
- func GateDisconnected(disconnected kiwi.FnAgentErr) GateOption
- func GateHeadLen(headLen uint32) GateOption
- func GateIp(ip string) GateOption
- func GateRoles(roles map[kiwi.TSvcCode][]int64) GateOption
- func GateTcpPort(port int) GateOption
- func GateUdpPort(port int) GateOption
- func GateWebsocketPort(port int) GateOption
- type Meta
- type Mongo
- type NodeConnType
- type NodeDialerSelector
- type NodeOption
- type OnNetDialerConnected
- type OnNetDialerDisconnected
- type Option
- func SetGate(receiver kiwi.FnAgentBytes, options ...GateOption) Option
- func SetLoggers(loggers ...kiwi.ILogger) Option
- func SetMeta(meta *Meta) Option
- func SetMongoDB(uri, db string, options *options.DatabaseOptions) Option
- func SetRedis(addr, user, pw string, db int) Option
- func SetServices(services []kiwi.IService) Option
- func SetWorker(active, share, parallel, global bool) Option
- type RcvNtfPkt
- func (p *RcvNtfPkt) Code() kiwi.TCode
- func (p *RcvNtfPkt) Complete()
- func (p *RcvNtfPkt) Err(err *util.Err)
- func (p *RcvNtfPkt) Err2(code util.TErrCode, m util.M)
- func (p *RcvNtfPkt) Err3(code util.TErrCode, e error)
- func (p *RcvNtfPkt) Head() util.M
- func (p *RcvNtfPkt) HeadId() string
- func (p *RcvNtfPkt) InitWithBytes(msgType uint8, tid int64, head util.M, json bool, payload []byte) *util.Err
- func (p *RcvNtfPkt) InitWithMsg(msgType uint8, tid int64, head util.M, json bool, msg util.IMsg)
- func (p *RcvNtfPkt) Json() bool
- func (p *RcvNtfPkt) Msg() util.IMsg
- func (p *RcvNtfPkt) SenderId() int64
- func (p *RcvNtfPkt) SetWorker(typ kiwi.EWorker, key string)
- func (p *RcvNtfPkt) Svc() kiwi.TSvc
- func (p *RcvNtfPkt) Tid() int64
- func (p *RcvNtfPkt) Worker() kiwi.EWorker
- func (p *RcvNtfPkt) WorkerKey() string
- type RcvPusPkt
- func (p *RcvPusPkt) Code() kiwi.TCode
- func (p *RcvPusPkt) Complete()
- func (p *RcvPusPkt) Err(err *util.Err)
- func (p *RcvPusPkt) Err2(code util.TErrCode, m util.M)
- func (p *RcvPusPkt) Err3(code util.TErrCode, e error)
- func (p *RcvPusPkt) Head() util.M
- func (p *RcvPusPkt) HeadId() string
- func (p *RcvPusPkt) InitWithBytes(msgType uint8, tid int64, head util.M, json bool, payload []byte) *util.Err
- func (p *RcvPusPkt) InitWithMsg(msgType uint8, tid int64, head util.M, json bool, msg util.IMsg)
- func (p *RcvPusPkt) Json() bool
- func (p *RcvPusPkt) Msg() util.IMsg
- func (p *RcvPusPkt) SenderId() int64
- func (p *RcvPusPkt) SetWorker(typ kiwi.EWorker, key string)
- func (p *RcvPusPkt) Svc() kiwi.TSvc
- func (p *RcvPusPkt) Tid() int64
- func (p *RcvPusPkt) Worker() kiwi.EWorker
- func (p *RcvPusPkt) WorkerKey() string
- type RcvReqPkt
- func (p *RcvReqPkt) Code() kiwi.TCode
- func (p *RcvReqPkt) Complete()
- func (p *RcvReqPkt) Err(err *util.Err)
- func (p *RcvReqPkt) Err2(code util.TErrCode, m util.M)
- func (p *RcvReqPkt) Err3(code util.TErrCode, e error)
- func (p *RcvReqPkt) Fail(code uint16)
- func (p *RcvReqPkt) Head() util.M
- func (p *RcvReqPkt) HeadId() string
- func (p *RcvReqPkt) InitWithBytes(msgType uint8, tid int64, head util.M, json bool, payload []byte) *util.Err
- func (p *RcvReqPkt) InitWithMsg(msgType uint8, tid int64, head util.M, json bool, msg util.IMsg)
- func (p *RcvReqPkt) Json() bool
- func (p *RcvReqPkt) Msg() util.IMsg
- func (p *RcvReqPkt) Ok(msg util.IMsg)
- func (p *RcvReqPkt) SenderId() int64
- func (p *RcvReqPkt) SetWorker(typ kiwi.EWorker, key string)
- func (p *RcvReqPkt) Svc() kiwi.TSvc
- func (p *RcvReqPkt) Tid() int64
- func (p *RcvReqPkt) Worker() kiwi.EWorker
- func (p *RcvReqPkt) WorkerKey() string
- type Redis
- type SNotify
- func (p *SNotify) Code() kiwi.TCode
- func (n *SNotify) Dispose()
- func (p *SNotify) GetSvcNodeId() (int64, bool)
- func (p *SNotify) Head() util.M
- func (p *SNotify) InitHead()
- func (p *SNotify) Json() bool
- func (p *SNotify) Msg() util.IMsg
- func (p *SNotify) Payload() []byte
- func (p *SNotify) Pid() int64
- func (p *SNotify) Svc() kiwi.TSvc
- func (p *SNotify) Tid() int64
- type SPush
- func (p *SPush) Code() kiwi.TCode
- func (p *SPush) Dispose()
- func (p *SPush) GetSvcNodeId() (int64, bool)
- func (p *SPush) Head() util.M
- func (p *SPush) InitHead()
- func (p *SPush) Json() bool
- func (p *SPush) Msg() util.IMsg
- func (p *SPush) Payload() []byte
- func (p *SPush) Pid() int64
- func (p *SPush) Svc() kiwi.TSvc
- func (p *SPush) Tid() int64
- type SRequest
- func (p *SRequest) Code() kiwi.TCode
- func (r *SRequest) Dispose()
- func (r *SRequest) Fail(head util.M, code uint16)
- func (p *SRequest) GetSvcNodeId() (int64, bool)
- func (p *SRequest) Head() util.M
- func (p *SRequest) InitHead()
- func (p *SRequest) Json() bool
- func (p *SRequest) Msg() util.IMsg
- func (r *SRequest) Ok(head util.M, msg util.IMsg)
- func (r *SRequest) OkBytes(head util.M, bytes []byte)
- func (p *SRequest) Payload() []byte
- func (p *SRequest) Pid() int64
- func (r *SRequest) SetBytesHandler(fail util.FnInt64MUint16, ok util.FnInt64MBytes)
- func (r *SRequest) SetHandler(fail util.FnInt64MUint16, ok util.FnInt64MMsg)
- func (p *SRequest) Svc() kiwi.TSvc
- func (p *SRequest) Tid() int64
- type Worker
Constants ¶
View Source
const ( HdHeartbeat uint8 = iota + 1 HdPush HdRequest HdOk HdFail HdWatch HdNotify )
View Source
const ( HeadId = "id" HeadSvc = "svc" HeadCode = "cod" HeadSndId = "snd_id" HeadSndTs = "snd_ts" )
View Source
const (
DefConnCap = 1 << 12
)
Variables ¶
View Source
var ( MaxReconnect = 5 MaxSendRetry = uint8(3) SendRetryDur = time.Second )
View Source
var (
GenHead util.FnM = func(m util.M) {
}
)
View Source
var (
Heartbeat = []byte{HdHeartbeat}
)
View Source
var (
ResponseTimeoutDur = time.Duration(5000) * time.Millisecond
)
Functions ¶
func ActivePrcNtc ¶
func ActivePrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, key string, handler func(kiwi.IRcvNotice, Ntc))
func ActivePrcPus ¶
func ActivePrcReq ¶
func ActivePrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, key string, handler func(kiwi.IRcvRequest, Req, Res))
func AsyncReq ¶
func AsyncReq(pid int64, head util.M, msg util.IMsg, onFail util.FnInt64MUint16, onOk util.FnInt64MMsg)
func AsyncReqBytes ¶
func AsyncReqNode ¶
func AsyncReqNode(pid, nodeId int64, head util.M, msg util.IMsg, onFail util.FnInt64MUint16, onOk util.FnInt64MMsg)
func AsyncReqNodeBytes ¶
func AsyncSubReq ¶
func CompletePktCount ¶
func CompletePktCount() uint64
func GlobalPrcNtc ¶
func GlobalPrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, handler func(kiwi.IRcvNotice, Ntc))
func GlobalPrcPus ¶
func GlobalPrcReq ¶
func GlobalPrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, handler func(kiwi.IRcvRequest, Req, Res))
func GoPrcNtc ¶
func GoPrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, handler func(kiwi.IRcvNotice, Ntc))
func GoPrcReq ¶
func GoPrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, handler func(kiwi.IRcvRequest, Req, Res))
func InitGate ¶
func InitGate(receiver kiwi.FnAgentBytes, opts ...GateOption)
func InitNodeLocal ¶
func InitNodeLocal()
func InitNodeNet ¶
func InitNodeNet(opts ...NodeOption)
func InitNodeTest ¶
func InitNodeTest()
func InitPacker ¶
func InitPacker()
func InitRouter ¶
func InitRouter()
func NewNodeLocal ¶
func NewNodeNet ¶
func NewNodeNet(opts ...NodeOption) kiwi.INode
func ReceivePktCount ¶
func ReceivePktCount() uint64
func RegisterSvc ¶
func ReqNodeBytes ¶
func ResponseSendFailCount ¶
func ResponseSendFailCount() uint64
func SelfPrcNtc ¶
func SelfPrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, handler func(kiwi.IRcvNotice, Ntc))
func SelfPrcPus ¶
func SelfPrcReq ¶
func SelfPrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, handler func(kiwi.IRcvRequest, Req, Res))
func SharePrcNtc ¶
func SharePrcNtc[Ntc util.IMsg](pkt kiwi.IRcvNotice, key string, handler func(kiwi.IRcvNotice, Ntc))
func SharePrcPus ¶
func SharePrcReq ¶
func SharePrcReq[Req, Res util.IMsg](pkt kiwi.IRcvRequest, key string, handler func(kiwi.IRcvRequest, Req, Res))
func ShutdownAllService ¶
func ShutdownAllService()
func StartAllService ¶
func StartAllService()
func StartDefault ¶
func StartDefault(opts ...Option)
Types ¶
type GateOption ¶
type GateOption func(option *gateOption)
func GateCheckIp ¶
func GateCheckIp(fn util.StrToBool) GateOption
func GateConnCap ¶
func GateConnCap(cap int32) GateOption
func GateConnected ¶
func GateConnected(connected kiwi.FnAgent) GateOption
func GateDeadlineSecs ¶
func GateDeadlineSecs(deadline int) GateOption
func GateDisconnected ¶
func GateDisconnected(disconnected kiwi.FnAgentErr) GateOption
func GateHeadLen ¶
func GateHeadLen(headLen uint32) GateOption
func GateIp ¶
func GateIp(ip string) GateOption
func GateTcpPort ¶
func GateTcpPort(port int) GateOption
func GateUdpPort ¶
func GateUdpPort(port int) GateOption
func GateWebsocketPort ¶
func GateWebsocketPort(port int) GateOption
type NodeDialerSelector ¶
type NodeOption ¶
type NodeOption func(opt *nodeOption)
func NodeIp ¶
func NodeIp(ip string) NodeOption
func NodePort ¶
func NodePort(port int) NodeOption
func NodeSelector ¶
func NodeSelector(selector NodeDialerSelector) NodeOption
func NodeType ¶
func NodeType(t NodeConnType) NodeOption
type OnNetDialerConnected ¶
type OnNetDialerConnected func(*nodeDialer)
type OnNetDialerDisconnected ¶
type Option ¶
type Option func(*option)
func SetGate ¶
func SetGate(receiver kiwi.FnAgentBytes, options ...GateOption) Option
func SetLoggers ¶
func SetMongoDB ¶
func SetMongoDB(uri, db string, options *options.DatabaseOptions) Option
func SetServices ¶
type RcvNtfPkt ¶
type RcvNtfPkt struct {
// contains filtered or unexported fields
}
func NewRcvNtfPkt ¶
func NewRcvNtfPkt() *RcvNtfPkt
func (*RcvNtfPkt) InitWithBytes ¶
func (*RcvNtfPkt) InitWithMsg ¶
type RcvPusPkt ¶
type RcvPusPkt struct {
// contains filtered or unexported fields
}
func NewRcvPusPkt ¶
func NewRcvPusPkt() *RcvPusPkt
func (*RcvPusPkt) InitWithBytes ¶
func (*RcvPusPkt) InitWithMsg ¶
type RcvReqPkt ¶
type RcvReqPkt struct {
// contains filtered or unexported fields
}
func NewRcvReqPkt ¶
func NewRcvReqPkt() *RcvReqPkt
func (*RcvReqPkt) InitWithBytes ¶
func (*RcvReqPkt) InitWithMsg ¶
type SNotify ¶
type SNotify struct {
// contains filtered or unexported fields
}
func (*SNotify) GetSvcNodeId ¶
type SPush ¶
type SPush struct {
// contains filtered or unexported fields
}
func (*SPush) GetSvcNodeId ¶
type SRequest ¶
type SRequest struct {
// contains filtered or unexported fields
}
func (*SRequest) GetSvcNodeId ¶
func (*SRequest) SetBytesHandler ¶
func (r *SRequest) SetBytesHandler(fail util.FnInt64MUint16, ok util.FnInt64MBytes)
func (*SRequest) SetHandler ¶
func (r *SRequest) SetHandler(fail util.FnInt64MUint16, ok util.FnInt64MMsg)
Click to show internal directories.
Click to hide internal directories.