msgpool

package
v0.0.0-...-7c02c66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Gid = uuid.New().String()

Functions

func GetMsgChannel

func GetMsgChannel(sid string, platform uint8) (ch chWarp, ok bool)

func RegisterTerm

func RegisterTerm(ctx context.Context, c client.XClient, ch chan *protocol.Message, sid string, platform uint8) (needKeep bool, err error)

如果needKeep为true,请不要在外部关闭XClient

func RunMsgPollServer

func RunMsgPollServer(ctx context.Context)

Types

type ConcurrentQueue

type ConcurrentQueue[T any] struct {
	// contains filtered or unexported fields
}

ConcurrentQueue 是一个并发安全的队列数据结构

func NewConcurrentQueue

func NewConcurrentQueue[T any]() *ConcurrentQueue[T]

NewConcurrentQueue 创建一个新的并发安全队列

func (*ConcurrentQueue[T]) Dequeue

func (q *ConcurrentQueue[T]) Dequeue() QueueResult[T]

Dequeue 从队列头部移除并返回元素

func (*ConcurrentQueue[T]) Enqueue

func (q *ConcurrentQueue[T]) Enqueue(value T)

Enqueue 将元素添加到队列尾部

func (*ConcurrentQueue[T]) Size

func (q *ConcurrentQueue[T]) Size() int

Size 返回队列的大小

type MsgPool

type MsgPool interface {
}

type QueueResult

type QueueResult[T any] struct {
	IsNil bool
	Value T
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL