diskbuffer

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MinRead = 512

MinRead is the minimum slice size passed to a Read call by Buffer.ReadFrom. As long as the Buffer has at least MinRead bytes beyond what is required to hold the contents of r, ReadFrom will not grow the underlying buffer.

Variables

View Source
var ErrReadOnly = errors.New("diskbuffer.Buffer: mutating operation attempted on read only buffer")
View Source
var ErrTooLarge = errors.New("diskbuffer.Buffer: too large")

ErrTooLarge is passed to panic if memory cannot be allocated to store data in a buffer.

Functions

This section is empty.

Types

type Buffer

type Buffer interface {
	io.Reader
	io.Writer
	io.Closer
	io.ReaderFrom
	io.StringWriter
	io.WriterTo
	io.Seeker
	ReadBytes(delim byte) (line []byte, err error)
	ReadString(delim byte) (line string, err error)
	Peek(n int) (p []byte, err error)
	Size() int64
	Slice(offset, len int64) Slice
}

func New

func New(opts ...Option) Buffer

New creates and initializes a new Buffer using sizeHint as the initialsize of the memory buffer

type ErrMaxSizeExceeded

type ErrMaxSizeExceeded int64

ErrMaxSizeExceeded is returned when the maximum allowed buffer size is reached when writing

func (ErrMaxSizeExceeded) Error

func (e ErrMaxSizeExceeded) Error() string

type Option

type Option interface {
	// contains filtered or unexported methods
}

BrowserControllerOption configures BrowserController.

func WithMaxMemBytes

func WithMaxMemBytes(size int64) Option

func WithMaxTotalBytes

func WithMaxTotalBytes(size int64) Option

func WithMemBufferSizeHint

func WithMemBufferSizeHint(size int64) Option

func WithTmpDir

func WithTmpDir(dir string) Option

type Slice

type Slice interface {
	io.Reader
	io.WriterTo
	io.Closer
	io.Seeker
	ReadBytes(delim byte) (line []byte, err error)
	ReadString(delim byte) (line string, err error)
	Peek(n int) (p []byte, err error)
	Size() int64
}

Jump to

Keyboard shortcuts

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