multireadbuf

package
v0.0.0-...-21cfbab Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = fmt.Errorf("MultiReaderBuffer already closed for writes")

Functions

This section is empty.

Types

type MultiReaderSingleWriterBuffer

type MultiReaderSingleWriterBuffer struct {
	// Writer's public fields, can be set before calling Write();
	FlushThresholdBytes int
	// contains filtered or unexported fields
}

MultiReaderSingleWriterBuffer manages a byte buffer that can be appended to by one goroutine (via Write()) while many readers read from the same buffer via Reader(). Readers block in Read() until data is available. The writer must call Close() to flush the final block of data to the readers.

The buffer is never discarded; even after the writer calls Close, new readers can still begin reading the buffer.

func New

func New(initialBufSize int) *MultiReaderSingleWriterBuffer

func (*MultiReaderSingleWriterBuffer) Close

func (*MultiReaderSingleWriterBuffer) Len

func (*MultiReaderSingleWriterBuffer) Reader

func (*MultiReaderSingleWriterBuffer) Write

func (m *MultiReaderSingleWriterBuffer) Write(p []byte) (n int, err error)

type Reader

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

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

func (*Reader) WriteTo

func (r *Reader) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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