package io
import "k8s.io/utils/io"
Index ¶
- Variables
- func ConsistentRead(filename string, attempts int) ([]byte, error)
- func IsInconsistentReadError(err error) bool
- func ReadAtMost(r io.Reader, limit int64) ([]byte, error)
- type InconsistentReadError
Variables ¶
ErrLimitReached means that the read limit is reached.
Functions ¶
func ConsistentRead ¶
ConsistentRead repeatedly reads a file until it gets the same content twice. This is useful when reading files in /proc that are larger than page size and kernel may modify them between individual read() syscalls. It returns InconsistentReadError when it cannot get a consistent read in given nr. of attempts. Caller should retry, kernel is probably under heavy mount/unmount load.
func IsInconsistentReadError ¶
func ReadAtMost ¶
ReadAtMost reads up to `limit` bytes from `r`, and reports an error when `limit` bytes are read.
Types ¶
type InconsistentReadError ¶
type InconsistentReadError struct {
// contains filtered or unexported fields
}
InconsistentReadError is returned from ConsistentRead when it cannot get a consistent read in given nr. of attempts. Caller should retry, kernel is probably under heavy mount/unmount load.
func (InconsistentReadError) Error ¶
func (i InconsistentReadError) Error() string
Source Files ¶
read.go
- Version
- v0.0.0-20250321185631-1f6e0b77f77e (latest)
- Published
- Mar 21, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 month ago –
Tools for package owners.