package io
import "github.com/influxdata/influxdb/kit/io"
Index ¶
Variables ¶
Types ¶
type LimitedReadCloser ¶
type LimitedReadCloser struct { R io.ReadCloser // underlying reader N int64 // max bytes remaining // contains filtered or unexported fields }
LimitedReadCloser wraps an io.ReadCloser in limiting behavior using io.LimitedReader. It allows us to obtain the limit error at the time of close instead of just when writing.
func NewLimitedReadCloser ¶
func NewLimitedReadCloser(r io.ReadCloser, n int64) *LimitedReadCloser
NewLimitedReadCloser returns a new LimitedReadCloser.
func (*LimitedReadCloser) Close ¶
func (l *LimitedReadCloser) Close() (err error)
Close returns an ErrReadLimitExceeded when the wrapped reader exceeds the set limit for number of bytes. This is safe to call more than once but not concurrently.
func (*LimitedReadCloser) Read ¶
func (l *LimitedReadCloser) Read(p []byte) (n int, err error)
Source Files ¶
- Version
- v1.12.0 (latest)
- Published
- Apr 8, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 2 days ago –
Tools for package owners.