Documentation ¶
Index ¶
- type AVL
- type AVLNode
- type BST
- type BSTNode
- type BTree
- type ClusterConfig
- type ConcurrentAppendMap
- type ConcurrentMap
- type LockingMap
- type MapSingleMutex
- type Node
- type NodeType
- type OrderTable
- type Porcupine
- type RadixNode
- type RadixTree
- type RedBlack
- type RedBlackNode
- type Store
- type StoreCluster
- type Table
- type Trie
- type TrieNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AVL ¶
type AVL[key constraints.Ordered, value any] struct { sync.RWMutex // contains filtered or unexported fields }
type AVLNode ¶
type AVLNode[key constraints.Ordered, value any] struct { // contains filtered or unexported fields }
type BST ¶
type BST[Key constraints.Ordered, Value any] struct { sync.RWMutex // contains filtered or unexported fields }
type BSTNode ¶
type BSTNode[Key constraints.Ordered, Value any] struct { // contains filtered or unexported fields }
type ClusterConfig ¶
type ClusterConfig struct {
// contains filtered or unexported fields
}
type ConcurrentAppendMap ¶
see: https://github.com/golang/go/issues/21035 see: https://github.com/golang/go/issues/28938 see: https://github.com/golang/go/issues/47643
func NewConcurrentAppendMap ¶
func NewConcurrentAppendMap() *ConcurrentAppendMap
func (*ConcurrentAppendMap) Del ¶
func (c *ConcurrentAppendMap) Del(key string) bool
func (*ConcurrentAppendMap) Get ¶
func (c *ConcurrentAppendMap) Get(key string) int
func (*ConcurrentAppendMap) In ¶
func (c *ConcurrentAppendMap) In(key string) bool
type ConcurrentMap ¶
ConcurrentMap uses multiple local mutexes partitioned by the hash of the key to allow concurrent writes.
func NewMap ¶
func NewMap(numLocks int) *ConcurrentMap
the relationship between the number of locks and the size of the underlying `bucket index modulo lock array size`
func (*ConcurrentMap) GetValue ¶
func (m *ConcurrentMap) GetValue(key int) int
This seems to make reads slightly more expensive as you're acquiring/releasing multiple locks one for the global RWMutex and a second access to the partioned lock
func (*ConcurrentMap) Increment ¶
func (m *ConcurrentMap) Increment(key int)
Writes are much quicker as they can be parallelised as long as the hashing function behaves properly and segments the keys
type LockingMap ¶
func NewLockingMap ¶
func NewLockingMap() *LockingMap[string, int]
type MapSingleMutex ¶
MapSingleMutex uses a single global mutex to protect all operations on the map.
func NewMapSingleMutex ¶
func NewMapSingleMutex() *MapSingleMutex
func (*MapSingleMutex) GetValue ¶
func (m *MapSingleMutex) GetValue(key int) int
func (*MapSingleMutex) Increment ¶
func (m *MapSingleMutex) Increment(key int)
type OrderTable ¶
type Porcupine ¶
type Porcupine struct { Store Store[string, any] Name string // contains filtered or unexported fields }
Porcupine is a global in-memory read/write store.
func NewPorcupine ¶
New `Porcupine` instance. This should not be copied after instantiation. todo: hold a *Porcupine on init
func SpawnPorcupines ¶
type RadixTree ¶
type RadixTree struct {
// contains filtered or unexported fields
}
func NewRadixTree ¶
func NewRadixTree() *RadixTree
func (*RadixTree) StartsWith ¶
type RedBlack ¶
type RedBlack[key constraints.Ordered, value any] struct { sync.RWMutex // contains filtered or unexported fields }
func NewRedBlack ¶
type RedBlackNode ¶
type RedBlackNode[key constraints.Ordered, value any] struct { // contains filtered or unexported fields }
type Store ¶
type Store[Key any, Value any] interface { Get(Key) (Value, error) Put(Key, Value) error Del(Key) error In(Key) bool }
Store is an interface for a key-value store.
type StoreCluster ¶
type StoreCluster[Key comparable, Value any] interface { Store[Key, Value] Strategy() string Mode() string }
mode: 1. available 2. consistent