fileutil

package
v1.5.1-0...-828f39b Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fdatasync

func Fdatasync(f *os.File) error

Fdatasync is similar to fsync(), but does not flush modified metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled.

func Fsync

func Fsync(f *os.File) error

Fsync is a wrapper around file.Sync(). Special handling is needed on darwin platform.

func Preallocate

func Preallocate(f *os.File, size int64) error

Types

type BufferedWriter

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

BufferedWriter writes to a file with buffer.

func NewBufferedWriter

func NewBufferedWriter(fd *os.File, bufSize int, limiter *rate.Limiter) *BufferedWriter

func (*BufferedWriter) Append

func (l *BufferedWriter) Append(val []byte) error

func (*BufferedWriter) Flush

func (l *BufferedWriter) Flush() error

func (*BufferedWriter) Offset

func (l *BufferedWriter) Offset() int64

func (*BufferedWriter) Reset

func (l *BufferedWriter) Reset(fd *os.File)

func (*BufferedWriter) Sync

func (l *BufferedWriter) Sync() error

func (*BufferedWriter) Write

func (l *BufferedWriter) Write(p []byte) (n int, err error)

type DirectWriter

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

DirectWriter writes to a file opened with O_DIRECT flag. `Finish` must be called when the writing is done to truncate and sync the file.

func NewDirectWriter

func NewDirectWriter(fd *os.File, bufSize int, limiter *rate.Limiter) *DirectWriter

func (*DirectWriter) Append

func (l *DirectWriter) Append(val []byte) error

func (*DirectWriter) Finish

func (l *DirectWriter) Finish() error

func (*DirectWriter) Offset

func (l *DirectWriter) Offset() int64

func (*DirectWriter) Reset

func (l *DirectWriter) Reset(fd *os.File)

func (*DirectWriter) Write

func (l *DirectWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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