ycsbTC

package
v1.9.0-tc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT, Apache-2.0 Imports: 18 Imported by: 0

README

ycsbTC

Test Case Description

ycsbTC is based on the YCSB (KVStore) benchmark in BlockBench and is actually a simplified version of the original YCSB benchmark.

For your reference, the original description of YCSB in the SIGMOD paper is like the below:

YCSB is a simple smart contract which functions as a key-value storage. It preloads each store with a number of records, and supports requests with different ratios of read and write operations. YCSB is widely used for evaluating NoSQL databases.

ycsbTC tests a key-value storage, where both key and value are string, by calling set and get functions defined in the KVstore smart contract (kvstore.sol). It provides the following functions for testing:

Function Description
Set Call the set function in the KVstore contract with a randomly chosen but a range-limited key and a random value
Get Call the get function in the KVstore contract with a randomly chosen key, which has the same range as does the key used for the set function
Run Randomly invoke one test function between Set and Get

How to Set the Maximum Number of Keys

The environment variable YCSB_MAX_NUM_KEYS can be used to change the maximum number of keys, whose default value is 100000. For example,

$ YCSB_MAX_NUM_KEYS=200000 ./klayslave ...

Note that the number of keys can affect the performance of this test case because the smart contract's state could be increased depending on the number of different keys.

Source Files

This directory has the following source files.

References

Documentation

Overview

Package ycsbTC implements a simplified YCSB benchmark. See README.md for more details.

Index

Constants

View Source
const KVstoreABI = "" /* 430-byte string literal not displayed */

KVstoreABI is the input ABI used to generate the binding from.

View Source
const KVstoreBin = `` /* 2072-byte string literal not displayed */

KVstoreBin is the compiled bytecode used for deploying new contracts.

View Source
const KVstoreBinRuntime = `` /* 2008-byte string literal not displayed */

KVstoreBinRuntime is the compiled bytecode used for adding genesis block without deploying code.

View Source
const Name = "ycsbTC"

Variables

This section is empty.

Functions

func Get

func Get()

Get tests the get function in the KVstore contract.

func Init

func Init(accs []*account.Account, endpoint string, gp *big.Int)

Init initializes cliPool and accGrp; and also deploys the smart contract.

func Run

func Run()

Run randomly calls one test case.

func Set

func Set()

Set tests the set function in the KVstore contract.

Types

type KVstore

type KVstore struct {
	KVstoreCaller     // Read-only binding to the contract
	KVstoreTransactor // Write-only binding to the contract
	KVstoreFilterer   // Log filterer for contract events
}

KVstore is an auto generated Go binding around an GXP contract.

func DeployKVstore

func DeployKVstore(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *KVstore, error)

DeployKVstore deploys a new GXP contract, binding an instance of KVstore to it.

func NewKVstore

func NewKVstore(address common.Address, backend bind.ContractBackend) (*KVstore, error)

NewKVstore creates a new instance of KVstore, bound to a specific deployed contract.

type KVstoreCaller

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

KVstoreCaller is an auto generated read-only Go binding around an GXP contract.

func NewKVstoreCaller

func NewKVstoreCaller(address common.Address, caller bind.ContractCaller) (*KVstoreCaller, error)

NewKVstoreCaller creates a new read-only instance of KVstore, bound to a specific deployed contract.

func (*KVstoreCaller) Get

func (_KVstore *KVstoreCaller) Get(opts *bind.CallOpts, key string) (string, error)

Get is a free data retrieval call binding the contract method 0x693ec85e.

Solidity: function get(key string) constant returns(string)

type KVstoreCallerRaw

type KVstoreCallerRaw struct {
	Contract *KVstoreCaller // Generic read-only contract binding to access the raw methods on
}

KVstoreCallerRaw is an auto generated low-level read-only Go binding around an GXP contract.

func (*KVstoreCallerRaw) Call

func (_KVstore *KVstoreCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

type KVstoreCallerSession

type KVstoreCallerSession struct {
	Contract *KVstoreCaller // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts  // Call options to use throughout this session
}

KVstoreCallerSession is an auto generated read-only Go binding around an GXP contract, with pre-set call options.

func (*KVstoreCallerSession) Get

func (_KVstore *KVstoreCallerSession) Get(key string) (string, error)

Get is a free data retrieval call binding the contract method 0x693ec85e.

Solidity: function get(key string) constant returns(string)

type KVstoreFilterer

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

KVstoreFilterer is an auto generated log filtering Go binding around an GXP contract events.

func NewKVstoreFilterer

func NewKVstoreFilterer(address common.Address, filterer bind.ContractFilterer) (*KVstoreFilterer, error)

NewKVstoreFilterer creates a new log filterer instance of KVstore, bound to a specific deployed contract.

type KVstoreRaw

type KVstoreRaw struct {
	Contract *KVstore // Generic contract binding to access the raw methods on
}

KVstoreRaw is an auto generated low-level Go binding around an GXP contract.

func (*KVstoreRaw) Call

func (_KVstore *KVstoreRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*KVstoreRaw) Transact

func (_KVstore *KVstoreRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*KVstoreRaw) Transfer

func (_KVstore *KVstoreRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type KVstoreSession

type KVstoreSession struct {
	Contract     *KVstore          // Generic contract binding to set the session for
	CallOpts     bind.CallOpts     // Call options to use throughout this session
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

KVstoreSession is an auto generated Go binding around an GXP contract, with pre-set call and transact options.

func (*KVstoreSession) Get

func (_KVstore *KVstoreSession) Get(key string) (string, error)

Get is a free data retrieval call binding the contract method 0x693ec85e.

Solidity: function get(key string) constant returns(string)

func (*KVstoreSession) Set

func (_KVstore *KVstoreSession) Set(key string, value string) (*types.Transaction, error)

Set is a paid mutator transaction binding the contract method 0xe942b516.

Solidity: function set(key string, value string) returns()

type KVstoreTransactor

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

KVstoreTransactor is an auto generated write-only Go binding around an GXP contract.

func NewKVstoreTransactor

func NewKVstoreTransactor(address common.Address, transactor bind.ContractTransactor) (*KVstoreTransactor, error)

NewKVstoreTransactor creates a new write-only instance of KVstore, bound to a specific deployed contract.

func (*KVstoreTransactor) Set

func (_KVstore *KVstoreTransactor) Set(opts *bind.TransactOpts, key string, value string) (*types.Transaction, error)

Set is a paid mutator transaction binding the contract method 0xe942b516.

Solidity: function set(key string, value string) returns()

type KVstoreTransactorRaw

type KVstoreTransactorRaw struct {
	Contract *KVstoreTransactor // Generic write-only contract binding to access the raw methods on
}

KVstoreTransactorRaw is an auto generated low-level write-only Go binding around an GXP contract.

func (*KVstoreTransactorRaw) Transact

func (_KVstore *KVstoreTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*KVstoreTransactorRaw) Transfer

func (_KVstore *KVstoreTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type KVstoreTransactorSession

type KVstoreTransactorSession struct {
	Contract     *KVstoreTransactor // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts  // Transaction auth options to use throughout this session
}

KVstoreTransactorSession is an auto generated write-only Go binding around an GXP contract, with pre-set transact options.

func (*KVstoreTransactorSession) Set

func (_KVstore *KVstoreTransactorSession) Set(key string, value string) (*types.Transaction, error)

Set is a paid mutator transaction binding the contract method 0xe942b516.

Solidity: function set(key string, value string) returns()

Jump to

Keyboard shortcuts

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