Documentation ¶
Index ¶
- Constants
- func CheckBackupType(backupTarget string) (string, error)
- func CleanUpMountPoints(mounter mount.Interface, log logrus.FieldLogger) error
- func CompressData(method string, data []byte) (io.ReadSeeker, error)
- func DecompressAndVerify(method string, src io.Reader, checksum string) (io.Reader, error)
- func DecompressAndVerifyWithFallback(decompression string, rc io.ReadCloser, checksum string) (io.Reader, error)
- func EnsureMountPoint(Kind, mountPoint string, mounter mount.Interface, log logrus.FieldLogger) (mounted bool, err error)
- func Execute(binary string, args []string) (string, error)
- func ExecuteWithCustomTimeout(binary string, args []string, timeout time.Duration) (string, error)
- func ExtractNames(names []string, prefix, suffix string) []string
- func Filter(elements []string, predicate func(string) bool) []string
- func GenerateName(prefix string) string
- func GetBackupCredential(backupURL string) (map[string]string, error)
- func GetChecksum(data []byte) string
- func GetFileChecksum(filePath string) (string, error)
- func IsMounted(mountPoint string) bool
- func MountWithTimeout(mounter mount.Interface, source string, target string, fstype string, ...) error
- func NewUUID() string
- func Now() string
- func SetupCredential(backupType string, credential map[string]string) error
- func SplitMountOptions(options []string) []string
- func UnescapeURL(url string) string
- func UnorderedEqual(x, y []string) bool
- func ValidateName(name string) bool
- type NopCloser
Constants ¶
const ( PreservedChecksumLength = 64 MountDir = "/var/lib/longhorn-backupstore-mounts" )
Variables ¶
This section is empty.
Functions ¶
func CheckBackupType ¶
func CleanUpMountPoints ¶
func CleanUpMountPoints(mounter mount.Interface, log logrus.FieldLogger) error
CleanUpMountPoints tries to clean up all existing mount points for existing backup stores
func CompressData ¶
func CompressData(method string, data []byte) (io.ReadSeeker, error)
CompressData compresses the given data using the specified compression method
func DecompressAndVerify ¶
DecompressAndVerify decompresses the given data and verifies the data integrity
func DecompressAndVerifyWithFallback ¶
func DecompressAndVerifyWithFallback(decompression string, rc io.ReadCloser, checksum string) (io.Reader, error)
DecompressAndVerifyWithFallback decompresses the given data and verifies the data integrity. If the decompression fails, it will try to decompress with the fallback method.
func EnsureMountPoint ¶
func EnsureMountPoint(Kind, mountPoint string, mounter mount.Interface, log logrus.FieldLogger) (mounted bool, err error)
EnsureMountPoint checks if the mount point is valid. If it is invalid, clean up mount point.
func ExecuteWithCustomTimeout ¶
ExecuteWithCustomTimeout executes a command with a specified timeout
func ExtractNames ¶
func GetChecksum ¶
GetChecksum gets the SHA256 of the given data
func GetFileChecksum ¶
GetFileChecksum calculates the SHA256 of the file's content
func MountWithTimeout ¶
func MountWithTimeout(mounter mount.Interface, source string, target string, fstype string, options []string, sensitiveOptions []string, interval, timeout time.Duration) error
MountWithTimeout mounts the backup store to a given mount point with a specified timeout
func SplitMountOptions ¶
func UnescapeURL ¶
UnescapeURL converts a escape character to a normal one.