utils

package
v2.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReadableSizeFormat = errors.New("readable size format invalid")

ErrReadableSizeFormat will return when size format not the same with expected.

Functions

func AlignLinux

func AlignLinux(input ...[]string) [][]string

AlignLinux will align print by lines (element in slice)

func AlignPrintWithColon

func AlignPrintWithColon(s ...string) string

AlignPrintWithColon will align print with ":"

func CalculatePartSize

func CalculatePartSize(size int64) (partSize int64, err error)

CalculatePartSize will calculate the object's part size.

func ChooseDestinationStorage

func ChooseDestinationStorage(x interface {
	types.PathSetter
	types.StorageSetter
}, y interface {
	types.DestinationPathGetter
	types.DestinationStorageGetter
})

ChooseDestinationStorage will choose the destination storage to fill.

func ChooseSourceStorage

func ChooseSourceStorage(x interface {
	types.PathSetter
	types.StorageSetter
}, y interface {
	types.SourcePathGetter
	types.SourceStorageGetter
})

ChooseSourceStorage will choose the source storage to fill.

func NewQingStorService

func NewQingStorService() (*qingstor.Service, error)

NewQingStorService will create a new qingstor service.

func NewRand

func NewRand() io.Reader

NewRand creates a new random reader with a time source.

func NewRandFrom

func NewRandFrom(src rand.Source) io.Reader

NewRandFrom creates a new reader from your own rand.Source

func ParseAtServiceInput

func ParseAtServiceInput(t interface {
	types.ServiceSetter
}) (err error)

ParseAtServiceInput will parse single args and setup service.

func ParseAtStorageInput

func ParseAtStorageInput(t interface {
	types.PathSetter
	types.StorageSetter
	types.TypeSetter
}, input string) (err error)

ParseAtStorageInput will parse single args and setup path, type, storager.

func ParseBetweenStorageInput

ParseBetweenStorageInput will parse two args into flow, path and key.

func ParseByteSize

func ParseByteSize(s string) (int64, error)

ParseByteSize will tried to parse string to byte size.

func ParseFlow

func ParseFlow(src, dst string) (flow constants.FlowType)

ParseFlow will parse the data flow

func ParseLocalPath

func ParseLocalPath(p string) (pathType typ.ObjectType, err error)

ParseLocalPath will parse a path into different path type.

func ParseQsPath

func ParseQsPath(p string) (keyType typ.ObjectType, bucketName, objectKey string, err error)

ParseQsPath will parse a key into different key type.

func ParseServiceInput

func ParseServiceInput(serviceType typ.ServicerType) (service storage.Servicer, err error)

ParseServiceInput will parse service input.

func ParseStorageInput

func ParseStorageInput(input string, storageType typ.StoragerType) (path string, objectType typ.ObjectType, store storage.Storager, err error)

ParseStorageInput will parse storage input and return a initiated storager.

func UnixReadableSize

func UnixReadableSize(hrSize string) (string, error)

UnixReadableSize will transfer readable size string into Unix size. 1 KB --> 1B, 1.2 GB --> 1.2G, 103 B --> 103B

Types

type CallbackTask

type CallbackTask struct {
	types.ID
	types.Fault
	types.Pool
	// contains filtered or unexported fields
}

CallbackTask is the callback task.

func NewCallbackTask

func NewCallbackTask(fn func()) *CallbackTask

NewCallbackTask will create a new callback test.

func (*CallbackTask) Run

func (t *CallbackTask) Run()

Run implement navvy.Task interface.

type EmptyTask

type EmptyTask struct {
	types.ID
	types.Fault
	types.Pool
}

EmptyTask is used for test.

func (*EmptyTask) Run

func (t *EmptyTask) Run()

Run implement navvy.Task interface.

Jump to

Keyboard shortcuts

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