Documentation ¶
Index ¶
- Constants
- Variables
- func ConsumeFirstIfLowerOrEqual(nc *genericstruct.NodeCache, off int64, key []byte) (int64, bool, error)
- func Delete(nc *genericstruct.NodeCache, off int64, key []byte) (bool, error)
- func InsertionAlgorithmV1(nc *genericstruct.NodeCache, off int64, key []byte, value int64) error
- func Lookup(nc *genericstruct.NodeCache, off int64, key []byte) (int64, bool, error)
- func NodeConstructor() genericstruct.Block
- type KeySearcher
- func (k *KeySearcher) Found(key []byte) (it int64, ok bool, err error)
- func (k *KeySearcher) FoundNode(key []byte) (it *Node, ok bool, err error)
- func (k *KeySearcher) Insert(key []byte, value int64, level int) (int64, error)
- func (k *KeySearcher) Steps(off int64, key []byte) error
- func (k *KeySearcher) StepsFind(off int64, key []byte) (int64, *Node, error)
- type Node
- type NodeHead
Constants ¶
View Source
const Steps = 20
Variables ¶
View Source
var EExists = errors.New("EExists")
View Source
var NodeMaster = &genericstruct.NodeMaster{Factory: NodeConstructor}
Functions ¶
func ConsumeFirstIfLowerOrEqual ¶
func ConsumeFirstIfLowerOrEqual(nc *genericstruct.NodeCache, off int64, key []byte) (int64, bool, error)
Removes the first Element of the skiplist, if it is lower or equal to KEY.
On success, it returns the Value, that is assigned to the first element. On failure (first element is greater than KEY, or list is empty), it does not modify anything.
func InsertionAlgorithmV1 ¶
func NodeConstructor ¶
func NodeConstructor() genericstruct.Block
Types ¶
type KeySearcher ¶
This object must be used with care - otherwise the Skiplist becomes out of order.
func (*KeySearcher) FoundNode ¶
func (k *KeySearcher) FoundNode(key []byte) (it *Node, ok bool, err error)
func (*KeySearcher) Insert ¶
Inserts a key-value pair.
IMPORTANT: Must not be called, unless k.Steps() was called before with the same key, and k.Found() was checked with the same key, that this one doesn't exist
k.Steps(listHead,KEY) // Perform the search _,ok,_ := k.Found(KEY) // Check, if we found the key. // Insert the pair IF, AND ONLY IF, we didn't have the pair already. if !ok { k.Insert(KEY,VALUE,level) }
type Node ¶
func LookupNode ¶
func (*Node) Load ¶
func (n *Node) Load(buf *bytebufferpool.ByteBuffer)
func (*Node) Store ¶
func (n *Node) Store(buf *bytebufferpool.ByteBuffer)
Click to show internal directories.
Click to hide internal directories.