leveldbstore

package
v2.0.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: BSD-3-Clause Imports: 15 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 {
	// contains filtered or unexported fields
}

func (*Batch) Commit

func (i *Batch) Commit() error

Commit implements storage.Batch interface Commit method.

func (*Batch) Delete

func (i *Batch) Delete(item storage.Item) error

Delete implements storage.Batch interface Delete method.

func (*Batch) Put

func (i *Batch) Put(item storage.Item) error

Put implements storage.Batch interface Put method.

type Store

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

func New

func New(path string, opts *opt.Options) (*Store, error)

New returns a new store the backed by leveldb. If path == "", the leveldb will run with in memory backend storage.

func (*Store) Batch

func (s *Store) Batch(ctx context.Context) (storage.Batch, error)

Batch implements storage.BatchedStore interface Batch method.

func (*Store) Close

func (s *Store) Close() (err error)

Close implements the storage.Store interface.

func (*Store) Count

func (s *Store) Count(key storage.Key) (int, error)

Count implements the storage.Store interface.

func (*Store) DB

func (s *Store) DB() *leveldb.DB

DB implements the Storer interface.

func (*Store) Delete

func (s *Store) Delete(item storage.Item) error

Delete implements the storage.Store interface.

func (*Store) Get

func (s *Store) Get(item storage.Item) error

Get implements the storage.Store interface.

func (*Store) GetSize

func (s *Store) GetSize(k storage.Key) (int, error)

GetSize implements the storage.Store interface.

func (*Store) Has

func (s *Store) Has(k storage.Key) (bool, error)

Has implements the storage.Store interface.

func (*Store) Iterate

func (s *Store) Iterate(q storage.Query, fn storage.IterateFn) error

Iterate implements the storage.Store interface.

func (*Store) Put

func (s *Store) Put(item storage.Item) error

Put implements the storage.Store interface.

type Storer

type Storer interface {
	DB() *leveldb.DB
}

Storer returns the underlying db store.

type TxStore

type TxStore struct {
	*storage.TxStoreBase
	// contains filtered or unexported fields
}

TxStore is an implementation of in-memory Store where all Store operations are done in a transaction.

func NewTxStore

func NewTxStore(store storage.BatchedStore) *TxStore

NewTxStore returns a new TxStore instance backed by the given store.

func (*TxStore) Batch

func (s *TxStore) Batch(ctx context.Context) (storage.Batch, error)

Batch implements the Batcher interface.

func (*TxStore) Commit

func (s *TxStore) Commit() error

Commit implements the Tx interface.

func (*TxStore) Delete

func (s *TxStore) Delete(item storage.Item) error

Delete implements the Store interface.

func (*TxStore) NewTx

func (s *TxStore) NewTx(state *storage.TxState) storage.TxStore

NewTx implements the TxStore interface.

func (*TxStore) Put

func (s *TxStore) Put(item storage.Item) error

Put implements the Store interface.

func (*TxStore) Recover

func (s *TxStore) Recover() error

Recover attempts to recover from a previous crash by reverting all uncommitted transactions.

func (*TxStore) Rollback

func (s *TxStore) Rollback() error

Rollback implements the Tx interface.

Jump to

Keyboard shortcuts

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