2015-11-02 07:39:53 -08:00
|
|
|
package types
|
|
|
|
|
2016-02-28 19:19:29 -08:00
|
|
|
// Applications
|
2015-11-02 07:39:53 -08:00
|
|
|
type Application interface {
|
|
|
|
|
2015-11-09 16:29:45 -08:00
|
|
|
// Return application info
|
2016-01-25 08:01:18 -08:00
|
|
|
Info() (info string)
|
2015-11-02 07:39:53 -08:00
|
|
|
|
2015-11-27 10:14:46 -08:00
|
|
|
// Set application option (e.g. mode=mempool, mode=consensus)
|
2016-01-25 08:01:18 -08:00
|
|
|
SetOption(key string, value string) (log string)
|
2015-11-27 10:14:46 -08:00
|
|
|
|
2016-01-08 16:52:02 -08:00
|
|
|
// Append a tx
|
2016-03-20 17:10:13 -07:00
|
|
|
AppendTx(tx []byte) Result
|
2015-11-02 07:39:53 -08:00
|
|
|
|
2016-01-08 16:52:02 -08:00
|
|
|
// Validate a tx for the mempool
|
2016-03-20 17:10:13 -07:00
|
|
|
CheckTx(tx []byte) Result
|
2016-01-08 16:52:02 -08:00
|
|
|
|
2016-01-18 14:37:42 -08:00
|
|
|
// Query for state
|
2016-03-20 17:10:13 -07:00
|
|
|
Query(query []byte) Result
|
2016-05-05 13:58:10 -07:00
|
|
|
|
|
|
|
// Return the application Merkle root hash
|
|
|
|
Commit() Result
|
2015-11-02 07:39:53 -08:00
|
|
|
}
|
2016-02-28 19:19:29 -08:00
|
|
|
|
2016-03-05 19:18:34 -08:00
|
|
|
// Some applications can choose to implement BlockchainAware
|
|
|
|
type BlockchainAware interface {
|
2016-02-28 19:19:29 -08:00
|
|
|
|
2016-03-05 19:18:34 -08:00
|
|
|
// Initialize blockchain
|
|
|
|
// validators: genesis validators from TendermintCore
|
|
|
|
InitChain(validators []*Validator)
|
2016-02-28 19:19:29 -08:00
|
|
|
|
2016-03-26 22:35:23 -07:00
|
|
|
// Signals the beginning of a block
|
|
|
|
BeginBlock(height uint64)
|
|
|
|
|
2016-03-05 19:18:34 -08:00
|
|
|
// Signals the end of a block
|
2016-05-05 13:58:10 -07:00
|
|
|
// diffs: changed validators from app to TendermintCore
|
|
|
|
EndBlock(height uint64) (diffs []*Validator)
|
2016-02-28 19:19:29 -08:00
|
|
|
}
|