Documentation
¶
Index ¶
- Constants
- Variables
- func KeyHash(key interface{}) uint32
- type Bitmap
- type CanHash
- type Container
- type Float
- type Int
- type Integer
- type Key
- type Map
- type Number
- type Set
- type Shard
- type ShardMap
- type Slice
- type State
- func (s *State) Add(indexList ...uint8) error
- func (s *State) Has(index uint8) bool
- func (s *State) Intersection(val State) []uint8
- func (s *State) Merge(val State)
- func (s *State) Remove(index uint8)
- func (s *State) RemoveAll()
- func (s *State) Slice() []uint8
- func (s *State) UnionSet(val State) []uint8
- func (s *State) ValueSlice() []int32
- type Uint
Constants ¶
View Source
const (
StateIndexMax = 30
)
Variables ¶
View Source
var Empty = struct{}{}
View Source
var (
ErrIndex = errors.New("index out of range")
)
View Source
var Uint32Hash = crc32.ChecksumIEEE
Functions ¶
Types ¶
type Bitmap ¶
type Bitmap interface {
// HasBit 是否有值
HasBit() bool
// BitCount 值的数量
BitCount() int
// Exists 标签是否存在
Exists(tag int) (exists bool)
// AddTag 添加标签
AddTag(tag int) Bitmap
// DelTag 删除标签
DelTag(tag int) Bitmap
// Data 原始数据
Data() (data []byte)
// SprinfBinary 二进制打印
SprinfBinary() string
}
Bitmap bitmap数据结构
type CanHash ¶
type CanHash interface {
// HashCode 计算hash值
HashCode() (hashValue uint32)
}
CanHash hash接口
type Container ¶
type Container[K comparable] interface { Set(key K, value any) Get(key K) (value any, exists bool) }
func NewContainer ¶
func NewContainer[K comparable]() Container[K]
type Map ¶
type Map[K comparable, V any] map[K]V
type Set ¶
type Set[V comparable] interface { Add(value V) (isNew bool) Del(list ...V) (delNum int) Exists(value V) (exists bool) Length() (length int) List() (list Slice[V]) Pop() (value V) Rand() (value V) }
func NewConcurrentSet ¶
func NewConcurrentSet[V comparable](initSize uint) Set[V]
func NewSet ¶
func NewSet[V comparable](initSize uint) Set[V]
type Shard ¶
type ShardMap ¶
type ShardMap[K Key] interface { // Set 存储 Set(key K, value any) (isCreate bool) // Get 获取 Get(key K) (value any, exists bool) // Exists 是否存在 Exists(key K) (exists bool) // Delete 删除 Delete(keys ...K) (delNum int) // Length 长度 Length() int64 // ShardLength 返回每个分片的长度,可以协助分析元素是否平均分配 ShardLength() []int64 }
ShardMap 分片Map
type State ¶
type State int32
func StateFromSlice ¶
func StatusFromValueSlice ¶
func (*State) Intersection ¶
func (*State) ValueSlice ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.