writeloop

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WriteLoop

type WriteLoop[Message any] struct {
	// contains filtered or unexported fields
}

WriteLoop 写循环

  • 用于将数据并发安全的写入到底层连接

func NewWriteLoop

func NewWriteLoop[Message any](pool *concurrent.Pool[Message], writeHandle func(message Message) error, errorHandle func(err any)) *WriteLoop[Message]

NewWriteLoop 创建写循环

  • pool 用于管理 Message 对象的缓冲池,在创建 Message 对象时也应该使用该缓冲池,以便复用 Message 对象。 WriteLoop 会在写入完成后将 Message 对象放回缓冲池

func (*WriteLoop[Message]) Close

func (slf *WriteLoop[Message]) Close()

Close 关闭写循环

func (*WriteLoop[Message]) Put

func (slf *WriteLoop[Message]) Put(message Message)

Put 将数据放入写循环

Jump to

Keyboard shortcuts

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