fs

package
v1.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2019 License: Apache-2.0 Imports: 9 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HardLinkFiles

func HardLinkFiles(srcDir, dstDir string) error

HardLinkFiles makes hard links for all the files from srcDir in dstDir.

func IsDirOrSymlink(fi os.FileInfo) bool

IsDirOrSymlink returns true if fi is directory or symlink.

func IsPathExist

func IsPathExist(path string) bool

IsPathExist returns whether the given path exists.

func MkdirAllFailIfExist

func MkdirAllFailIfExist(path string) error

MkdirAllFailIfExist creates the given path dir if it isn't exist.

Returns error if path already exists.

func MkdirAllIfNotExist

func MkdirAllIfNotExist(path string) error

MkdirAllIfNotExist creates the given path dir if it isn't exist.

func MustClose

func MustClose(f *os.File)

MustClose must close the given file f.

func MustRemoveAll added in v1.19.0

func MustRemoveAll(path string)

MustRemoveAll removes path with all the contents.

It properly handles NFS issue https://github.com/VictoriaMetrics/VictoriaMetrics/issues/61 .

func MustSyncPath added in v1.19.2

func MustSyncPath(path string)

MustSyncPath syncs contents of the given path.

func MustWriteData

func MustWriteData(w io.Writer, data []byte)

MustWriteData writes data to w.

func ReadFullData

func ReadFullData(r io.Reader, data []byte) error

ReadFullData reads len(data) bytes from r.

func RemoveDirContents

func RemoveDirContents(dir string)

RemoveDirContents removes all the contents of the given dir it it exists.

It doesn't remove the dir itself, so the dir may be mounted to a separate partition.

func SymlinkRelative

func SymlinkRelative(srcPath, dstPath string) error

SymlinkRelative creates relative symlink for srcPath in dstPath.

func WriteFile

func WriteFile(path string, data []byte) error

WriteFile writes data to the given file path.

WriteFile returns only after the file is fully written to the underlying storage.

Types

type ReadAtCloser

type ReadAtCloser interface {
	// ReadAt must read len(p) bytes from offset off to p.
	ReadAt(p []byte, off int64)

	// MustClose must close the reader.
	MustClose()
}

ReadAtCloser is rand-access read interface.

type ReaderAt

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

ReaderAt implements rand-access read.

func OpenReaderAt

func OpenReaderAt(path string) (*ReaderAt, error)

OpenReaderAt opens a file on the given path for random-read access.

The file must be closed with MustClose when no longer needed.

func (*ReaderAt) MustClose

func (ra *ReaderAt) MustClose()

MustClose closes ra.

func (*ReaderAt) ReadAt

func (ra *ReaderAt) ReadAt(p []byte, off int64)

ReadAt reads len(p) bytes from off to p.

Jump to

Keyboard shortcuts

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