streamcopy

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 3 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 streamcopy copies known-length blob streams in larger pooled chunks.

Index

Constants

View Source
const BufferSize = 1 << 20

BufferSize balances stream-call reduction against concurrent memory use. At the benchmark's 10 peer serves plus 6 local downloads, a fully busy agent can hold at most roughly 16 MiB of copy buffers.

Variables

This section is empty.

Functions

func BeginActivity added in v0.26.0

func BeginActivity(change func(int)) func()

BeginActivity returns an idempotent finish callback for one active operation.

func CopyN

func CopyN(dst io.Writer, src io.Reader, size int64) (int64, error)

CopyN copies exactly size bytes. It fills each pooled chunk before writing, reducing containerd ReaderAt streams and downstream Writer calls while preserving partial bytes and the original read error on interruption.

func Observe added in v0.26.0

func Observe(body io.ReadCloser, bytes func(int64), finish func()) io.ReadCloser

Observe reports bytes as they are read and finishes on a terminal read or Close. Callbacks must be safe for concurrent calls.

Types

This section is empty.

Jump to

Keyboard shortcuts

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