lockstore

package
v0.0.0-...-4333e8d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hint

type Hint struct {
	// contains filtered or unexported fields
}

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator iterates the entries in the MemStore.

func (*Iterator) Key

func (it *Iterator) Key() []byte

Key returns the key at the current position.

func (*Iterator) Next

func (it *Iterator) Next()

Next moves the iterator to the next entry.

func (*Iterator) Prev

func (it *Iterator) Prev()

Prev moves the iterator to the previous entry.

func (*Iterator) Seek

func (it *Iterator) Seek(seekKey []byte)

Seek locates the iterator to the first entry with a key >= seekKey.

func (*Iterator) SeekForExclusivePrev

func (it *Iterator) SeekForExclusivePrev(target []byte)

SeekForExclusivePrev locates the iterator to the last entry with key < target.

func (*Iterator) SeekForPrev

func (it *Iterator) SeekForPrev(target []byte)

SeekForPrev locates the iterator to the last entry with key <= target.

func (*Iterator) SeekToFirst

func (it *Iterator) SeekToFirst()

SeekToFirst locates the iterator to the first entry.

func (*Iterator) SeekToLast

func (it *Iterator) SeekToLast()

SeekToLast locates the iterator to the last entry.

func (*Iterator) Valid

func (it *Iterator) Valid() bool

Valid returns true iff the iterator is positioned at a valid node.

func (*Iterator) Value

func (it *Iterator) Value() []byte

Value returns value.

type MemStore

type MemStore struct {
	// contains filtered or unexported fields
}

MemStore is a skiplist variant used to store lock. Compares to normal skip list, it only supports single thread write. But it can reuse the memory, so that the memory usage doesn't keep growing.

func NewMemStore

func NewMemStore(arenaBlockSize int) *MemStore

func (*MemStore) Delete

func (ls *MemStore) Delete(key []byte) bool

func (*MemStore) DeleteWithHint

func (ls *MemStore) DeleteWithHint(key []byte, hint *Hint) bool

func (*MemStore) DumpToFile

func (ls *MemStore) DumpToFile(fileName string, meta []byte) error

func (*MemStore) Get

func (ls *MemStore) Get(key, buf []byte) []byte

func (*MemStore) Len

func (ls *MemStore) Len() int

func (*MemStore) LoadFromFile

func (ls *MemStore) LoadFromFile(fileName string) (meta []byte, err error)

func (*MemStore) NewIterator

func (ls *MemStore) NewIterator() *Iterator

NewIterator returns a new Iterator for the lock store.

func (*MemStore) Put

func (ls *MemStore) Put(key []byte, v []byte) bool

func (*MemStore) PutWithHint

func (ls *MemStore) PutWithHint(key []byte, v []byte, hint *Hint) bool

Put puts the key-value pair, returns true if the key doesn't exist.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL