global

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2018 License: LGPL-3.0 Imports: 15 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GenesisTxExecTime = 1 * time.Second

GenesisTxExecTime is the maximum execution time of a transaction in genesis block

View Source
var VoteContractPath = "../../config/"

VoteContractPath is config of vote

Functions

func GenGenesis

func GenGenesis(db db.MVCCDB, witnessInfo []string) (*block.Block, error)

GenGenesis is create a genesis block

Types

type BaseVariable

type BaseVariable interface {
	TxDB() TxDB
	StateDB() db.MVCCDB
	Config() *common.Config
	BlockChain() block.Chain
	WitnessList() []string
	Mode() TMode
	SetMode(m TMode)
}

BaseVariable defines BaseVariable's API.

type BaseVariableImpl

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

BaseVariableImpl is the implementation of BaseVariable

func FakeNew

func FakeNew() (*BaseVariableImpl, error)

FakeNew is fake BaseVariable

func New

func New(conf *common.Config) (*BaseVariableImpl, error)

New return a BaseVariable instance

func (*BaseVariableImpl) BlockChain

func (g *BaseVariableImpl) BlockChain() block.Chain

BlockChain return the block chain

func (*BaseVariableImpl) Config

func (g *BaseVariableImpl) Config() *common.Config

Config return the config

func (*BaseVariableImpl) Mode

func (g *BaseVariableImpl) Mode() TMode

Mode return the mode

func (*BaseVariableImpl) SetMode

func (g *BaseVariableImpl) SetMode(m TMode)

SetMode is set the mode

func (*BaseVariableImpl) StateDB

func (g *BaseVariableImpl) StateDB() db.MVCCDB

StateDB return the state database

func (*BaseVariableImpl) TxDB

func (g *BaseVariableImpl) TxDB() TxDB

TxDB return the transaction database

func (*BaseVariableImpl) WitnessList

func (g *BaseVariableImpl) WitnessList() []string

WitnessList return the witness list

type TMode

type TMode uint

TMode type of mode

const (
	// ModeNormal is normal mode
	ModeNormal TMode = iota
	// ModeSync is sync mode
	ModeSync
	// ModeInit init mode
	ModeInit
)

func (TMode) String

func (m TMode) String() string

String return string of mode

type TxDB

type TxDB interface {
	Push(txs []*tx.Tx, receipts []*tx.TxReceipt) error
	GetTx(hash []byte) (*tx.Tx, error)
	HasTx(hash []byte) (bool, error)
	GetReceipt(Hash []byte) (*tx.TxReceipt, error)
	GetReceiptByTxHash(Hash []byte) (*tx.TxReceipt, error)
	HasReceipt(hash []byte) (bool, error)
	Close()
}

TxDB defines the functions of tx database.

func NewTxDB

func NewTxDB(path string) (TxDB, error)

NewTxDB returns a TxDB instance.

type TxDBImpl

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

TxDBImpl is the implementation of TxDB.

func (*TxDBImpl) Close

func (tdb *TxDBImpl) Close()

Close is close database

func (*TxDBImpl) GetReceipt

func (tdb *TxDBImpl) GetReceipt(hash []byte) (*tx.TxReceipt, error)

GetReceipt gets receipt with receipt's hash

func (*TxDBImpl) GetReceiptByTxHash

func (tdb *TxDBImpl) GetReceiptByTxHash(hash []byte) (*tx.TxReceipt, error)

GetReceiptByTxHash gets receipt with tx's hash

func (*TxDBImpl) GetTx

func (tdb *TxDBImpl) GetTx(hash []byte) (*tx.Tx, error)

GetTx gets tx with tx's hash.

func (*TxDBImpl) HasReceipt

func (tdb *TxDBImpl) HasReceipt(hash []byte) (bool, error)

HasReceipt checks if database has receipt.

func (*TxDBImpl) HasTx

func (tdb *TxDBImpl) HasTx(hash []byte) (bool, error)

HasTx checks if database has tx.

func (*TxDBImpl) Push

func (tdb *TxDBImpl) Push(txs []*tx.Tx, receipts []*tx.TxReceipt) error

Push save the tx to database

Jump to

Keyboard shortcuts

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