Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBackupType(backupTarget string) (string, error)
- func DuplicateDevice(src, dest string) error
- func EmptyError() string
- func Filter(list []string, check func(string) bool) []string
- func FilteredLoggingHandler(filteredPaths map[string]struct{}, writer io.Writer, router http.Handler) http.Handler
- func FreezeFilesystem(freezePoint string, exec lhexec.ExecuteInterface) error
- func GetAddresses(volumeName, address string, dataServerProtocol types.DataServerProtocol) (string, string, string, int, error)
- func GetDevicePathFromVolumeName(volumeName string) string
- func GetFileActualSize(file string) int64
- func GetFreezePointFromDevicePath(devicePath string) string
- func GetFreezePointFromVolumeName(volumeName string) string
- func GetGRPCAddress(address string) string
- func GetHeadFileModifyTimeAndSize(file string) (int64, int64, error)
- func GetPortFromAddress(address string) (int, error)
- func IsDNS1123Subdomain(value string) []string
- func IsQualifiedName(value string) []string
- func MaxLenError(length int) string
- func Now() string
- func ParseAddresses(name string) (string, string, string, int, error)
- func ParseLabels(labels []string) (map[string]string, error)
- func RandomID() string
- func RegexError(msg string, fmt string, examples ...string) string
- func RemoveDevice(dev string) error
- func ResolveBackingFilepath(fileOrDirpath string) (string, error)
- func UUID() string
- func UnescapeURL(url string) string
- func UnfreezeAndUnmountFilesystem(freezePoint string, exec lhexec.ExecuteInterface, mounter mount.Interface) (bool, error)
- func UnfreezeFilesystem(freezePoint string, exec lhexec.ExecuteInterface) (bool, error)
- func UnfreezeFilesystemForDevice(devicePath string) error
- func ValidVolumeName(name string) bool
- func Volume2ISCSIName(name string) string
- type Once
- type SharedTimeouts
Constants ¶
const (
BlockSizeLinux = 512
)
const DNS1123SubdomainMaxLength int = 253
DNS1123SubdomainMaxLength is a subdomain's max length in DNS (RFC 1123)
const (
DevicePathPrefix = longhorndev.DevPath
)
Variables ¶
var (
MaximumVolumeNameSize = 64
)
Functions ¶
func CheckBackupType ¶
func DuplicateDevice ¶
func EmptyError ¶
func EmptyError() string
EmptyError returns a string explanation of a "must not be empty" validation failure.
func FilteredLoggingHandler ¶
func FreezeFilesystem ¶ added in v1.7.0
func FreezeFilesystem(freezePoint string, exec lhexec.ExecuteInterface) error
FreezeFilesystem attempts to freeze the filesystem mounted at freezePoint.
func GetAddresses ¶ added in v1.4.0
func GetDevicePathFromVolumeName ¶ added in v1.7.0
GetDevicePathFromVolumeName mirrors longhorndev.getDev. It returns the device path that go-iscsi-helper will use.
func GetFileActualSize ¶
func GetFreezePointFromDevicePath ¶ added in v1.7.0
GetFreezePointFromDevicePath returns the absolute path to the canonical location we will try to mount a filesystem to before freezeing it.
func GetFreezePointFromVolumeName ¶ added in v1.7.0
GetFreezePointFromVolumeName returns the absolute path to the canonical location we will try to mount a filesystem to before freezeing it.
func GetGRPCAddress ¶
func GetHeadFileModifyTimeAndSize ¶ added in v1.1.0
func GetPortFromAddress ¶
func IsDNS1123Subdomain ¶
IsDNS1123Subdomain tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123).
func IsQualifiedName ¶
IsQualifiedName tests whether the value passed is what Kubernetes calls a "qualified name". This is a format used in various places throughout the system. If the value is not valid, a list of error strings is returned. Otherwise an empty list (or nil) is returned.
func MaxLenError ¶
MaxLenError returns a string explanation of a "string too long" validation failure.
func RegexError ¶
RegexError returns a string explanation of a regex validation failure.
func RemoveDevice ¶
func ResolveBackingFilepath ¶
func UnescapeURL ¶
func UnfreezeAndUnmountFilesystem ¶ added in v1.7.0
func UnfreezeAndUnmountFilesystem(freezePoint string, exec lhexec.ExecuteInterface, mounter mount.Interface) (bool, error)
UnfreezeAndUnmountFilesystem attempts to unfreeze the filesystem mounted at freezePoint.
func UnfreezeFilesystem ¶ added in v1.7.0
func UnfreezeFilesystem(freezePoint string, exec lhexec.ExecuteInterface) (bool, error)
UnfreezeFilesystem attempts to unfreeze the filesystem mounted at freezePoint. It returns true if it successfully unfreezes a filesystem, false if there is no need to unfreeze a filesystem, and an error otherwise.
func UnfreezeFilesystemForDevice ¶ added in v1.7.0
UnfreezeFilesystemForDevice attempts to identify a mountPoint for the Longhorn volume and unfreeze it. Under normal conditions, it will not find a filesystem, and if it finds a filesystem, it will not be frozen. UnfreezeFilesystemForDevice does not return an error if there is nothing to do. UnfreezeFilesystemForDevice is only relevant for volumes run with a tgt-blockdev frontend, as only these volumes have a Longhorn device on the node to format and mount.
func ValidVolumeName ¶
func Volume2ISCSIName ¶
Types ¶
type Once ¶ added in v1.1.3
type Once struct {
// contains filtered or unexported fields
}
Once is modification of sync.Once to only set done once Do has run f() once successfully A Once must not be copied after first use.
type SharedTimeouts ¶ added in v1.7.1
type SharedTimeouts struct {
// contains filtered or unexported fields
}
SharedTimeouts has the following use case: - Multiple goroutines may need to time out eventually. - Only the goroutines themselves know if the conditions for a timeout have been met. - It is fine for some of the goroutines to time out quickly. - The last goroutine should time out more slowly. SharedTimeouts implements the types.SharedTimeouts instead of directly defining the concrete type to avoid an import loop.
func NewSharedTimeouts ¶ added in v1.7.1
func NewSharedTimeouts(shortTimeout, longTimeout time.Duration) *SharedTimeouts
func (*SharedTimeouts) CheckAndDecrement ¶ added in v1.7.1
func (t *SharedTimeouts) CheckAndDecrement(duration time.Duration) time.Duration
CheckAndDecrement checks if duration exceeds longTimeout or shortTimeout, returns the timeout exceeded (if applicable) and decrements numConsumers. - shortTimeout is only considered exceeded if there is still one other consumer to wait for longTimeout. - The caller MUST take whatever action is required for a timeout if a value > 0 is returned.
func (*SharedTimeouts) Decrement ¶ added in v1.7.1
func (t *SharedTimeouts) Decrement()
func (*SharedTimeouts) Increment ¶ added in v1.7.1
func (t *SharedTimeouts) Increment()