valve

package module
v0.0.0-...-5c94f02 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReceiveInternalQueue = errors.New("unable read internal queue")
View Source
var ErrUnableAdd = errors.New("unable to add")

Functions

This section is empty.

Types

type Core

type Core[T any] struct {
	Ticker    *time.Ticker // 至少多久尝试输出一次
	BatchSize int64        // 一次聚合多少
	// contains filtered or unexported fields
}

func NewCore

func NewCore[T any](ticker *time.Ticker, batchSize int64, inChanSize int, outChanSize int) (*Core[T], error)

func (*Core[T]) Add

func (c *Core[T]) Add(ctx context.Context, item T) error

func (*Core[T]) BAdd

func (c *Core[T]) BAdd(item T) error

BAdd will block unitl tiem add to in chan

func (*Core[T]) DoneInCounter

func (c *Core[T]) DoneInCounter()

func (*Core[T]) GetInCounter

func (c *Core[T]) GetInCounter() int64

func (*Core[T]) GetOutinCounter

func (c *Core[T]) GetOutinCounter() int64

func (*Core[T]) Receive

func (c *Core[T]) Receive() (chan []T, error)

func (*Core[T]) Start

func (c *Core[T]) Start(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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