bgreader

package
v5.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bgreader provides a io.Reader that can optionally buffer reads in the background.

Index

Constants

View Source
const (
	StatusStopped = iota
	StatusRunning
	StatusStopping
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BGReader

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

BGReader is an io.Reader that can optionally buffer reads in the background. It is safe for concurrent use.

func New

func New(r io.Reader) *BGReader

func (*BGReader) Read

func (r *BGReader) Read(p []byte) (int, error)

Read implements the io.Reader interface.

func (*BGReader) Start

func (r *BGReader) Start()

Start starts the backgrounder reader. If the background reader is already running this is a no-op. The background reader will stop automatically when the underlying reader returns an error.

func (*BGReader) Status added in v5.4.2

func (r *BGReader) Status() int32

Status returns the current status of the background reader.

func (*BGReader) Stop

func (r *BGReader) Stop()

Stop tells the background reader to stop after the in progress Read returns. It is safe to call Stop when the background reader is not running.

Jump to

Keyboard shortcuts

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