verifiedio

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package verifiedio provides bounded content copying for worker staging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(ctx context.Context, source io.Reader, destination io.Writer, size int64, digest string) error

Copy requires the exact byte count and digest before reporting success.

func CopyLimit

func CopyLimit(ctx context.Context, source io.Reader, destination io.Writer, size, maximum int64, digest string) error

CopyLimit bounds bytes even when the source size is unknown.

func Read

func Read(ctx context.Context, source io.ReadCloser, destination io.Writer, size, maximum int64, digest string) error

Read copies from a source that must unblock Read when Close is called. It closes the source exactly once, including on cancellation, and retains close errors. A negative size permits up to maximum bytes; otherwise the exact size is required. The digest is a lowercase SHA256 without a prefix.

func Snapshot

func Snapshot(ctx context.Context, data []byte, release func()) io.ReadCloser

Snapshot takes ownership of verified bytes and returns a cancellation-aware memory reader. Close releases its bytes and calls release exactly once. Reads and Close may run concurrently. The caller must not mutate data after transfer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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