streamcopy

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

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