state

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2017 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountIndexKey

func AccountIndexKey() []byte

AccountIndexKey generates a data store's unique key for an AccountIndex

func AccountKey

func AccountKey(id string) []byte

AccountKey generates a data store's unique key for an Account

func ExecQuery

func ExecQuery(state *State, resource string, object string) abci.ResponseQuery

ExecQuery handles queries.

func ExecTx

func ExecTx(state *State, pgz *bctypes.Plugins, tx types.Tx,
	isCheckTx bool, evc events.Fireable) abci.Result

ExecTx actually executes a Tx

func GetAccount

func GetAccount(store basecoin.KVStore, id string) *types.Account

GetAccount retrieves an Account from the given store

func GetAccountIndex

func GetAccountIndex(store basecoin.KVStore) *types.AccountIndex

GetAccountIndex retrieves a AccountIndex from the given store

func GetLegalEntity

func GetLegalEntity(store basecoin.KVStore, id string) *types.LegalEntity

GetLegalEntity retrieves a LegalEntity from the given store

func GetOrMakeAccountIndex

func GetOrMakeAccountIndex(state types.AccountIndexGetter) *types.AccountIndex

Returns existing AccountIndex from store or creates new empty one

func GetUser

func GetUser(store basecoin.KVStore, addr []byte) *types.User

GetUser retrieves a User from the given store

func LegalEntityKey

func LegalEntityKey(id string) []byte

LegalEntityKey generates a data store's unique key for a LegalEntity

func SetAccount

func SetAccount(store basecoin.KVStore, id string, acc *types.Account)

SetAccount stores an Account to the given store

func SetAccountInIndex

func SetAccountInIndex(state *State, account types.Account) abci.Result

Sets Account in AccountIndex in store

func SetLegalEntity

func SetLegalEntity(store basecoin.KVStore, id string, ent *types.LegalEntity)

SetLegalEntity stores a LegalEntity to the given store

func SetLegalEntityInIndex

func SetLegalEntityInIndex(state *State, legalEntity *types.LegalEntity) abci.Result

Sets LegalEntity in LegalEntityIndex in store

func SetUser

func SetUser(store basecoin.KVStore, addr []byte, usr *types.User)

SetUser stores a User to the given store

func UserKey

func UserKey(addr []byte) []byte

UserKey generates a data store's unique key for a User

Types

type State

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

State defines the attributes of the system's state

func NewState

func NewState(store basecoin.KVStore) *State

NewState creates a new State

func (*State) CacheSync

func (s *State) CacheSync()

NOTE: errors if s is not from CacheWrap()

func (*State) CacheWrap

func (s *State) CacheWrap() *State

func (*State) Get

func (s *State) Get(key []byte) (value []byte)

Get retrieves the value for the respective key from the State's store

func (*State) GetAccount

func (s *State) GetAccount(id string) *types.Account

GetAccount retrieves the Account by address

func (*State) GetAccountIndex

func (s *State) GetAccountIndex() *types.AccountIndex

GetAccountIndex gets the accounts index

func (*State) GetChainID

func (s *State) GetChainID() string

GetChainID retrieves the State's chain ID

func (*State) GetLegalEntity

func (s *State) GetLegalEntity(id string) *types.LegalEntity

GetLegalEntity retrieves the LegalEntity by address

func (*State) GetLegalEntityIndex

func (s *State) GetLegalEntityIndex() *types.LegalEntityIndex

Gets existing LegalEntityIndex from store or nil if nonexistent. Can panic if store's data is corrupt.

func (*State) GetUser

func (s *State) GetUser(addr []byte) *types.User

GetUser retrieves the User by address

func (*State) Set

func (s *State) Set(key []byte, value []byte)

Set updates the State's store's key with value

func (*State) SetAccount

func (s *State) SetAccount(id string, acc *types.Account)

SetAccount sets an Account

func (*State) SetAccountIndex

func (s *State) SetAccountIndex(index *types.AccountIndex)

SetAccountIndex sets the accounts index

func (*State) SetChainID

func (s *State) SetChainID(chainID string)

SetChainID sets the State's chain ID

func (*State) SetLegalEntity

func (s *State) SetLegalEntity(id string, l *types.LegalEntity)

SetLegalEntity sets a LegalEntity

func (*State) SetLegalEntityIndex

func (s *State) SetLegalEntityIndex(LegalEntityIndex *types.LegalEntityIndex)

Sets LegalEntityIndex in store

func (*State) SetUser

func (s *State) SetUser(addr []byte, acc *types.User)

SetUser sets a User

Jump to

Keyboard shortcuts

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