Documentation ¶
Index ¶
- Constants
- Variables
- func CreateFlagFile(dir string, filename string, msg pb.Marshaler, fs vfs.IFS) (err error)
- func CreateTemp(dir string, pattern string) (*os.File, error)
- func DirExist(name string, fs vfs.IFS) (result bool, err error)
- func Exist(name string, fs vfs.IFS) (bool, error)
- func ExtractTarBz2(bz2fn string, toDir string, fs vfs.IFS) (err error)
- func GetFlagFileContent(dir string, filename string, msg pb.Unmarshaler, fs vfs.IFS) (err error)
- func HasFlagFile(dir string, filename string, fs vfs.IFS) bool
- func IsDirMarkedAsDeleted(dir string, fs vfs.IFS) (bool, error)
- func MarkDirAsDeleted(dir string, msg pb.Marshaler, fs vfs.IFS) error
- func Mkdir(dir string, fs vfs.IFS) error
- func MkdirAll(dir string, fs vfs.IFS) error
- func MkdirTemp(dir string, pattern string) (string, error)
- func MustWrite(w io.Writer, data []byte)
- func ReadAll(r io.Reader) ([]byte, error)
- func ReadFile(name string) ([]byte, error)
- func RemoveFlagFile(dir string, filename string, fs vfs.IFS) error
- func SyncDir(dir string, fs vfs.IFS) (err error)
- func TempDir(dir, pattern string, fs vfs.IFS) (name string, err error)
- func TempFile(dir, pattern string, fs vfs.IFS) (f vfs.File, name string, err error)
Constants ¶
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 ¶
var Discard = io.Discard
Discard ...
Functions ¶
func CreateFlagFile ¶
CreateFlagFile creates a flag file in the specific location. The flag file contains the marshaled data of the specified protobuf message.
CreateFlagFile is not atomic meaning you can end up having a file at fs.PathJoin(dir, filename) with partial or corrupted content when the machine crashes in the middle of this function call. Special care must be taken to handle such situation, see how CreateFlagFile is used by snapshot images as an example.
func ExtractTarBz2 ¶
ExtractTarBz2 extracts files and directories from the specified tar.bz2 file to the specified target directory.
func GetFlagFileContent ¶
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 ¶
HasFlagFile returns a boolean value indicating whether flag file can be found in the specified location.
func IsDirMarkedAsDeleted ¶
IsDirMarkedAsDeleted returns a boolean flag indicating whether the specified directory has been marked as deleted.
func MarkDirAsDeleted ¶
MarkDirAsDeleted marks the specified directory as deleted.
func MustWrite ¶
MustWrite writes the specified data to the input writer. It will panic if there is any error.
func RemoveFlagFile ¶
RemoveFlagFile removes the specified flag file.
func TempDir ¶
TempDir creates a new temporary directory in the directory dir. The directory name is generated by taking pattern and applying a random string to the end. If pattern includes a "*", the random string replaces the last "*". TempDir returns the name of the new directory. If dir is the empty string, TempDir uses the default directory for temporary files (see os.TempDir). Multiple programs calling TempDir simultaneously will not choose the same directory. It is the caller's responsibility to remove the directory when no longer needed.
Types ¶
This section is empty.