util

package
v0.0.0-...-3425d69 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EngineRandomIDLenth = 8
	EngineSuffix        = "-e"
)

Variables

This section is empty.

Functions

func BytesToMiB

func BytesToMiB(bytes uint64) uint64

func CombineErrors

func CombineErrors(errorList ...error) (retErr error)

func GetDevNameFromBDF

func GetDevNameFromBDF(bdf string) (string, error)

func GetFileChunkChecksum

func GetFileChunkChecksum(filePath string, start, size int64) (string, error)

func GetVolumeNameFromEngineName

func GetVolumeNameFromEngineName(engineName string) string

func IsSPDKTargetProcessRunning

func IsSPDKTargetProcessRunning() (bool, error)

func Min

func Min(x, y uint64) uint64

func Now

func Now() string

func ParseLabels

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

func RemovePrefix

func RemovePrefix(path, prefix string) string

func RoundUp

func RoundUp(num, base uint64) uint64

func StartSPDKTgtDaemon

func StartSPDKTgtDaemon() error

func StopSPDKTgtDaemon

func StopSPDKTgtDaemon(timeout time.Duration) error

func UUID

func UUID() string

func UnescapeURL

func UnescapeURL(url string) string

Types

type Bitmap

type Bitmap struct {
	// contains filtered or unexported fields
}

func NewBitmap

func NewBitmap(start, end int32) *Bitmap

NewBitmap allocate a bitmap range from [start, end], notice the end is included

func (*Bitmap) AllocateRange

func (b *Bitmap) AllocateRange(count int32) (int32, int32, error)

func (*Bitmap) ReleaseRange

func (b *Bitmap) ReleaseRange(start, end int32) error

type BlockDevice

type BlockDevice struct {
	Name       string   `json:"name"`
	Path       string   `json:"path"`
	Subsystems []string `json:"subsystems"`
	Maj        int      `json:"maj"`
	Min        int      `json:"min"`
}

func GetBlockDevice

func GetBlockDevice(devPath string) (BlockDevice, error)

type BlockDevices

type BlockDevices struct {
	BlockDevices []struct {
		Name       string `json:"name"`
		Path       string `json:"path"`
		MajMin     string `json:"maj:min"`
		Subsystems string `json:"subsystems"`
	} `json:"blockdevices"`
}

type ReplicaError

type ReplicaError struct {
	Address string
	Message string
}

func NewReplicaError

func NewReplicaError(address string, err error) ReplicaError

func (ReplicaError) Error

func (e ReplicaError) Error() string

type TaskError

type TaskError struct {
	ReplicaErrors []ReplicaError
}

func NewTaskError

func NewTaskError(res ...ReplicaError) *TaskError

func (*TaskError) Append

func (t *TaskError) Append(re ReplicaError)

func (*TaskError) Error

func (t *TaskError) Error() string

func (*TaskError) HasError

func (t *TaskError) HasError() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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