io

package
v0.0.0-...-bfa2730 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 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

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

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

func (*BufferedReaderAt) ReadAt

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

type BufferedWriteFlusher

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

func NewBufferedWriter

func NewBufferedWriter(w io.Writer) BufferedWriteFlusher

func NewBufferedWriterWithQueue

func NewBufferedWriterWithQueue(w io.Writer) BufferedWriteFlusher

type BufferedWriter

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

func (*BufferedWriter) Close

func (b *BufferedWriter) Close() error

func (*BufferedWriter) Flush

func (b *BufferedWriter) Flush() error

func (*BufferedWriter) Len

func (b *BufferedWriter) Len() int

func (*BufferedWriter) Write

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

type BufferedWriterWithQueue

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

func (b *BufferedWriterWithQueue) Close() error

func (*BufferedWriterWithQueue) Flush

func (b *BufferedWriterWithQueue) Flush() error

func (*BufferedWriterWithQueue) Len

func (b *BufferedWriterWithQueue) Len() int

func (*BufferedWriterWithQueue) Write

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