channel

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	// contains filtered or unexported fields
}

Channel 通道

func NewChannel

func NewChannel(ctx context.Context, conf *config.JSON) *Channel

NewChannel 创建通道

func (*Channel) Close

func (c *Channel) Close()

Close 关闭

func (*Channel) IsEmpty

func (c *Channel) IsEmpty() bool

IsEmpty 通道是否为空

func (*Channel) Pop

func (c *Channel) Pop() (r element.Record, ok bool)

Pop 将记录弹出,当通道中不存在记录,就会返回false

func (*Channel) PopAll

func (c *Channel) PopAll(onRecord func(element.Record) error) error

PopAll 通过onRecord函数弹出多条记录

func (*Channel) Push

func (c *Channel) Push(r element.Record) (n int, err error)

Push 将记录r加入通道

func (*Channel) PushAll

func (c *Channel) PushAll(fetchRecord func() (element.Record, error)) error

PushAll 通过fetchRecord函数加入多条记录

func (*Channel) PushTerminate

func (c *Channel) PushTerminate() (n int)

PushTerminate 加入终止记录

func (*Channel) Size

func (c *Channel) Size() int

Size 通道记录大小

func (*Channel) StatsJSON added in v0.1.2

func (c *Channel) StatsJSON() StatsJSON

StatsJSON 返回Channel的统计信息

type Stats added in v0.1.2

type Stats struct {
	sync.RWMutex
	StatsJSON
}

Stats Channel的统计信息

type StatsJSON added in v0.1.2

type StatsJSON struct {
	TotalByte   int64 `json:"totalByte"`
	TotalRecord int64 `json:"totalRecord"`
	Byte        int64 `json:"byte"`
	Record      int64 `json:"record"`
}

StatsJSON Channel的JSON统计信息

Jump to

Keyboard shortcuts

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