bytes

package
v0.0.0-...-31a32bb Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

func NewBuffer

func NewBuffer(size int) *Buffer

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

type BufferWriter

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

func NewWriterSize

func NewWriterSize(n int) *BufferWriter

func (*BufferWriter) Buffer

func (w *BufferWriter) Buffer() []byte

Buffer 获取buffer已写入的全部护具

func (*BufferWriter) Len

func (w *BufferWriter) Len() int

Len 获取buffer已经被写入的大小

func (*BufferWriter) Peek

func (w *BufferWriter) Peek(n int) []byte

Peek 获取缓冲区的一块内存地址(即:返回的内存会被调用方执行写入操作)

func (*BufferWriter) Reset

func (w *BufferWriter) Reset()

Reset 重置buffer

func (*BufferWriter) Size

func (w *BufferWriter) Size() int

Size 获取buffer的大小

func (*BufferWriter) Write

func (w *BufferWriter) Write(p []byte)

Write 把数据copy到Writer的缓冲区

type Hash

type Hash struct {
	Readers []Pool // Reader池子
	Writers []Pool // Writer池子
	// contains filtered or unexported fields
}

func NewHash

func NewHash(config *Options) Hash

func (*Hash) ReaderPool

func (pool *Hash) ReaderPool(rn int) *Pool

ReaderPool get a reader memory buffer.

func (*Hash) WriterPool

func (pool *Hash) WriterPool(rn int) *Pool

WriterPool get a writer memory buffer pool.

type Options

type Options struct {
	ReadPool  PoolOptions `yaml:"readPoolOption"`
	WritePool PoolOptions `yaml:"writePoolOption"`
}

type Pool

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

func (*Pool) Get

func (pool *Pool) Get() (b *Buffer)

Get a Buffer from Pool(free LinkList)

func (*Pool) Init

func (pool *Pool) Init(bufSize, batchNum int)

Init init Pool

func (*Pool) Put

func (pool *Pool) Put(b *Buffer)

Put back a Buffer to the Pool

type PoolOptions

type PoolOptions struct {
	PoolNum  int `yaml:"poolNum"`  // 池子的个数
	BatchNum int `yaml:"batchNum"` // 池子创建Buffer时批量创建的个数
	BufSize  int `yaml:"bufSize"`  // 每个Buffer的字节数
}

type PoolSync

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

PoolSync A BufferPool based on sync.Pool

func (*PoolSync) Init

func (p *PoolSync) Init(bufNum, bufSize int) *PoolSync

Jump to

Keyboard shortcuts

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