kvstore

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

README

KVStore

Basically, see the Tendermint v0.34 KVStore spec.

Documentation

Index

Constants

View Source
const (
	ValidatorSetChangePrefix string = "val:"
)

Variables

View Source
var (
	ProtocolVersion uint64 = 99
)

Functions

func GenDefaultPrivKey

func GenDefaultPrivKey() crypto.PrivKey

GenDefaultPrivKey Generates a default private key for use in an example or test.

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 LoadPrivValidatorKeyFile

func LoadPrivValidatorKeyFile(keyFilePath string) (*privval.FilePVKey, error)

LoadPrivValidatorKeyFile Load private key for use in an example or test.

func MakeValSetChangeTx

func MakeValSetChangeTx(pubkey pc.PublicKey, power int64) []byte

func MakeValSetChangeTxAndMore

func MakeValSetChangeTxAndMore(pubkey pc.PublicKey, power int64) (string, string)

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 {
	ocabci.BaseApplication

	RetainBlocks int64 // blocks to retain after commit (via ResponseCommit.RetainHeight)
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication() *Application

func (*Application) CheckTxAsync

func (app *Application) CheckTxAsync(req types.RequestCheckTx, callback ocabci.CheckTxCallback)

func (*Application) CheckTxSync

func (app *Application) CheckTxSync(req types.RequestCheckTx) ocabci.ResponseCheckTx

func (*Application) Commit

func (app *Application) Commit() types.ResponseCommit

func (*Application) DeliverTx

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 (*PersistentKVStoreApplication) BeginBlock

Track the block hash and header information

func (*PersistentKVStoreApplication) BeginRecheckTx

func (*PersistentKVStoreApplication) CheckTxAsync

func (app *PersistentKVStoreApplication) CheckTxAsync(req types.RequestCheckTx, callback ocabci.CheckTxCallback)

func (*PersistentKVStoreApplication) CheckTxSync

func (*PersistentKVStoreApplication) Commit

Commit will panic if InitChain was not called

func (*PersistentKVStoreApplication) DeliverTx

tx is either "val:pubkey!power" or "key=value" or just arbitrary bytes

func (*PersistentKVStoreApplication) EndBlock

Update the validator set

func (*PersistentKVStoreApplication) EndRecheckTx

func (*PersistentKVStoreApplication) Info

func (*PersistentKVStoreApplication) InitChain

Save the validators in the merkle tree

func (*PersistentKVStoreApplication) ListSnapshots

func (*PersistentKVStoreApplication) LoadSnapshotChunk

func (*PersistentKVStoreApplication) OfferSnapshot

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) SetOption

func (*PersistentKVStoreApplication) Validators

func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate)

type State

type State struct {
	Size    int64  `json:"size"`
	Height  int64  `json:"height"`
	AppHash []byte `json:"app_hash"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL