ringbuffer

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_RING_LEN = 1024
	SMALL_BUF_SIZE   = 1024
	MIDDLE_BUF_SIZE  = 2048
	// By default, the PAGE_SIZE is 4096 Bytes.
	// so may be more efficient for slices?
	BIG_BUF_SIZE = 4096
	// 2MB per HUGE PAGE
	HUGE_PAGE_SIZE = 1024 * 1024 * 2
	// 5 Minute per cleaning period
	SWEEP_POOL_EXPIRE = 300
)
View Source
const (
	READING_POOL = iota
	WRITING_POOL
	READING_LEFT
	WRITING_LEFT
)

Variables

View Source
var (
	POOL_EMPTY   = errors.New("pool is empty")
	BUFFER_EMPTY = errors.New("buffer is empty")
)

Functions

func New

func New(isBlock bool, ringOpts ...int) io.ReadWriter

Types

type Ring

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

func (*Ring) Read

func (r *Ring) Read(b []byte) (n int, err error)

func (*Ring) Write

func (r *Ring) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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