util

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 19 Imported by: 3

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
)

Functions

func CheckBackupType

func CheckBackupType(backupTarget string) (string, error)

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 GetAddresses added in v1.4.0

func GetAddresses(volumeName, address string, dataServerProtocol types.DataServerProtocol) (string, string, string, int, error)

func GetFileActualSize

func GetFileActualSize(file string) int64

func GetGRPCAddress

func GetGRPCAddress(address string) string

func GetHeadFileModifyTimeAndSize added in v1.1.0

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

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 RandomID added in v1.4.0

func RandomID() string

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

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.

func (*Once) Do added in v1.1.3

func (o *Once) Do(f func() error) error

Do execute f() only if it has never been run successfully before if f() encounters an error it will be returned to the caller

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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