fileutil

package
v3.2.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultFileMode is the default file mode for files generated by
	// Dragonboat.
	DefaultFileMode = 0640
	// SnapshotFlagFilename defines the filename of the snapshot flag file.
	SnapshotFlagFilename = "dragonboat.snapshot.message"
)

Variables

This section is empty.

Functions

func CreateFlagFile

func CreateFlagFile(dir string,
	filename string, msg Marshaler, fs vfs.IFS) (err error)

CreateFlagFile creates a flag file in the specific location. The flag file contains the marshaled data of the specified protobuf message.

func DirExist

func DirExist(name string, fs vfs.IFS) (bool, error)

DirExist returns whether the specified filesystem entry exists.

func Exist

func Exist(name string, fs vfs.IFS) (bool, error)

Exist returns whether the specified filesystem entry exists.

func ExtractTarBz2

func ExtractTarBz2(bz2fn string, toDir string, fs vfs.IFS) error

ExtractTarBz2 extracts files and directories from the specified tar.bz2 file to the specified target directory.

func GetFlagFileContent

func GetFlagFileContent(dir string,
	filename string, msg Unmarshaler, fs vfs.IFS) (err error)

GetFlagFileContent gets the content of the flag file found in the specified location. The data of the flag file will be unmarshaled into the specified protobuf message.

func HasFlagFile

func HasFlagFile(dir string, filename string, fs vfs.IFS) bool

HasFlagFile returns a boolean value indicating whether flag file can be found in the specified location.

func IsDirMarkedAsDeleted

func IsDirMarkedAsDeleted(dir string, fs vfs.IFS) (bool, error)

IsDirMarkedAsDeleted returns a boolean flag indicating whether the specified directory has been marked as deleted.

func MarkDirAsDeleted

func MarkDirAsDeleted(dir string, msg Marshaler, fs vfs.IFS) error

MarkDirAsDeleted marks the specified directory as deleted.

func Mkdir

func Mkdir(dir string, fs vfs.IFS) error

Mkdir creates the specified dir.

func MkdirAll

func MkdirAll(dir string, fs vfs.IFS) error

MkdirAll creates the specified dir along with any necessary parents.

func RemoveFlagFile

func RemoveFlagFile(dir string, filename string, fs vfs.IFS) error

RemoveFlagFile removes the specified flag file.

func SyncDir

func SyncDir(dir string, fs vfs.IFS) (err error)

SyncDir calls fsync on the specified directory.

func TempFile

func TempFile(dir,
	pattern string, fs vfs.IFS) (f vfs.File, name string, err error)

Types

type Marshaler

type Marshaler interface {
	Marshal() ([]byte, error)
}

Marshaler is the interface for types that can be Marshaled.

type Unmarshaler

type Unmarshaler interface {
	Unmarshal([]byte) error
}

Jump to

Keyboard shortcuts

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