utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenPathTpl

func GenPathTpl() string

func GetDeliveryId

func GetDeliveryId() int64

func GetHandshakeUid

func GetHandshakeUid() uint64

func GetHealthTimeHolder added in v0.0.2

func GetHealthTimeHolder() *healthTimeHolder

func GetIpv4AddrByIface added in v1.0.0

func GetIpv4AddrByIface(_iface string) (string, error)

func GetIpv4AddrHost added in v0.0.2

func GetIpv4AddrHost() (string, error)

func GetMsgType

func GetMsgType(manifest string) (string, error)

func GetUniqueId

func GetUniqueId(jobId, jobInstanceId, taskId int64) string

func GetUniqueIdWithoutTaskId

func GetUniqueIdWithoutTaskId(jobId, jobInstanceId int64) string

func GetUserDiskSpacePercent added in v0.0.2

func GetUserDiskSpacePercent() (float64, error)

func GetWorkerId

func GetWorkerId() string

func HmacSHA1Encrypt

func HmacSHA1Encrypt(encryptText, encryptKey string) string

HmacSHA1Encrypt encrypt the encryptText use encryptKey

func Int64SliceToStringSlice added in v0.0.2

func Int64SliceToStringSlice(intSlice []int64) []string

func IsMapJobType added in v0.0.2

func IsMapJobType(executeMode string) bool

func IsRootTask added in v0.0.2

func IsRootTask(taskName string) bool

func IsSecondTypeJob added in v0.0.2

func IsSecondTypeJob(timeType common.TimeType) bool

func ParseIPAddr

func ParseIPAddr(addr string) (string, int, error)

func ParseId

func ParseId(uniqueId string, idType IdType) (int64, error)

func PrintCallStack added in v0.0.2

func PrintCallStack()

PrintCallStack print the latest 5-level call stack for troubleshooting

func RemoveSliceElem added in v0.0.2

func RemoveSliceElem(s []string, elem string) []string

func ShuffleStringSlice

func ShuffleStringSlice(nums []string) []string

func SyncMapLen

func SyncMapLen(m *sync.Map) int

Types

type ComparatorItem added in v0.0.2

type ComparatorItem interface {
	Priority() int64
	Value() interface{}
}

type ConcurrentSet

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

func NewConcurrentSet

func NewConcurrentSet() *ConcurrentSet

func (*ConcurrentSet) Add

func (s *ConcurrentSet) Add(item interface{})

func (*ConcurrentSet) Clear

func (s *ConcurrentSet) Clear()

func (*ConcurrentSet) Contains

func (s *ConcurrentSet) Contains(item interface{}) bool

func (*ConcurrentSet) Len

func (s *ConcurrentSet) Len() int

func (*ConcurrentSet) Remove

func (s *ConcurrentSet) Remove(item interface{})

func (*ConcurrentSet) ToStringSlice

func (s *ConcurrentSet) ToStringSlice() []string

type IdType

type IdType int32
const (
	IdTypeJobId         IdType = 0
	IdTypeJobInstanceId IdType = 1
	IdTypeTaskId        IdType = 2

	SplitterToken = "_"
)

type LimitedQueue added in v0.0.2

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

func NewLimitedQueue added in v0.0.2

func NewLimitedQueue(limit int) *LimitedQueue

func (*LimitedQueue) Convert2Slice added in v0.0.2

func (lq *LimitedQueue) Convert2Slice() []*common.ProgressHistory

func (*LimitedQueue) Dequeue added in v0.0.2

func (lq *LimitedQueue) Dequeue() *common.ProgressHistory

func (*LimitedQueue) Enqueue added in v0.0.2

func (lq *LimitedQueue) Enqueue(item *common.ProgressHistory)

type PriorityQueue added in v0.0.2

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

func NewPriorityQueue added in v0.0.2

func NewPriorityQueue(initialCapacity int) *PriorityQueue

func (*PriorityQueue) Clear added in v0.0.2

func (pq *PriorityQueue) Clear()

func (*PriorityQueue) Len added in v0.0.2

func (pq *PriorityQueue) Len() int

func (*PriorityQueue) Less added in v0.0.2

func (pq *PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Peek added in v0.0.2

func (pq *PriorityQueue) Peek() ComparatorItem

func (*PriorityQueue) Pop added in v0.0.2

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) PopItem added in v0.0.2

func (pq *PriorityQueue) PopItem() ComparatorItem

func (*PriorityQueue) Push added in v0.0.2

func (pq *PriorityQueue) Push(x interface{})

func (*PriorityQueue) PushItem added in v0.0.2

func (pq *PriorityQueue) PushItem(item ComparatorItem)

func (*PriorityQueue) Swap added in v0.0.2

func (pq *PriorityQueue) Swap(i, j int)

type Set

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

func NewSet

func NewSet() *Set

func (*Set) Add

func (s *Set) Add(item interface{})

func (*Set) Contains

func (s *Set) Contains(item interface{}) bool

func (*Set) Remove

func (s *Set) Remove(item interface{})

func (*Set) Size added in v0.0.2

func (s *Set) Size() int

func (*Set) ToInt64Slice

func (s *Set) ToInt64Slice() []int64

func (*Set) ToStringSlice added in v0.0.2

func (s *Set) ToStringSlice() []string

Jump to

Keyboard shortcuts

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