util

package
v0.6.20 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
const (
	KB = uint64(1024)
	MB = 1024 * KB
	GB = 1024 * MB
	TB = 1024 * GB

	KBF = float64(KB)
	MBF = float64(MB)
	GBF = float64(GB)
	TBF = float64(TB)
)

/////////////////////////////////////////////////////////////////

Storage sizes -- print and scan bytes, and sizes suffixed with KB,MB,GB,TB

////////////////////////////////////////////////////////////////

View Source
const BufferQCapacity = 50

BufferQCapacity number of pre-allocated buffers

View Source
const LargeBlockAPIVersion = "2018-03-28"

LargeBlockAPIVersion API version that supports large block blobs

View Source
const LargeBlockSizeMax = 100 * MB

LargeBlockSizeMax maximum block size

View Source
const MaxBlockCount = 50000 // no more than this many blob blocks permitted

MaxBlockCount the maximum number of blocks in a blob

View Source
const MiByte = 1048576

MiByte bytes in one MiB

Variables

View Source
var Verbose = false

Verbose mode active?

Functions

func BoolVarAlias

func BoolVarAlias(varPtr *bool, shortflag string, longflag string, defaultVal bool, description string)

BoolVarAlias bool commandline option

func ByteCountFromSizeString

func ByteCountFromSizeString(sizeStr string) (uint64, error)

ByteCountFromSizeString accepts byte count, or integer suffixed with B, KB, MB, GB. ... Return the corresponding count of bytes.

func IntVarAlias

func IntVarAlias(varPtr *int, shortflag string, longflag string, defaultVal int, description string)

IntVarAlias int commandline option

func PrintSize

func PrintSize(bytes uint64) string

PrintSize formats a string with a compact respresentation of a byte count

func PrintUsageDefaults

func PrintUsageDefaults(shortflag string, longflag string, defaultVal string, description string)

PrintUsageDefaults print commandline usage options

func PrintfIfDebug added in v0.5.12

func PrintfIfDebug(format string, values ...interface{})

PrintfIfDebug TODO

func RetriableOperation

func RetriableOperation(operation func(r int) error) (duration time.Duration, startTime time.Time, numOfRetries int)

RetriableOperation executes a function, retrying up to "retryLimit" times and waiting "retrySleepDuration" between attempts

func StringListVarAlias

func StringListVarAlias(varPtr *ListFlag, shortflag string, longflag string, defaultVal string, description string)

StringListVarAlias string commandline option

func StringVarAlias

func StringVarAlias(varPtr *string, shortflag string, longflag string, defaultVal string, description string)

StringVarAlias string commandline option

func Uint64VarAlias

func Uint64VarAlias(varPtr *uint64, shortflag string, longflag string, defaultVal uint64, description string)

Uint64VarAlias uint64 commandline option

Types

type ListFlag

type ListFlag []string

ListFlag represents a multivalue flag

func (*ListFlag) Set

func (lst *ListFlag) Set(value string) error

Set adds a new value to the values list

func (*ListFlag) String

func (lst *ListFlag) String() string

String joints all values of the flag

Jump to

Keyboard shortcuts

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