util

package
v0.0.0-...-d1b2497 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MD5

func MD5(s string) string

func ParseGRPCEndpoint

func ParseGRPCEndpoint(ep string) (string, string, error)

func RoundUpGB

func RoundUpGB(volumeSizeBytes int64) int64

func SizeGBToBytes

func SizeGBToBytes(volumeSizeGB int64) int64

func ToJSONOrPanic

func ToJSONOrPanic(v interface{}) string

Types

type KeyMutex

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

func NewKeyMutex

func NewKeyMutex() *KeyMutex

NewKeyMutex create a new KeyMutex.

func (*KeyMutex) TryLock

func (m *KeyMutex) TryLock(key LockedKey) bool

TryLock try to lock at key, return whether locking is succeed.

func (*KeyMutex) Unlock

func (m *KeyMutex) Unlock(key LockedKey)

Unlock unlock at key.

type LockedKey

type LockedKey interface {
	String() string
}

type StringKey

type StringKey string

func (StringKey) String

func (k StringKey) String() string

type TraceKeyType

type TraceKeyType string
const (
	TraceIDKey TraceKeyType = "traceID"

	GB = 1024 * 1024 * 1024
)

Jump to

Keyboard shortcuts

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