Documentation ¶
Index ¶
- Constants
- type Application
- func (app *Application) CheckTx(txBytes []byte) types.ResponseCheckTx
- func (app *Application) Commit() types.ResponseCommit
- func (app *Application) DeliverTx(txBytes []byte) types.ResponseDeliverTx
- func (app *Application) Info() (resInfo types.ResponseInfo)
- func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
- func (app *Application) SetLogger(l log.Logger)
- type LastBlockInfo
- type PersistentApplication
- func (app *PersistentApplication) BeginBlock(req types.RequestBeginBlock) (resBeginBlock types.ResponseBeginBlock)
- func (app *PersistentApplication) CheckTx(tx []byte) types.ResponseCheckTx
- func (app *PersistentApplication) Commit() types.ResponseCommit
- func (app *PersistentApplication) DeliverTx(tx []byte) types.ResponseDeliverTx
- func (app *PersistentApplication) EndBlock(reqEndBlock types.RequestEndBlock) (resEndBlock types.ResponseEndBlock)
- func (app *PersistentApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
- func (app *PersistentApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
- func (app *PersistentApplication) LoadLastBlock() (lastBlock LastBlockInfo)
- func (app *PersistentApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery
- func (app *PersistentApplication) SaveLastBlock(lastBlock LastBlockInfo)
- func (app *PersistentApplication) SetLogger(l log.Logger)
- func (app *PersistentApplication) SetOption(reqSetOpt types.RequestSetOption) types.ResponseSetOption
Constants ¶
const ( CodeTypeOK uint32 = 0 CodeTypeEncodingError uint32 = 1 CodeTypeBadNonce uint32 = 2 CodeTypeUnknownRequest uint32 = 4 CodeTypeDeliverTxError uint32 = 5 CodeTypeCheckTxError uint32 = 6 CodeTypeQueryError uint32 = 7 CodeEmptySearchQuery uint32 = 8 CodeParseSearchQueryError uint32 = 9 )
Anychaindb response codes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { types.BaseApplication // contains filtered or unexported fields }
Application inherits BaseApplication and keeps state of anychaindb
func NewApplication ¶
func NewApplication(dbHost, dbName string) *Application
NewApplication method initializes new application with MongoDB state
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/
func (*Application) SetLogger ¶ added in v1.2.0
func (app *Application) SetLogger(l log.Logger)
SetLogger method set logger for Application
type LastBlockInfo ¶
type PersistentApplication ¶
type PersistentApplication struct {
// contains filtered or unexported fields
}
func NewPersistentApplication ¶
func NewPersistentApplication(dbHost, dbName string) *PersistentApplication
NewPersistentApplication method construct application with persistent state
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
CheckTx method validates a transaction in mempool
func (*PersistentApplication) Commit ¶
func (app *PersistentApplication) Commit() types.ResponseCommit
Commit method commits the state and returns the application state hash
func (*PersistentApplication) DeliverTx ¶
func (app *PersistentApplication) DeliverTx(tx []byte) types.ResponseDeliverTx
DeliverTx method delivers a transaction to state
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)
Info method returns application info with last block height and hash
func (*PersistentApplication) InitChain ¶
func (app *PersistentApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
InitChain method initializes Anychaindb
func (*PersistentApplication) LoadLastBlock ¶
func (app *PersistentApplication) LoadLastBlock() (lastBlock LastBlockInfo)
LoadLastBlock method load last confirmed block from DB
func (*PersistentApplication) Query ¶
func (app *PersistentApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery
Query method invokes for state
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)
SetLogger method sets application logger
func (*PersistentApplication) SetOption ¶
func (app *PersistentApplication) SetOption(reqSetOpt types.RequestSetOption) types.ResponseSetOption
SetOption method sets application option