Help us shape the future of Go! Take the 2026 Go Developer Survey

ownedstream

package
v0.5.3 Latest Latest
Warning

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

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

Documentation

Overview

Package ownedstream retains a borrowed stream until reads and close actually return. It is used by both sides of one outbound HTTP transport attempt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Nil

func Nil(v any) bool

Types

type Body

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

func New

func New(ctx context.Context, source io.ReadCloser, maximum, expected int64) (*Body, error)

func (*Body) BytesRead

func (b *Body) BytesRead() int64

func (*Body) Close

func (b *Body) Close() error

Close interrupts a read using the underlying io.ReadCloser contract, then waits for that read's actual exit. It never holds readMu while closing source.

func (*Body) Err

func (b *Body) Err() error

Err includes a swallowed read failure after a custom transport/callback returns. A normal EOF is not a failure.

func (*Body) Read

func (b *Body) Read(p []byte) (int, error)

Jump to

Keyboard shortcuts

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