Documentation ¶
Index ¶
- type Shard
- type ShardMap
- func (a *ShardMap) Delete(key string)
- func (a *ShardMap) DjbHash(inp string) uint32
- func (a *ShardMap) DumpKeys()
- func (a *ShardMap) ForceGet(key string) *interface{}
- func (a *ShardMap) Get(key string) *interface{}
- func (a *ShardMap) LockGet(key string) *interface{}
- func (a *ShardMap) RAW() *[]*Shard
- func (a *ShardMap) Set(key string, data *interface{})
- func (a *ShardMap) SetIfNotExist(key string, data *interface{}) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ShardMap ¶
type ShardMap struct { Keys int // contains filtered or unexported fields }
func (*ShardMap) Delete ¶
Delete deletes an antry from the sharded map - if the entry doesnt exist, it does nothing.
func (*ShardMap) DjbHash ¶
DjbHash is for sharding the map. according to internets, this is fastest hashing algorithm ever made. we dont need security, we need distribution which this provides for us.
func (*ShardMap) DumpKeys ¶
func (a *ShardMap) DumpKeys()
DumpKeys dumps the keys and number of shard they are stored at, for debugging purposes.
func (*ShardMap) ForceGet ¶
ForceGet is for concurrent write-read. if you expect a entry to be written on another goroutine - this function is handy for waiting that entry to appear Do note - theres the loop of this as of now, and this will at minimum do 2 Get calls.
func (*ShardMap) LockGet ¶
LockGet is yet another concurrent helper function. Lockget is for using sync.rwmutex.lock instead of sync.rwmutex.rlock for reading.
func (*ShardMap) SetIfNotExist ¶
SetIfNotExist is also another concurrency helper function. SetIfNotExist will set value if it does not exist yet, otherwise it will do nothing the function will return true on success, and false if the key already exists.