store

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CosmosIterator

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

CosmosIterator is a Cosmos KVStore's iterator implementation of Iterator.

func NewCosmosIterator

func NewCosmosIterator(iter types.Iterator) *CosmosIterator

NewCosmosIterator returns a new Cosmos KVStore Iterator wrapper.

func (*CosmosIterator) Error

func (i *CosmosIterator) Error() error

Error returns any accumulated error.

func (*CosmosIterator) Key

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

Key returns the key of the cursor.

func (*CosmosIterator) Next

func (i *CosmosIterator) Next() bool

Next moves the iterator to the next sequential key in the store.

func (*CosmosIterator) Release

func (i *CosmosIterator) Release()

Release releases the Iterator.

func (*CosmosIterator) Value

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

Value returns the value of the cursor.

type CosmosStore

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

CosmosStore is a Cosmos KVStore implementation of Store.

func NewCosmosStore

func NewCosmosStore(store types.KVStore) *CosmosStore

NewCosmosStore returns a new Cosmos KVStore wrapper.

func (*CosmosStore) Close

func (s *CosmosStore) Close() error

Close closes the store.

func (*CosmosStore) Delete

func (s *CosmosStore) Delete(key []byte) (err error)

Delete deletes the value for the given key. Delete will not returns error if key doesn't exist.

func (*CosmosStore) Get

func (s *CosmosStore) Get(key []byte) (out []byte, err error)

Get retrives service from store. It returns an error if the store does not contains the key.

func (*CosmosStore) Has

func (s *CosmosStore) Has(key []byte) (has bool, err error)

Has returns true if the key is set in the store.

func (*CosmosStore) NewIterator

func (s *CosmosStore) NewIterator() Iterator

NewIterator returns a new iterator.

func (*CosmosStore) Put

func (s *CosmosStore) Put(key []byte, value []byte) (err error)

Put sets the value for the given key. It overwrites any previous value.

type Iterator

type Iterator interface {
	// Next moves the iterator to the next sequential key in the store.
	Next() bool

	// Key returns the key of the cursor.
	Key() []byte

	// Value returns the value of the cursor.
	Value() []byte

	// Release releases the Iterator.
	Release()

	// Error returns any accumulated error.
	Error() error
}

Iterator describes the public API of an iterator.

type LevelDBStore

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

LevelDBStore is a levelDB implementation of Store.

func NewLevelDBStore

func NewLevelDBStore(path string) (*LevelDBStore, error)

NewLevelDBStore returns a new level db wrapper.

func (*LevelDBStore) Close

func (s *LevelDBStore) Close() error

Close closes the store.

func (*LevelDBStore) Delete

func (s *LevelDBStore) Delete(key []byte) error

Delete deletes the value for the given key. Delete will not returns error if key doesn't exist.

func (*LevelDBStore) Get

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

Get retrives service from store. It returns error if the store does not contains the key.

func (*LevelDBStore) Has

func (s *LevelDBStore) Has(key []byte) (bool, error)

Has returns true if the key is set in the store.

func (*LevelDBStore) NewIterator

func (s *LevelDBStore) NewIterator() Iterator

NewIterator returns a new iterator.

func (*LevelDBStore) Put

func (s *LevelDBStore) Put(key []byte, value []byte) error

Put sets the value for the given key. It overwrites any previous value.

type Store

type Store interface {
	// Get retrives service from store. It returns an error if the store does not contains the key.
	Get(key []byte) ([]byte, error)

	// Has returns true if the key is set in the store.
	Has(key []byte) (bool, error)

	// Delete deletes the value for the given key. Delete will not returns error if key doesn't exist.
	Delete(key []byte) error

	// Put sets the value for the given key. It overwrites any previous value.
	Put(key []byte, value []byte) error

	// NewIterator returns a new iterator.
	NewIterator() Iterator

	// Close closes the store.
	Close() error
}

Store describes the public API of a store.

Jump to

Keyboard shortcuts

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