Documentation ¶
Overview ¶
Package io contains utility for working with golang's io objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeadlineReader ¶
DeadlineWriter describes object that could prepare io.Reader methods with some deadline.
type DeadlineWriter ¶
DeadlineWriter describes object that could prepare io.Writer methods with some deadline.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
reader is a wrapper around io.Reader. Underlying reader should not be *bufio.Reader. It used to calculate stats of reading from underlying reader.
func WrapReader ¶
WrapReader wraps r into Reader to calculate usage stats of r. Note that Reader is not goroutine safe.
type Stat ¶
type Stat struct { Bytes uint32 // Bytes sent/read from underlying object. Calls uint32 // Read/Write calls made to the underlying object. }
Stat represents statistics about underlying io.{Reader,Writer} usage.
type TimeoutReader ¶
type TimeoutReader struct { Dest DeadlineReader Timeout time.Duration }
TimeoutReader is a wrapper around DeadlineReader that sets read deadline on each Read() call. It is useful as destination for bufio.Reader, when you do not exactly know, when Read() will occure, but want to control timeout of such calls.
type TimeoutWriter ¶
type TimeoutWriter struct { Dest DeadlineWriter Timeout time.Duration }
TimeoutWriter is a wrapper around DeadlineWriter that sets write deadline on each Write() call. It is useful as destination for bufio.Writer, when you do not exactly know, when Write() will occure, but want to control timeout of such calls.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is a wrapper around io.Writer. Underlying writer should not be *bufio.Writer. It used to calculate stats of writing to underlying writer.
func WrapWriter ¶
WrapWriter wraps w into Writer to calculate usage stats of w. Note that Writer is not goroutine safe.