Documentation ¶
Index ¶
- Constants
- func ErrorResponse(err error) (uint32, []byte, error)
- func FSM() *bzgncmap.Map[string, *IPState]
- func New[SI any, NI any](address string, routerMap RouterMap, fs map[uint32]NoticeFunc[NI], ...) error
- func NoResponse() (uint32, []byte, error)
- func Response(msgID uint32, data []byte) (uint32, []byte, error)
- type BizLog
- type IPState
- type NoticeFunc
- type NoticeInfo
- type RouterMap
- type Service
Constants ¶
View Source
const MsgIDErrorResponse = 0
View Source
const MsgIDNoResponse = 10000
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New[SI any, NI any]( address string, routerMap RouterMap, fs map[uint32]NoticeFunc[NI], hearBeatTicker time.Duration, hearBeatTimeout time.Duration, isClientHearBeat bool, info SI, ) error
New 服务 SI server info 服务附带的信息 NC notice channel 通知的主结构 NI notice info 通知附带的信息
func NoResponse ¶
Types ¶
type IPState ¶
type IPState struct { EndTime int64 // 过期时间戳 IP string RespChan chan *protofile.LogicResponse Cancel context.CancelFunc //IsNotFirst bool Info any WriteTimer int64 }
type NoticeFunc ¶
type NoticeFunc[I any] func(ctx context.Context, msgID uint32, info *NoticeInfo[I])
type NoticeInfo ¶
type NoticeInfo[I any] struct { IP string Info I ResChan chan *protofile2.LogicResponse // contains filtered or unexported fields }
func (*NoticeInfo[I]) NoticeSend ¶
func (n *NoticeInfo[I]) NoticeSend(done bool, f func())
NoticeSend 自定义通知业务内调用的方法
type Service ¶
type Service[SI any, NI any] struct { protofile2.UnimplementedLogicServiceServer // contains filtered or unexported fields }
func (*Service[SI, NI]) Send ¶
func (s *Service[SI, NI]) Send(ss protofile2.LogicService_SendServer) error
func (*Service[SI, NI]) SendNotice ¶
func (s *Service[SI, NI]) SendNotice(ctx context.Context, ip string, ss protofile2.LogicService_SendServer) error
SendNotice 发送通知任务
Click to show internal directories.
Click to hide internal directories.