goleveldb

package
v0.0.0-...-40e4417 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Batch batch operation

func (*Batch) Close

func (b *Batch) Close() error

Close close the batch

func (*Batch) Commit

func (b *Batch) Commit() error

Commit commit the changes

func (*Batch) Del

func (b *Batch) Del(key []byte) error

Del delete a key

func (*Batch) Put

func (b *Batch) Put(key, val []byte) error

Put update a key

type Iterator

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

Iterator common iterator

func (*Iterator) Close

func (i *Iterator) Close() error

Close close the iter

func (*Iterator) Err

func (i *Iterator) Err() error

Err return error if any during cursor moves

func (*Iterator) First

func (i *Iterator) First()

First move to the first entry

func (*Iterator) Key

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

Key current key of the cursor

func (*Iterator) Last

func (i *Iterator) Last()

Last move to the last entry

func (*Iterator) Next

func (i *Iterator) Next() bool

Next move to the next key

func (*Iterator) Prev

func (i *Iterator) Prev() bool

Prev move to the previous key

func (*Iterator) Seek

func (i *Iterator) Seek(seek []byte)

Seek move to the key equal or greater than seek. If no key exists, return false

func (*Iterator) Valid

func (i *Iterator) Valid() bool

Valid if the current entry is valid

func (*Iterator) Value

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

Value current value of the cursor

type Option

type Option func(s *Storage)

Option db option

type Storage

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

Storage storage implementation

func Open

func Open(path string, opts ...Option) (*Storage, error)

Open return a goleveldb storage

func (*Storage) Batch

func (s *Storage) Batch() (storage.Batch, error)

Batch open a batch

func (*Storage) Close

func (s *Storage) Close() error

Close close the storage

func (*Storage) Del

func (s *Storage) Del(key []byte) error

Del delete the key

func (*Storage) GC

func (s *Storage) GC() error

GC garbage collection

func (*Storage) Get

func (s *Storage) Get(key []byte) ([]byte, error)

Get return value for specified key, return nil if key not found

func (*Storage) MGet

func (s *Storage) MGet(keys ...[]byte) ([][]byte, error)

MGet return values fro multiple keys

func (*Storage) PrefixIterator

func (s *Storage) PrefixIterator(prefix []byte) (storage.Iterator, error)

PrefixIterator return a iterator with prefix

func (*Storage) Put

func (s *Storage) Put(key, val []byte) error

Put udpate the key with val

func (*Storage) RangeIterator

func (s *Storage) RangeIterator(start, end []byte) (storage.Iterator, error)

RangeIterator return a iterator within the range

Jump to

Keyboard shortcuts

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