package
0.0.0-20241216085717-195abfbd72f5
Repository: https://github.com/cloudnative-pg/machinery.git
Documentation: pkg.go.dev
# Packages
Package compatibility provides a layer to cross-compile with other OS than Linux.
# Functions
AppendStringToFile append the content of the given string to the end of the target file prepending new data with a carriage return.
CopyFile copy a file from a location to another one.
CreateEmptyFile create an empty file or return an error if the file already exist.
EnsureDirectoryExists check if the passed directory exists or not, and if it doesn't exist, create it using 0700 as permissions bits.
EnsureParentDirectoryExists check whether the directory containing a certain file exists, and if it does not exist, create it using 0700 as permissions bits.
EnsurePgDataPerms ensure PGDATA has 0700 permissions, which are required for PostgreSQL to successfully startup.
FileExists check if a file exists, and return an error otherwise.
FormatFriendlyTimestamp formats a timestamp in a filename-friendly way.
GetDirectoryContent return a slice of string with the name of the files in the dir directory.
GetFileSize returns the size of a file or an error.
MoveDirectoryContent moves a directory from a source path to its destination by copying the source files or subdirectories recursively to the destination.
MoveFile moves a file from a source path to its destination by copying the source file to the destination and then removing it from the original location.
NewDiskProbe creates and returns a new Directory instance for the specified path.
OpenFileAsync opens a file exiting in case the given context.Context is closed while waiting for the OpenFile to terminate, this can be useful with FIFO files, as Open will not return until the File is not opened with write permissions by another process or goroutine.
ReadFile reads source file and output the content as bytes.
ReadFileLines reads source file and output the content as a slice of strings.
RemoveDirectory remove the directory and all its content.
RemoveDirectoryContent removes all the files and directories inside the provided path.
RemoveFile removes a specified file.
RemoveFiles deletes the files and directories specified by the filePaths patterns relative to the basePath.
RemoveRestoreExcludedFiles removes files and directories that are excluded during a restore operation.
WriteFileAtomic atomically replace the content of a file.
WriteLinesToFile replace the contents of a certain file with a slice of lines.
WriteStringToFile replace the contents of a certain file with a string.