app

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeTypeOK                uint32 = 0
	CodeTypeEncodingError     uint32 = 1
	CodeTypeBadNonce          uint32 = 2
	CodeTypeUnauthorized      uint32 = 3
	CodeTypeUnknownRequest    uint32 = 4
	CodeTypeDeliverTxError    uint32 = 5
	CodeTypeCheckTxError      uint32 = 6
	CodeTypeQueryError        uint32 = 7
	CodeEmptySearchQuery      uint32 = 8
	CodeParseSearchQueryError uint32 = 9
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	types.BaseApplication
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(dbHost, dbName string) *Application

func (*Application) CheckTx

func (app *Application) CheckTx(txBytes []byte) types.ResponseCheckTx

CheckTx method responsible for check transaction on validity.

func (*Application) Commit

func (app *Application) Commit() types.ResponseCommit

Commit method generates hash of current state.

func (*Application) DeliverTx

func (app *Application) DeliverTx(txBytes []byte) types.ResponseDeliverTx

DeliverTx method responsible for deliver chosen transaction type.

func (*Application) Info

func (app *Application) Info() (resInfo types.ResponseInfo)

Info method returns information about current state. All sizes represented in kilobytes.

func (*Application) Query

func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)

Query method processes user's request. Search endpoint uses Mongo DB query syntax. For make search request uses MongoQuery struct. The limit and offset fields are optional. All mongo query places in query field of struct. Check mongo query syntax at: https://docs.mongodb.com/manual/tutorial/query-documents/

type LastBlockInfo

type LastBlockInfo struct {
	Height  int64  `bson:"height"`
	AppHash []byte `bson:"app_hash"`
}

type MongoQuery

type MongoQuery struct {
	Query  interface{} `json:"query,omitempty"`
	Limit  int         `json:"limit,omitempty"`
	Offset int         `json:"offset,omitempty"`
}

MongoQuery is a struct for parse search query from a user.

type PersistentApplication

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

func NewPersistentApplication

func NewPersistentApplication(dbHost, dbName string) *PersistentApplication

func (*PersistentApplication) BeginBlock

func (app *PersistentApplication) BeginBlock(req types.RequestBeginBlock) (resBeginBlock types.ResponseBeginBlock)

BeginBlock method tracks the block hash and header information

func (*PersistentApplication) CheckTx

func (app *PersistentApplication) CheckTx(tx []byte) types.ResponseCheckTx

func (*PersistentApplication) Commit

func (*PersistentApplication) DeliverTx

func (app *PersistentApplication) DeliverTx(tx []byte) types.ResponseDeliverTx

func (*PersistentApplication) EndBlock

func (app *PersistentApplication) EndBlock(reqEndBlock types.RequestEndBlock) (resEndBlock types.ResponseEndBlock)

EndBlock method should in future update the validator set

func (*PersistentApplication) Info

func (app *PersistentApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo)

func (*PersistentApplication) InitChain

func (*PersistentApplication) LoadLastBlock

func (app *PersistentApplication) LoadLastBlock() (lastBlock LastBlockInfo)

LoadLastBlock method load last confirmed block from DB

func (*PersistentApplication) Query

func (*PersistentApplication) SaveLastBlock

func (app *PersistentApplication) SaveLastBlock(lastBlock LastBlockInfo)

SaveLastBlock method saves appHash of loast confirmed block in DB

func (*PersistentApplication) SetLogger

func (app *PersistentApplication) SetLogger(l *log.Logger)

func (*PersistentApplication) SetOption

Jump to

Keyboard shortcuts

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