ttypes

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

View Source
const Md5 = "md5"
View Source
const Sha1 = "sha1"

Variables

View Source
var CrcMask = uint32(0xffffffff) >> 6
View Source
var ErrorFullChan = errors.New("full chan error")
View Source
var ErrorInvalidParameter = errors.New("invalid parameter")
View Source
var ErrorSliceNotEqualLength = errors.New("two slices not equal length")
View Source
var ErrorTimeout = errors.New("time out error")

Functions

func SetCRCMask

func SetCRCMask(n int)

Types

type ErrHandler

type ErrHandler func(err any)

type FetchHandler

type FetchHandler[T any] func(context.Context, chan T)

type Float

type Float interface {
	~float32 | ~float64
}

type IComparator

type IComparator interface {
	Len() int
	Less(i, j int) bool
	Swap(i, j int)
}

type IFanOut

type IFanOut[T any] interface {
	Produce() chan T
	Compute(chan T) chan T
	Merge(...chan T) chan T
}

type ILimit

type ILimit interface {
	Put()
	Get()
}

type IPriorityChan

type IPriorityChan[T any] interface {
	Put(event T, t PriorityType)
	TryPut(event T, t PriorityType) error
	PutWithTimeout(event T, t PriorityType, timeout time.Duration) error
	Get() T
	TryGet() T
	GetWithTimeout(timeout time.Duration) (T, error)
	HandleSignal(highHandler PriorityHandler[T], lowHandler PriorityHandler[T]) error
}

type Integer

type Integer interface {
	Signed | Unsigned
}

type Ordered

type Ordered interface {
	Integer | Float | ~string
}

type PriorityHandler

type PriorityHandler[T any] func(event T) error

type PriorityType

type PriorityType int
const HighPriorityType PriorityType = 0
const LowPriorityType PriorityType = 1

type Signed

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Tuple

type Tuple[K Ordered, V any] struct {
	Key   K
	Value V
}

Tuple 有序元组,用于map的平铺,方便排序

type Unsigned

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type WaitGroupHandler

type WaitGroupHandler func() error

Jump to

Keyboard shortcuts

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