buffer

package
v0.0.0-...-c4fa36d Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OPEN  = 0
	CLOSE = 1
)

Variables

View Source
var ErrClosedBuffer = errors.New("closed buffer")
View Source
var ErrClosedPool = errors.New("closed pool")

Functions

This section is empty.

Types

type Buffer

type Buffer interface {
	Cap() uint32
	Len() uint32
	Put(data interface{}) (bool, error)
	Get() (interface{}, error)
	Close() bool
	Closed() bool
}

FIFO的缓冲器类型

func NewBuffer

func NewBuffer(size uint32) (Buffer, error)

type MultipleReader

type MultipleReader interface {
	Reader() io.ReadCloser
}

func NewMultipleReader

func NewMultipleReader(reader io.Reader) (multiple MultipleReader, err error)

type Pool

type Pool interface {
	BufferCap() uint32
	MaxBufferNumber() uint32
	BufferNumber() uint32
	Total() uint64
	Put(data interface{}) error //put用于向缓冲池放入数据, 本方法是阻塞的,如果缓冲池已关闭,返回非nil的错误
	Get() (data interface{}, err error)
	Close() bool  // 缓冲区关闭返回true
	Closed() bool //用于判断是否已经关闭
	String() string
}

缓冲池

func NewPool

func NewPool(bufferCap uint32, maxBufferNumber uint32, name string) (Pool, error)

Jump to

Keyboard shortcuts

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