Documentation
¶
Index ¶
- Constants
- Variables
- func Close()
- func CurrentBlockNum() *big.Int
- func GetContractTransaction(txHash string) (*types.LKTransaction, error)
- func GetLKTransaction(txType, txHash string) ([]*types.LKTransaction, error)
- func GetLKTransactionsByBlock(txType string, num *big.Int) ([]*types.LKTransaction, error)
- func GetSuicideTransaction(txHash string) (*types.LKTransaction, error)
- func Init(file string) error
- func PutLKTransaction(lkx *types.LKTransaction) error
- func UpdateBlockNum(num *big.Int)
- type Batch
- type Database
- type EthTransactionGas
- type LDatabase
- func (db *LDatabase) Close()
- func (db *LDatabase) Delete(key []byte) error
- func (db *LDatabase) Get(key []byte) ([]byte, error)
- func (db *LDatabase) Has(key []byte) (bool, error)
- func (db *LDatabase) LDB() *leveldb.DB
- func (db *LDatabase) NewBatch() Batch
- func (db *LDatabase) NewIterator() iterator.Iterator
- func (db *LDatabase) Path() string
- func (db *LDatabase) Put(key []byte, value []byte) error
- type Putter
- type TxBatch
Constants ¶
const IdealBatchSize = 100 * 1024
Code using batches should try to add this much data to the batch. The value was determined empirically.
Variables ¶
var (
ErrLDBNil = errors.New("LDB nil")
)
var OpenFileLimit = 64
Functions ¶
func GetContractTransaction ¶
func GetContractTransaction(txHash string) (*types.LKTransaction, error)
GetContractTransaction read Contract Transaction
func GetLKTransaction ¶
func GetLKTransaction(txType, txHash string) ([]*types.LKTransaction, error)
GetLKTransaction get internal Transaction.
func GetLKTransactionsByBlock ¶
GetLKTransactionsByBlock get internal Transaction by Block number.
func GetSuicideTransaction ¶
func GetSuicideTransaction(txHash string) (*types.LKTransaction, error)
GetSuicideTransaction query SuicideTransaction
func PutLKTransaction ¶
func PutLKTransaction(lkx *types.LKTransaction) error
PutLKTransaction put internal Transaction.
func UpdateBlockNum ¶
UpdateBlockNum Update BlockNum for db record after BeginBlock.
Types ¶
type Batch ¶
Batch is a write-only database that commits changes to its host database when Write is called. Batch cannot be used concurrently.
func NewTableBatch ¶
NewTableBatch returns a Batch object which prefixes all keys with a given string.
type Database ¶
type Database interface { Putter Get(key []byte) ([]byte, error) Has(key []byte) (bool, error) Delete(key []byte) error Close() NewBatch() Batch }
Database wraps all database operations. All methods are safe for concurrent use.
type EthTransactionGas ¶
type EthTransactionGas struct { GasLimit *big.Int `json:"gas_limit"` GasUsed *big.Int `json:"gas_used"` GasPrice *big.Int `json:"gas_price"` BlockNum *big.Int `json:"block_num"` // Result: 0(success), others(fail, details come with Errmsg field) Ret int `json:"ret"` Errmsg string `json:"errmsg"` }
func GetEthTransactionGas ¶
func GetEthTransactionGas(txHash string) (*EthTransactionGas, error)
GetEthTransactionGas query Gas Info of Ethereum Transaction.
type LDatabase ¶
type LDatabase struct {
// contains filtered or unexported fields
}
func NewLDatabase ¶
NewLDatabase returns a LevelDB wrapped object.
func (*LDatabase) NewIterator ¶
type Putter ¶
Putter wraps the database write operation supported by both batches and regular databases.