Documentation ¶
Index ¶
- Constants
- Variables
- func InitKVStore(app *PersistentKVStoreApplication)
- func MakeValSetChangeTx(pubkey pc.PublicKey, power int64) []byte
- func RandVal(i int) types.ValidatorUpdate
- func RandVals(cnt int) []types.ValidatorUpdate
- type Application
- func (app *Application) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
- func (app *Application) Commit() types.ResponseCommit
- func (app *Application) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
- func (app *Application) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
- func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
- type PersistentKVStoreApplication
- func (app *PersistentKVStoreApplication) ApplySnapshotChunk(req types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk
- func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
- func (app *PersistentKVStoreApplication) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
- func (app *PersistentKVStoreApplication) Close() error
- func (app *PersistentKVStoreApplication) Commit() types.ResponseCommit
- func (app *PersistentKVStoreApplication) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
- func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
- func (app *PersistentKVStoreApplication) Info(req types.RequestInfo) types.ResponseInfo
- func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
- func (app *PersistentKVStoreApplication) ListSnapshots(req types.RequestListSnapshots) types.ResponseListSnapshots
- func (app *PersistentKVStoreApplication) LoadSnapshotChunk(req types.RequestLoadSnapshotChunk) types.ResponseLoadSnapshotChunk
- func (app *PersistentKVStoreApplication) OfferSnapshot(req types.RequestOfferSnapshot) types.ResponseOfferSnapshot
- func (app *PersistentKVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
- func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
- func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)
- type State
Constants ¶
const (
ValidatorSetChangePrefix string = "val:"
)
Variables ¶
var (
ProtocolVersion uint64 = 0x1
)
Functions ¶
func InitKVStore ¶
func InitKVStore(app *PersistentKVStoreApplication)
InitKVStore initializes the kvstore app with some data, which allows tests to pass and is fine as long as you don't make any tx that modify the validator state
func RandVal ¶
func RandVal(i int) types.ValidatorUpdate
RandVal creates one random validator, with a key derived from the input value
func RandVals ¶
func RandVals(cnt int) []types.ValidatorUpdate
RandVals returns a list of cnt validators for initializing the application. Note that the keys are deterministically derived from the index in the array, while the power is random (Change this if not desired)
Types ¶
type Application ¶
type Application struct { types.BaseApplication RetainBlocks int64 // blocks to retain after commit (via ResponseCommit.RetainHeight) // contains filtered or unexported fields }
func NewApplication ¶
func NewApplication() *Application
func (*Application) CheckTx ¶
func (app *Application) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
func (*Application) Commit ¶
func (app *Application) Commit() types.ResponseCommit
func (*Application) DeliverTx ¶
func (app *Application) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
tx is either "key=value" or just arbitrary bytes
func (*Application) Info ¶
func (app *Application) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
func (*Application) Query ¶
func (app *Application) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
Returns an associated value or nil if missing.
type PersistentKVStoreApplication ¶
type PersistentKVStoreApplication struct { // validator set ValUpdates []types.ValidatorUpdate // contains filtered or unexported fields }
func NewPersistentKVStoreApplication ¶
func NewPersistentKVStoreApplication(dbDir string) *PersistentKVStoreApplication
func (*PersistentKVStoreApplication) ApplySnapshotChunk ¶
func (app *PersistentKVStoreApplication) ApplySnapshotChunk( req types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk
func (*PersistentKVStoreApplication) BeginBlock ¶
func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
Track the block hash and header information
func (*PersistentKVStoreApplication) CheckTx ¶
func (app *PersistentKVStoreApplication) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx
func (*PersistentKVStoreApplication) Close ¶
func (app *PersistentKVStoreApplication) Close() error
func (*PersistentKVStoreApplication) Commit ¶
func (app *PersistentKVStoreApplication) Commit() types.ResponseCommit
Commit will panic if InitChain was not called
func (*PersistentKVStoreApplication) DeliverTx ¶
func (app *PersistentKVStoreApplication) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx
tx is either "val:pubkey!power" or "key=value" or just arbitrary bytes
func (*PersistentKVStoreApplication) EndBlock ¶
func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
Update the validator set
func (*PersistentKVStoreApplication) Info ¶
func (app *PersistentKVStoreApplication) Info(req types.RequestInfo) types.ResponseInfo
func (*PersistentKVStoreApplication) InitChain ¶
func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
Save the validators in the merkle tree
func (*PersistentKVStoreApplication) ListSnapshots ¶
func (app *PersistentKVStoreApplication) ListSnapshots( req types.RequestListSnapshots) types.ResponseListSnapshots
func (*PersistentKVStoreApplication) LoadSnapshotChunk ¶
func (app *PersistentKVStoreApplication) LoadSnapshotChunk( req types.RequestLoadSnapshotChunk) types.ResponseLoadSnapshotChunk
func (*PersistentKVStoreApplication) OfferSnapshot ¶
func (app *PersistentKVStoreApplication) OfferSnapshot( req types.RequestOfferSnapshot) types.ResponseOfferSnapshot
func (*PersistentKVStoreApplication) Query ¶
func (app *PersistentKVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
When path=/val and data={validator address}, returns the validator update (types.ValidatorUpdate) varint encoded. For any other path, returns an associated value or nil if missing.
func (*PersistentKVStoreApplication) SetLogger ¶
func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
func (*PersistentKVStoreApplication) Validators ¶
func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)