Documentation
¶
Index ¶
- Constants
- func CreateFlagFile(dir string, filename string, msg Marshaler, fs vfs.FS) (err error)
- func DirExist(name string, fs vfs.FS) (result bool, err error)
- func Exist(name string, fs vfs.FS) (bool, error)
- func GetFlagFileContent(dir string, filename string, obj Unmarshaler, fs vfs.FS) (err error)
- func HasFlagFile(dir string, filename string, fs vfs.FS) bool
- func IsDirMarkedAsDeleted(dir string, fs vfs.FS) (bool, error)
- func MarkDirAsDeleted(dir string, msg Marshaler, fs vfs.FS) error
- func Mkdir(dir string, fs vfs.FS) error
- func MkdirAll(dir string, fs vfs.FS) error
- func MustWrite(w io.Writer, data []byte)
- func RemoveFlagFile(dir string, filename string, fs vfs.FS) error
- func SyncDir(dir string, fs vfs.FS) (err error)
- type Marshaler
- type Unmarshaler
Constants ¶
const (
// DefaultFileMode is the default file mode for files generated.
DefaultFileMode = 0640
)
Variables ¶
This section is empty.
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 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.