Documentation ¶
Index ¶
- Constants
- Variables
- func InitKVStore(ctx context.Context, app *PersistentKVStoreApplication) error
- func MakeValSetChangeTx(pubkey cryptoproto.PublicKey, power int64) []byte
- func RandVal(i int) types.ValidatorUpdate
- func RandVals(cnt int) []types.ValidatorUpdate
- type Application
- func (*Application) CheckTx(_ context.Context, req *types.RequestCheckTx) (*types.ResponseCheckTx, error)
- func (app *Application) Close() error
- func (app *Application) Commit(_ context.Context) (*types.ResponseCommit, error)
- func (app *Application) FinalizeBlock(_ context.Context, req *types.RequestFinalizeBlock) (*types.ResponseFinalizeBlock, error)
- func (app *Application) Info(_ context.Context, req *types.RequestInfo) (*types.ResponseInfo, error)
- func (app *Application) InitChain(_ context.Context, req *types.RequestInitChain) (*types.ResponseInitChain, error)
- func (app *Application) PrepareProposal(_ context.Context, req *types.RequestPrepareProposal) (*types.ResponsePrepareProposal, error)
- func (*Application) ProcessProposal(_ context.Context, req *types.RequestProcessProposal) (*types.ResponseProcessProposal, error)
- func (app *Application) Query(_ context.Context, reqQuery *types.RequestQuery) (*types.ResponseQuery, error)
- func (app *Application) Validators() (validators []types.ValidatorUpdate)
- type PersistentKVStoreApplication
- func (app *PersistentKVStoreApplication) ApplySnapshotChunk(_ context.Context, req *types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error)
- func (app *PersistentKVStoreApplication) OfferSnapshot(_ context.Context, req *types.RequestOfferSnapshot) (*types.ResponseOfferSnapshot, error)
- type State
Constants ¶
View Source
const PreparePrefix = "prepare"
View Source
const (
ValidatorSetChangePrefix string = "val:"
)
Variables ¶
View Source
var (
ProtocolVersion uint64 = 0x1
)
Functions ¶
func InitKVStore ¶
func InitKVStore(ctx context.Context, app *PersistentKVStoreApplication) error
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 MakeValSetChangeTx ¶
func MakeValSetChangeTx(pubkey cryptoproto.PublicKey, power int64) []byte
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) // validator set ValUpdates []types.ValidatorUpdate // contains filtered or unexported fields }
func NewApplication ¶
func NewApplication() *Application
func (*Application) CheckTx ¶
func (*Application) CheckTx(_ context.Context, req *types.RequestCheckTx) (*types.ResponseCheckTx, error)
func (*Application) Close ¶
func (app *Application) Close() error
func (*Application) Commit ¶
func (app *Application) Commit(_ context.Context) (*types.ResponseCommit, error)
func (*Application) FinalizeBlock ¶
func (app *Application) FinalizeBlock(_ context.Context, req *types.RequestFinalizeBlock) (*types.ResponseFinalizeBlock, error)
func (*Application) Info ¶
func (app *Application) Info(_ context.Context, req *types.RequestInfo) (*types.ResponseInfo, error)
func (*Application) InitChain ¶
func (app *Application) InitChain(_ context.Context, req *types.RequestInitChain) (*types.ResponseInitChain, error)
func (*Application) PrepareProposal ¶
func (app *Application) PrepareProposal(_ context.Context, req *types.RequestPrepareProposal) (*types.ResponsePrepareProposal, error)
func (*Application) ProcessProposal ¶
func (*Application) ProcessProposal(_ context.Context, req *types.RequestProcessProposal) (*types.ResponseProcessProposal, error)
func (*Application) Query ¶
func (app *Application) Query(_ context.Context, reqQuery *types.RequestQuery) (*types.ResponseQuery, error)
Returns an associated value or nil if missing.
func (*Application) Validators ¶
func (app *Application) Validators() (validators []types.ValidatorUpdate)
type PersistentKVStoreApplication ¶
type PersistentKVStoreApplication struct {
*Application
}
func NewPersistentKVStoreApplication ¶
func NewPersistentKVStoreApplication(logger log.Logger, dbDir string) *PersistentKVStoreApplication
func (*PersistentKVStoreApplication) ApplySnapshotChunk ¶
func (app *PersistentKVStoreApplication) ApplySnapshotChunk(_ context.Context, req *types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error)
func (*PersistentKVStoreApplication) OfferSnapshot ¶
func (app *PersistentKVStoreApplication) OfferSnapshot(_ context.Context, req *types.RequestOfferSnapshot) (*types.ResponseOfferSnapshot, error)
Click to show internal directories.
Click to hide internal directories.