ycsbcosmoskvstore

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 29 Imported by: 0

README

ycsbcosmoskvstore

Use this with go-ycsb https://github.com/pingcap/go-ycsb.

Download go-ycsb

cd go-ycsb
vim ./cmd/go-ycsb/main.go

Add this line in the import section:

_ "github.com/vittoriocapocasale/ycsbcosmoskvstore"

Close the editor and compile.

make
./bin/go-ycsb load kvstore -P workloads/workda

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSign added in v0.0.3

func BuildSign(chainID string, acc *Account, msgs []sdk.Msg) ([]byte, error)

func BuildSignBroadcast

func BuildSignBroadcast(chainID string, acc *Account, conn *grpc.ClientConn, msgs []sdk.Msg) error

func BuildTransaction

func BuildTransaction(txConfig *client.TxConfig, msgs []sdk.Msg) (*client.TxBuilder, error)

func NewConnection

func NewConnection(url string) (*grpc.ClientConn, error)

func ParseAccounts

func ParseAccounts(file string) []string

func PrepareTransaction

func PrepareTransaction() *client.TxConfig

func SendBytesAsync added in v0.0.3

func SendBytesAsync(conn *grpc.ClientConn, txBytes []byte) error

func SendTransactionAsync

func SendTransactionAsync(conn *grpc.ClientConn, txConfig *client.TxConfig, txBuilder *client.TxBuilder) error

func SignTransaction

func SignTransaction(chainID string, acc *Account, txConfig *client.TxConfig, txBuilder *client.TxBuilder) error

Types

type Account

type Account struct {
	PrKey cryptotypes.PrivKey
	// contains filtered or unexported fields
}

func NewAccount

func NewAccount(hexKey string, prefix string, accNum uint64, accSeq uint64) *Account

func (*Account) GetAccNum

func (acc *Account) GetAccNum() uint64

func (*Account) GetAccSeq

func (acc *Account) GetAccSeq() uint64

func (*Account) GetAddress

func (acc *Account) GetAddress() string

func (*Account) GetPrKey

func (acc *Account) GetPrKey() cryptotypes.PrivKey

func (*Account) GetPubKey

func (acc *Account) GetPubKey() cryptotypes.PubKey

func (*Account) IncreaseAccSeq

func (acc *Account) IncreaseAccSeq()

func (*Account) QueryInfo

func (acc *Account) QueryInfo(conn *grpc.ClientConn)

type Handler

type Handler interface {
	Handle([]byte)
}

type MyHandler

type MyHandler struct{}

func NewMyHandler

func NewMyHandler() *MyHandler

func (*MyHandler) Handle

func (mh *MyHandler) Handle(msg []byte)

type RPCResp

type RPCResp struct {
	Jsonrpc string `json:"jsonrpc"`
	ID      int    `json:"id"`
	Result  struct {
		Query string `json:"query"`
		Data  struct {
			Type  string `json:"type"`
			Value struct {
				Block struct {
					Header struct {
						Version struct {
							Block string `json:"block"`
						} `json:"version"`
						ChainID     string    `json:"chain_id"`
						Height      string    `json:"height"`
						Time        time.Time `json:"time"`
						LastBlockID struct {
							Hash  string `json:"hash"`
							Parts struct {
								Total int    `json:"total"`
								Hash  string `json:"hash"`
							} `json:"parts"`
						} `json:"last_block_id"`
						LastCommitHash     string `json:"last_commit_hash"`
						DataHash           string `json:"data_hash"`
						ValidatorsHash     string `json:"validators_hash"`
						NextValidatorsHash string `json:"next_validators_hash"`
						ConsensusHash      string `json:"consensus_hash"`
						AppHash            string `json:"app_hash"`
						LastResultsHash    string `json:"last_results_hash"`
						EvidenceHash       string `json:"evidence_hash"`
						ProposerAddress    string `json:"proposer_address"`
					} `json:"header"`
					Data struct {
						Txs []string `json:"txs"`
					} `json:"data"`
					Evidence struct {
						Evidence []interface{} `json:"evidence"`
					} `json:"evidence"`
					LastCommit struct {
						Height  string `json:"height"`
						Round   int    `json:"round"`
						BlockID struct {
							Hash  string `json:"hash"`
							Parts struct {
								Total int    `json:"total"`
								Hash  string `json:"hash"`
							} `json:"parts"`
						} `json:"block_id"`
						Signatures []struct {
							BlockIDFlag      int       `json:"block_id_flag"`
							ValidatorAddress string    `json:"validator_address"`
							Timestamp        time.Time `json:"timestamp"`
							Signature        string    `json:"signature"`
						} `json:"signatures"`
					} `json:"last_commit"`
				} `json:"block"`
				ResultBeginBlock struct {
					Events []struct {
						Type       string `json:"type"`
						Attributes []struct {
							Key   string `json:"key"`
							Value string `json:"value"`
							Index bool   `json:"index"`
						} `json:"attributes"`
					} `json:"events"`
				} `json:"result_begin_block"`
				ResultEndBlock struct {
					ValidatorUpdates      []interface{} `json:"validator_updates"`
					ConsensusParamUpdates struct {
						Block struct {
							MaxBytes string `json:"max_bytes"`
							MaxGas   string `json:"max_gas"`
						} `json:"block"`
						Evidence struct {
							MaxAgeNumBlocks string `json:"max_age_num_blocks"`
							MaxAgeDuration  string `json:"max_age_duration"`
							MaxBytes        string `json:"max_bytes"`
						} `json:"evidence"`
						Validator struct {
							PubKeyTypes []string `json:"pub_key_types"`
						} `json:"validator"`
					} `json:"consensus_param_updates"`
					Events []interface{} `json:"events"`
				} `json:"result_end_block"`
			} `json:"value"`
		} `json:"data"`
		Events struct {
			CoinReceivedAmount      []string `json:"coin_received.amount"`
			CoinSpentSpender        []string `json:"coin_spent.spender"`
			TransferAmount          []string `json:"transfer.amount"`
			MintInflation           []string `json:"mint.inflation"`
			MintAnnualProvisions    []string `json:"mint.annual_provisions"`
			CoinbaseMinter          []string `json:"coinbase.minter"`
			MessageSender           []string `json:"message.sender"`
			MintBondedRatio         []string `json:"mint.bonded_ratio"`
			MintAmount              []string `json:"mint.amount"`
			CommissionAmount        []string `json:"commission.amount"`
			CommissionValidator     []string `json:"commission.validator"`
			TmEvent                 []string `json:"tm.event"`
			CoinbaseAmount          []string `json:"coinbase.amount"`
			CoinSpentAmount         []string `json:"coin_spent.amount"`
			TransferRecipient       []string `json:"transfer.recipient"`
			RewardsAmount           []string `json:"rewards.amount"`
			RewardsValidator        []string `json:"rewards.validator"`
			CoinReceivedReceiver    []string `json:"coin_received.receiver"`
			TransferSender          []string `json:"transfer.sender"`
			ProposerRewardAmount    []string `json:"proposer_reward.amount"`
			ProposerRewardValidator []string `json:"proposer_reward.validator"`
		} `json:"events"`
	} `json:"result"`
}

type TMConn

type TMConn struct {
	// contains filtered or unexported fields
}

func NewTMConnect

func NewTMConnect(hostnport string, path string) *TMConn

func (*TMConn) BlockSubscribe

func (tm *TMConn) BlockSubscribe(handler Handler) error

func (*TMConn) Close

func (tm *TMConn) Close()

func (*TMConn) UnsubscribeAll

func (tm *TMConn) UnsubscribeAll() error

Directories

Path Synopsis
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

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