store

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const TablePrefix = "t"

Variables

View Source
var ErrNoEntities = errors.New("no entities defined yet")
View Source
var ZeroEntityID = NewEntityID(0)

Functions

func Del

func Del(ctx sdk.Context, sk sdk.StoreKey, key []byte) sdk.Error

func FormatCoin

func FormatCoin(id EntityID, amount sdk.Uint) sdk.Coin

func FormatDenom

func FormatDenom(id EntityID) string

func Get

func Get(ctx sdk.Context, sk sdk.StoreKey, cdc *codec.Codec, key []byte, proto interface{}) sdk.Error

func Has

func Has(ctx sdk.Context, sk sdk.StoreKey, key []byte) bool

func Int64Subkey

func Int64Subkey(subkey int64) []byte

func IntSubkey

func IntSubkey(subkey int) []byte

func KVStorePrefixIterator

func KVStorePrefixIterator(kvs KVStore, prefix []byte) sdk.Iterator

func KVStoreReversePrefixIterator

func KVStoreReversePrefixIterator(kvs KVStore, prefix []byte) sdk.Iterator

func PrefixKeyBytes

func PrefixKeyBytes(subkeys ...[]byte) []byte

func PrefixKeyString

func PrefixKeyString(prefix string, subkeys ...[]byte) []byte

func Set

func Set(ctx sdk.Context, sk sdk.StoreKey, cdc *codec.Codec, key []byte, val interface{})

func SetExists

func SetExists(ctx sdk.Context, sk sdk.StoreKey, cdc *codec.Codec, key []byte, val interface{}) sdk.Error

func SetNotExists

func SetNotExists(ctx sdk.Context, sk sdk.StoreKey, cdc *codec.Codec, key []byte, val interface{}) sdk.Error

func Uint64Subkey

func Uint64Subkey(subkey uint64) []byte

Types

type ArchiveStore

type ArchiveStore interface {
	Get(key []byte) []byte
	Has(key []byte) bool
	Set(key []byte, value []byte)
	Delete(key []byte)
	Iterator(start []byte, end []byte, cb IteratorCB)
	ReverseIterator(start []byte, end []byte, cb IteratorCB)
	PrefixIterator(start []byte, cb IteratorCB)
	ReversePrefixIterator(start []byte, cb IteratorCB)
	Substore(prefix string) ArchiveStore
}

type EntityID

type EntityID sdk.Uint

func GetSeq

func GetSeq(ctx sdk.Context, sk sdk.StoreKey, seqKey []byte) EntityID

func IncrementSeq

func IncrementSeq(ctx sdk.Context, sk sdk.StoreKey, seqKey []byte) EntityID

func NewEntityID

func NewEntityID(id uint64) EntityID

func NewEntityIDFromBytes

func NewEntityIDFromBytes(b []byte) EntityID

func NewEntityIDFromString

func NewEntityIDFromString(str string) EntityID

func (EntityID) Bytes

func (id EntityID) Bytes() []byte

func (EntityID) Cmp

func (id EntityID) Cmp(b EntityID) int

func (EntityID) Dec

func (id EntityID) Dec() EntityID

func (EntityID) Equals

func (id EntityID) Equals(other EntityID) bool

func (EntityID) Inc

func (id EntityID) Inc() EntityID

func (EntityID) IsDefined

func (id EntityID) IsDefined() bool

func (EntityID) IsZero

func (id EntityID) IsZero() bool

func (EntityID) MarshalAmino

func (id EntityID) MarshalAmino() (string, error)

func (EntityID) MarshalJSON

func (id EntityID) MarshalJSON() ([]byte, error)

func (EntityID) String

func (id EntityID) String() string

func (*EntityID) UnmarshalAmino

func (id *EntityID) UnmarshalAmino(text string) error

func (*EntityID) UnmarshalJSON

func (id *EntityID) UnmarshalJSON(data []byte) error

type Identifiable

type Identifiable interface {
	GetID() EntityID
	SetID(id EntityID)
}

type Incrementing

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

func NewIncrementing

func NewIncrementing(backend KVStore, cdc *codec.Codec) *Incrementing

func (*Incrementing) ByID

func (inc *Incrementing) ByID(id EntityID, val interface{}) error

func (*Incrementing) HasID

func (inc *Incrementing) HasID(id EntityID) bool

func (*Incrementing) Head

func (inc *Incrementing) Head(val interface{}) error

func (*Incrementing) HeadID

func (inc *Incrementing) HeadID() EntityID

func (*Incrementing) HeadKey

func (inc *Incrementing) HeadKey() []byte

func (*Incrementing) Insert

func (inc *Incrementing) Insert(val Identifiable) error

func (*Incrementing) Iterator

func (inc *Incrementing) Iterator() sdk.Iterator

func (*Incrementing) ReverseIterator

func (inc *Incrementing) ReverseIterator() sdk.Iterator

func (*Incrementing) ValueKey

func (inc *Incrementing) ValueKey(id EntityID) []byte

type IteratorCB

type IteratorCB func(k []byte, v []byte) bool

type KVStore

type KVStore interface {
	Get(key []byte) []byte

	Has(key []byte) bool

	Set(key, value []byte)

	Delete(key []byte)

	Iterator(start, end []byte) sdk.Iterator

	ReverseIterator(start, end []byte) sdk.Iterator
}

type Prefixed

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

func NewPrefixed

func NewPrefixed(backend KVStore, prefix []byte) *Prefixed

func (*Prefixed) Delete

func (p *Prefixed) Delete(key []byte)

func (*Prefixed) Get

func (p *Prefixed) Get(key []byte) []byte

func (*Prefixed) Has

func (p *Prefixed) Has(key []byte) bool

func (*Prefixed) Iterator

func (p *Prefixed) Iterator(start, end []byte) sdk.Iterator

func (*Prefixed) ReverseIterator

func (p *Prefixed) ReverseIterator(start, end []byte) sdk.Iterator

func (*Prefixed) Set

func (p *Prefixed) Set(key, value []byte)

type Table

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

func NewTable

func NewTable(db dbm.DB, prefix string) *Table

func (*Table) Delete

func (t *Table) Delete(key []byte)

func (*Table) Get

func (t *Table) Get(key []byte) []byte

func (*Table) Has

func (t *Table) Has(key []byte) bool

func (*Table) Iterator

func (t *Table) Iterator(start []byte, end []byte, cb IteratorCB)

func (*Table) PrefixIterator

func (t *Table) PrefixIterator(start []byte, cb IteratorCB)

func (*Table) ReverseIterator

func (t *Table) ReverseIterator(start []byte, end []byte, cb IteratorCB)

func (*Table) ReversePrefixIterator

func (t *Table) ReversePrefixIterator(start []byte, cb IteratorCB)

func (*Table) Set

func (t *Table) Set(key, value []byte)

func (*Table) Substore

func (t *Table) Substore(prefix string) ArchiveStore

Jump to

Keyboard shortcuts

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