Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 (*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 ¶
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 OrderTable[Key constraints.Ordered, Value any] interface { Get(Key) (Value, error) Range(Key, Key) ([]Value, error) Put(Key, Value) error Del(Key) error In(Key) bool }
OrderTable is an interface for an unordered key-value data structure
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 RedBlackTree ¶
type RedBlackTree 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