diskio

package
v1.30.21 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists added in v1.26.0

func FileExists(file string) (bool, error)

func Fsync added in v1.28.5

func Fsync(path string) error

func SanitizeFilePathJoin added in v1.30.20

func SanitizeFilePathJoin(rootPath string, relativeFilePath string) (string, error)

SanitizeFilePathJoin joins a root path and a relative file path, ensuring that the resulting path is within the root path. It assumes that the relativeFilePath is attacker controlled.

Types

type MeteredReader

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

func NewMeteredReader

func NewMeteredReader(file Reader, cb MeteredReaderCallback) *MeteredReader

func (*MeteredReader) Read

func (m *MeteredReader) Read(p []byte) (n int, err error)

Read passes the read through to the underlying reader. On a successful read, it will trigger the attached callback and provide it with metrics. If no callback is set, it will ignore it.

func (*MeteredReader) ReadAt added in v1.30.8

func (m *MeteredReader) ReadAt(p []byte, off int64) (n int, err error)

ReadAt passes the read through to the underlying reader. On a successful read, it will trigger the attached callback and provide it with metrics. If no callback is set, it will ignore it.

type MeteredReaderCallback

type MeteredReaderCallback func(read int64, nanoseconds int64)

type MeteredWriter added in v1.27.23

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

func NewMeteredWriter added in v1.27.23

func (*MeteredWriter) Seek added in v1.27.23

func (m *MeteredWriter) Seek(offset int64, whence int) (int64, error)

func (*MeteredWriter) Write added in v1.27.23

func (m *MeteredWriter) Write(p []byte) (n int, err error)

type MeteredWriterCallback added in v1.27.23

type MeteredWriterCallback func(written int64)

type Reader added in v1.30.8

type Reader interface {
	Read(p []byte) (n int, err error)
	ReadAt(p []byte, off int64) (n int, err error)
}

type WriterSeekerCloser added in v1.27.23

type WriterSeekerCloser interface {
	io.Writer
	io.Seeker
}

Jump to

Keyboard shortcuts

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