ioutil

package
v0.15.8 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ioutil provides wrappers around golang IO interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MeteredReadCloser

type MeteredReadCloser interface {
	io.ReadCloser
	// Bytes reports the total number of bytes read in Read calls.
	Bytes() int64
	// Duration reports the total duration of time spent on Read calls.
	Duration() time.Duration
}

MeteredReadCloser tracks how much time is spent and bytes are read in Read calls.

func NewMeteredReadCloser

func NewMeteredReadCloser(rc io.ReadCloser, fns ...func(int, time.Duration)) MeteredReadCloser

NewMeteredReadCloser creates a MeteredReadCloser which tracks the amount of time spent and bytes read in Read calls to the provided inner ReadCloser. Optional callbacks will be called with the time spent and bytes read in each Read call.

type MeteredReader

type MeteredReader interface {
	io.Reader
	// Bytes reports the total number of bytes read in Read calls.
	Bytes() int64
	// Duration reports the total duration of time spent on Read calls.
	Duration() time.Duration
}

MeteredReader tracks how much time is spent and bytes are read in Read calls.

func NewMeteredReader

func NewMeteredReader(r io.Reader, fns ...func(int, time.Duration)) MeteredReader

NewMeteredReader creates a MeteredReader which tracks the amount of time spent and bytes read in Read calls to the provided inner Reader. Optional callbacks will be called with the time spent and bytes read in each Read call.

type MeteredWriteCloser

type MeteredWriteCloser interface {
	io.WriteCloser
	// Duration reports the total duration of time spent on Write calls.
	Duration() time.Duration
}

MeteredWriteCloser tracks how much time is spent and bytes are written in Write calls.

func NewMeteredWriteCloser

func NewMeteredWriteCloser(wc io.WriteCloser, fns ...func(int, time.Duration)) MeteredWriteCloser

NewMeteredWriteCloser creates a MeteredWriteCloser which tracks the amount of time spent and bytes writtein in Write calls to the provided inner WriteCloser. Optional callbacks will be called with the time spent and bytes written in each Write call.

type MeteredWriter

type MeteredWriter interface {
	io.Writer
	// Duration reports the total duration of time spent on Writer calls.
	Duration() time.Duration
}

MeteredWriter tracks how much time is spent and bytes are written in Write calls.

func NewMeteredWriter

func NewMeteredWriter(tw io.Writer, fns ...func(int, time.Duration)) MeteredWriter

NewMeteredWriter creates a MeteredWriter which tracks the amount of time spent and bytes written in Write calls to the provided inner Writer. Optional callbacks will be called with the time spent and bytes written in each Write call.

type TimeoutCloser

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

TimeoutCloser is an io.Closer that has a timeout for executing the Close() function.

func NewTimeoutCloser

func NewTimeoutCloser(ctx context.Context, closer io.Closer, timeout time.Duration) *TimeoutCloser

func (*TimeoutCloser) Close

func (c *TimeoutCloser) Close() error

Jump to

Keyboard shortcuts

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