Documentation ¶
Index ¶
- Constants
- Variables
- func InitKVStore(app *PersistentKVStoreApplication)
- func MakeValSetChangeTx(pubkey types.PubKey, power int64) []byte
- func RandVal(i int) types.ValidatorUpdate
- func RandVals(cnt int) []types.ValidatorUpdate
- type KVStoreApplication
- func (app *KVStoreApplication) CheckTx(tx []byte) types.ResponseCheckTx
- func (app *KVStoreApplication) Commit() types.ResponseCommit
- func (app *KVStoreApplication) DeliverTx(tx []byte) types.ResponseDeliverTx
- func (app *KVStoreApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
- func (app *KVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
- type PersistentKVStoreApplication
- func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
- func (app *PersistentKVStoreApplication) CheckTx(tx []byte) types.ResponseCheckTx
- func (app *PersistentKVStoreApplication) Commit() types.ResponseCommit
- func (app *PersistentKVStoreApplication) DeliverTx(tx []byte) types.ResponseDeliverTx
- func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
- func (app *PersistentKVStoreApplication) EndRecovery(height int64) error
- func (app *PersistentKVStoreApplication) Info(req types.RequestInfo) types.ResponseInfo
- func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
- func (app *PersistentKVStoreApplication) LatestSnapshot() (height int64, numKeys []int64, err error)
- func (app *PersistentKVStoreApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery
- func (app *PersistentKVStoreApplication) ReCheckTx(tx []byte) types.ResponseCheckTx
- func (app *PersistentKVStoreApplication) ReadSnapshotChunk(height int64, startIndex, endIndex int64) (chunk [][]byte, err error)
- func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
- func (app *PersistentKVStoreApplication) SetOption(req types.RequestSetOption) types.ResponseSetOption
- func (app *PersistentKVStoreApplication) StartRecovery(height int64, numKeys []int64) error
- func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)
- func (app *PersistentKVStoreApplication) WriteRecoveryChunk(chunk [][]byte) error
- type State
Constants ¶
const (
ValidatorSetChangePrefix string = "val:"
)
Variables ¶
var (
ProtocolVersion version.Protocol = 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 KVStoreApplication ¶
type KVStoreApplication struct { types.BaseApplication // contains filtered or unexported fields }
func NewKVStoreApplication ¶
func NewKVStoreApplication() *KVStoreApplication
func (*KVStoreApplication) CheckTx ¶
func (app *KVStoreApplication) CheckTx(tx []byte) types.ResponseCheckTx
func (*KVStoreApplication) Commit ¶
func (app *KVStoreApplication) Commit() types.ResponseCommit
func (*KVStoreApplication) DeliverTx ¶
func (app *KVStoreApplication) DeliverTx(tx []byte) types.ResponseDeliverTx
tx is either "key=value" or just arbitrary bytes
func (*KVStoreApplication) Info ¶
func (app *KVStoreApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
func (*KVStoreApplication) Query ¶
func (app *KVStoreApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
type PersistentKVStoreApplication ¶
type PersistentKVStoreApplication struct { // validator set ValUpdates []types.ValidatorUpdate // contains filtered or unexported fields }
func NewPersistentKVStoreApplication ¶
func NewPersistentKVStoreApplication(dbDir string) *PersistentKVStoreApplication
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(tx []byte) types.ResponseCheckTx
func (*PersistentKVStoreApplication) Commit ¶
func (app *PersistentKVStoreApplication) Commit() types.ResponseCommit
Commit will panic if InitChain was not called
func (*PersistentKVStoreApplication) DeliverTx ¶
func (app *PersistentKVStoreApplication) DeliverTx(tx []byte) 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) EndRecovery ¶
func (app *PersistentKVStoreApplication) EndRecovery(height int64) error
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) LatestSnapshot ¶
func (app *PersistentKVStoreApplication) LatestSnapshot() (height int64, numKeys []int64, err error)
func (*PersistentKVStoreApplication) Query ¶
func (app *PersistentKVStoreApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery
func (*PersistentKVStoreApplication) ReCheckTx ¶
func (app *PersistentKVStoreApplication) ReCheckTx(tx []byte) types.ResponseCheckTx
func (*PersistentKVStoreApplication) ReadSnapshotChunk ¶
func (app *PersistentKVStoreApplication) ReadSnapshotChunk(height int64, startIndex, endIndex int64) (chunk [][]byte, err error)
func (*PersistentKVStoreApplication) SetLogger ¶
func (app *PersistentKVStoreApplication) SetLogger(l log.Logger)
func (*PersistentKVStoreApplication) SetOption ¶
func (app *PersistentKVStoreApplication) SetOption(req types.RequestSetOption) types.ResponseSetOption
func (*PersistentKVStoreApplication) StartRecovery ¶
func (app *PersistentKVStoreApplication) StartRecovery(height int64, numKeys []int64) error
func (*PersistentKVStoreApplication) Validators ¶
func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)
func (*PersistentKVStoreApplication) WriteRecoveryChunk ¶
func (app *PersistentKVStoreApplication) WriteRecoveryChunk(chunk [][]byte) error