leveldbstorage

package
v0.0.0-...-b559f02 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchRemove

func BatchRemove(st *Storage, r *leveldbutil.Range, limit int) (int, error)

func NewPrefixKey

func NewPrefixKey(prefix KeyPrefix, a ...[]byte) []byte

func RemoveByPrefix

func RemoveByPrefix(st *Storage, prefix []byte) error

Types

type DefaultLeveldbBatch

type DefaultLeveldbBatch struct {
	*leveldb.Batch
}

func NewDefaultLeveldbBatch

func NewDefaultLeveldbBatch(b *leveldb.Batch) *DefaultLeveldbBatch

func (*DefaultLeveldbBatch) LBatch

func (b *DefaultLeveldbBatch) LBatch() *leveldb.Batch

type KeyPrefix

type KeyPrefix [2]byte

type LeveldbBatch

type LeveldbBatch interface {
	Put([]byte, []byte)
	Delete([]byte)
	Len() int
	Reset()
	LBatch() *leveldb.Batch
}

type PrefixStorage

type PrefixStorage struct {
	sync.RWMutex
	*Storage
	// contains filtered or unexported fields
}

func NewPrefixStorage

func NewPrefixStorage(st *Storage, prefix []byte) *PrefixStorage

func (*PrefixStorage) Batch

func (*PrefixStorage) BatchFunc

func (st *PrefixStorage) BatchFunc(
	ctx context.Context,
	batchsize uint64,
	wo *leveldbOpt.WriteOptions,
) (
	func(func(LeveldbBatch), func(func() error) error) error,
	func(func(func() error) error) error,
	func(),
)

func (*PrefixStorage) Close

func (st *PrefixStorage) Close() error

func (*PrefixStorage) Delete

func (st *PrefixStorage) Delete(key []byte, opt *leveldbOpt.WriteOptions) error

func (*PrefixStorage) Exists

func (st *PrefixStorage) Exists(key []byte) (bool, error)

func (*PrefixStorage) Get

func (st *PrefixStorage) Get(key []byte) ([]byte, bool, error)

func (*PrefixStorage) Iter

func (st *PrefixStorage) Iter(
	r *leveldbutil.Range,
	callback func([]byte, []byte) (bool, error),
	sort bool,
) error

func (*PrefixStorage) NewBatch

func (st *PrefixStorage) NewBatch() *PrefixStorageBatch

func (*PrefixStorage) Prefix

func (st *PrefixStorage) Prefix() []byte

func (*PrefixStorage) Put

func (st *PrefixStorage) Put(key, b []byte, opt *leveldbOpt.WriteOptions) error

func (*PrefixStorage) RawStorage

func (st *PrefixStorage) RawStorage() *Storage

func (*PrefixStorage) Remove

func (st *PrefixStorage) Remove() error

type PrefixStorageBatch

type PrefixStorageBatch struct {
	*leveldb.Batch
	// contains filtered or unexported fields
}

func (*PrefixStorageBatch) Delete

func (b *PrefixStorageBatch) Delete(key []byte)

func (*PrefixStorageBatch) LBatch

func (b *PrefixStorageBatch) LBatch() *leveldb.Batch

func (*PrefixStorageBatch) Put

func (b *PrefixStorageBatch) Put(key, i []byte)

type Storage

type Storage struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(str leveldbStorage.Storage, opt *leveldbOpt.Options) (*Storage, error)

func (*Storage) Batch

func (st *Storage) Batch(batch *leveldb.Batch, wo *leveldbOpt.WriteOptions) error

func (*Storage) BatchFunc

func (st *Storage) BatchFunc(
	ctx context.Context,
	batchsize uint64,
	wo *leveldbOpt.WriteOptions,
) (
	func(func(LeveldbBatch), func(func() error) error) error,
	func(func(func() error) error) error,
	func(),
)

func (*Storage) BatchFuncWithNewBatch

func (st *Storage) BatchFuncWithNewBatch(
	ctx context.Context,
	batchsize uint64,
	wo *leveldbOpt.WriteOptions,
	newBatch func() LeveldbBatch,
) (
	add func(func(LeveldbBatch), func(func() error) error) error,
	done func(func(func() error) error) error,
	cancel func(),
)

func (*Storage) Clean

func (st *Storage) Clean() error

func (*Storage) Close

func (st *Storage) Close() error

func (*Storage) DB

func (st *Storage) DB() *leveldb.DB

func (*Storage) Delete

func (st *Storage) Delete(k []byte, opt *leveldbOpt.WriteOptions) error

func (*Storage) Exists

func (st *Storage) Exists(key []byte) (bool, error)

func (*Storage) Get

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

func (*Storage) Iter

func (st *Storage) Iter(
	r *leveldbutil.Range,
	callback func(key []byte, raw []byte) (bool, error),
	sort bool,
) error

func (*Storage) Put

func (st *Storage) Put(k, b []byte, opt *leveldbOpt.WriteOptions) error

Jump to

Keyboard shortcuts

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