io

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadAllWithBuffer

func ReadAllWithBuffer(r io.Reader, estimatedBytes int, b []byte) ([]byte, error)

ReadAllWithBuffer is a fork of https://go.googlesource.com/go/+/go1.16.3/src/io/io.go#626

with a buffer to read into. if the provided buffer is not large enough it will be extended
and returned to the caller

func ReadAllWithEstimate

func ReadAllWithEstimate(r io.Reader, estimatedBytes int64) ([]byte, error)

ReadAllWithEstimate is a fork of https://go.googlesource.com/go/+/go1.16.3/src/io/io.go#626

with a starting buffer size. if none is provided it uses the existing default of 512

Types

type BufferedReaderAt added in v1.5.0

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

BufferedReaderAt implements io.ReaderAt but extends and buffers reads up to the given buffer size. Subsequent reads are returned from the buffers. Additionally it supports concurrent readers by maintaining multiple buffers at different offsets, and matching up reads with existing buffers where possible. When needed the least-recently-used buffer is overwritten with new reads.

func NewBufferedReaderAt added in v1.5.0

func NewBufferedReaderAt(ra io.ReaderAt, readerSize int64, bufSize, bufCount int) *BufferedReaderAt

func (*BufferedReaderAt) ReadAt added in v1.5.0

func (r *BufferedReaderAt) ReadAt(b []byte, offset int64) (int, error)

type BufferedWriteFlusher added in v1.5.0

type BufferedWriteFlusher interface {
	io.WriteCloser
	Len() int
	Flush() error
}

func NewBufferedWriter added in v1.5.0

func NewBufferedWriter(w io.Writer) BufferedWriteFlusher

func NewBufferedWriterWithQueue added in v1.5.0

func NewBufferedWriterWithQueue(w io.Writer) BufferedWriteFlusher

type BufferedWriter added in v1.5.0

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

func (*BufferedWriter) Close added in v1.5.0

func (b *BufferedWriter) Close() error

func (*BufferedWriter) Flush added in v1.5.0

func (b *BufferedWriter) Flush() error

func (*BufferedWriter) Len added in v1.5.0

func (b *BufferedWriter) Len() int

func (*BufferedWriter) Write added in v1.5.0

func (b *BufferedWriter) Write(p []byte) (n int, err error)

type BufferedWriterWithQueue added in v1.5.0

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

BufferedWriterWithQueue is an attempt at writing an async queue of outgoing data to the underlying writer. As a tradeoff for removing flushes from the hot path, this writer does not provide guarantees about bubbling up errors and takes a best effort approach to signal a failure.

Note: This is not used at the moment due to concerns with error handling when writing async data to the backend.

func (*BufferedWriterWithQueue) Close added in v1.5.0

func (b *BufferedWriterWithQueue) Close() error

func (*BufferedWriterWithQueue) Flush added in v1.5.0

func (b *BufferedWriterWithQueue) Flush() error

func (*BufferedWriterWithQueue) Len added in v1.5.0

func (b *BufferedWriterWithQueue) Len() int

func (*BufferedWriterWithQueue) Write added in v1.5.0

func (b *BufferedWriterWithQueue) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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