util

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 20 Imported by: 4

Documentation

Index

Constants

View Source
const (
	BlockSizeLinux = 512
)
View Source
const DNS1123SubdomainMaxLength int = 253

DNS1123SubdomainMaxLength is a subdomain's max length in DNS (RFC 1123)

Variables

View Source
var (
	MaximumVolumeNameSize = 64

	HostProc = "/host/proc"
)

Functions

func CheckBackupType

func CheckBackupType(backupTarget string) (string, error)

func Contains

func Contains(arr []string, val string) bool

func DuplicateDevice

func DuplicateDevice(src, dest string) error

func EmptyError

func EmptyError() string

EmptyError returns a string explanation of a "must not be empty" validation failure.

func Filter

func Filter(list []string, check func(string) bool) []string

func FilteredLoggingHandler

func FilteredLoggingHandler(filteredPaths map[string]struct{}, writer io.Writer, router http.Handler) http.Handler

func GetBackupCredential

func GetBackupCredential(backupURL string) (map[string]string, error)

func GetFileActualSize

func GetFileActualSize(file string) int64

func GetFunctionName

func GetFunctionName(i interface{}) string

func GetGRPCAddress

func GetGRPCAddress(address string) string

func GetHeadFileModifyTimeAndSize added in v1.1.0

func GetHeadFileModifyTimeAndSize(file string) (int64, int64, error)

func GetInitiatorNS

func GetInitiatorNS() string

func GetPortFromAddress

func GetPortFromAddress(address string) (int, error)

func IsDNS1123Subdomain

func IsDNS1123Subdomain(value string) []string

IsDNS1123Subdomain tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123).

func IsQualifiedName

func IsQualifiedName(value string) []string

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

func MaxLenError(length int) string

MaxLenError returns a string explanation of a "string too long" validation failure.

func Now

func Now() string

func ParseAddresses

func ParseAddresses(name string) (string, string, string, int, error)

func ParseLabels

func ParseLabels(labels []string) (map[string]string, error)

func RegexError

func RegexError(msg string, fmt string, examples ...string) string

RegexError returns a string explanation of a regex validation failure.

func RemoveDevice

func RemoveDevice(dev string) error

func ResolveBackingFilepath

func ResolveBackingFilepath(fileOrDirpath string) (string, error)

func UUID

func UUID() string

func UnescapeURL

func UnescapeURL(url string) string

func ValidVolumeName

func ValidVolumeName(name string) bool

func Volume2ISCSIName

func Volume2ISCSIName(name string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL