ledgerstore

package
v0.0.0-...-c8e9c26 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2018 License: LGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCK_CAHE_SIZE        = 1000
	TRANSACTION_CACHE_SIZE = 100000
)
View Source
const (
	SYSTEM_VERSION          = byte(1)
	HEADER_INDEX_BATCH_SIZE = uint32(2000)
	BLOCK_CACHE_TIMEOUT     = time.Minute * 30
	MAX_BLOCK_CACHE_SIZE    = 2000
)
View Source
const (
	INVOKE_TRANSACTION = "InvokeTransaction"
)
View Source
const (
	STATE_CACHE_SIZE = 100000
)

Variables

View Source
var (
	DBDirEvent          = "Chain/ledgerevent"
	DBDirBlock          = "Chain/block"
	DBDirState          = "Chain/states"
	MerkleTreeStorePath = "Chain/merkle_tree.db"
)
View Source
var (
	CurrentStateRoot = []byte("Current-State-Root")
	BookerKeeper     = []byte("Booker-Keeper")
)

Functions

This section is empty.

Types

type BlockCache

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

func NewBlockCache

func NewBlockCache() (*BlockCache, error)

func (*BlockCache) AddBlock

func (this *BlockCache) AddBlock(block *types.Block)

func (*BlockCache) AddTransaction

func (this *BlockCache) AddTransaction(tx *types.Transaction, height uint32)

func (*BlockCache) ContainBlock

func (this *BlockCache) ContainBlock(blockHash common.Uint256) bool

func (*BlockCache) ContainTransaction

func (this *BlockCache) ContainTransaction(txHash common.Uint256) bool

func (*BlockCache) GetBlock

func (this *BlockCache) GetBlock(blockHash common.Uint256) *types.Block

func (*BlockCache) GetTransaction

func (this *BlockCache) GetTransaction(txHash common.Uint256) (*types.Transaction, uint32)

type BlockStore

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

func NewBlockStore

func NewBlockStore(dbDir string, enableCache bool) (*BlockStore, error)

func (*BlockStore) ClearAll

func (this *BlockStore) ClearAll() error

func (*BlockStore) Close

func (this *BlockStore) Close() error

func (*BlockStore) CommitTo

func (this *BlockStore) CommitTo() error

func (*BlockStore) ContainBlock

func (this *BlockStore) ContainBlock(blockHash common.Uint256) (bool, error)

func (*BlockStore) ContainTransaction

func (this *BlockStore) ContainTransaction(txHash common.Uint256) (bool, error)

func (*BlockStore) GetBlock

func (this *BlockStore) GetBlock(blockHash common.Uint256) (*types.Block, error)

func (*BlockStore) GetBlockHash

func (this *BlockStore) GetBlockHash(height uint32) (common.Uint256, error)

func (*BlockStore) GetCurrentBlock

func (this *BlockStore) GetCurrentBlock() (common.Uint256, uint32, error)

func (*BlockStore) GetHeader

func (this *BlockStore) GetHeader(blockHash common.Uint256) (*types.Header, error)

func (*BlockStore) GetHeaderIndexList

func (this *BlockStore) GetHeaderIndexList() (map[uint32]common.Uint256, error)

func (*BlockStore) GetSysFeeAmount

func (this *BlockStore) GetSysFeeAmount(blockHash common.Uint256) (common.Fixed64, error)

func (*BlockStore) GetTransaction

func (this *BlockStore) GetTransaction(txHash common.Uint256) (*types.Transaction, uint32, error)

func (*BlockStore) GetVersion

func (this *BlockStore) GetVersion() (byte, error)

func (*BlockStore) NewBatch

func (this *BlockStore) NewBatch()

func (*BlockStore) SaveBlock

func (this *BlockStore) SaveBlock(block *types.Block) error

func (*BlockStore) SaveBlockHash

func (this *BlockStore) SaveBlockHash(height uint32, blockHash common.Uint256)

func (*BlockStore) SaveCurrentBlock

func (this *BlockStore) SaveCurrentBlock(height uint32, blockHash common.Uint256) error

func (*BlockStore) SaveHeader

func (this *BlockStore) SaveHeader(block *types.Block, sysFee common.Fixed64) error

func (*BlockStore) SaveHeaderIndexList

func (this *BlockStore) SaveHeaderIndexList(startIndex uint32, indexList []common.Uint256) error

func (*BlockStore) SaveTransaction

func (this *BlockStore) SaveTransaction(tx *types.Transaction, height uint32) error

func (*BlockStore) SaveVersion

func (this *BlockStore) SaveVersion(ver byte) error

type CacheCodeTable

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

func (*CacheCodeTable) GetCode

func (table *CacheCodeTable) GetCode(codeHash []byte) ([]byte, error)

type EventStore

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

func NewEventStore

func NewEventStore(dbDir string) (*EventStore, error)

func (*EventStore) ClearAll

func (this *EventStore) ClearAll() error

func (*EventStore) Close

func (this *EventStore) Close() error

func (*EventStore) CommitTo

func (this *EventStore) CommitTo() error

func (*EventStore) GetCurrentBlock

func (this *EventStore) GetCurrentBlock() (common.Uint256, uint32, error)

func (*EventStore) GetEventNotifyByBlock

func (this *EventStore) GetEventNotifyByBlock(height uint32) ([]common.Uint256, error)

func (*EventStore) GetEventNotifyByTx

func (this *EventStore) GetEventNotifyByTx(txHash common.Uint256) ([]*event.NotifyEventInfo, error)

func (*EventStore) NewBatch

func (this *EventStore) NewBatch()

func (*EventStore) SaveCurrentBlock

func (this *EventStore) SaveCurrentBlock(height uint32, blockHash common.Uint256) error

func (*EventStore) SaveEventNotifyByBlock

func (this *EventStore) SaveEventNotifyByBlock(height uint32, txHashs []common.Uint256) error

func (*EventStore) SaveEventNotifyByTx

func (this *EventStore) SaveEventNotifyByTx(txHash common.Uint256, notifies []*event.NotifyEventInfo) error

type LedgerStoreImp

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

func NewLedgerStore

func NewLedgerStore() (*LedgerStoreImp, error)

func (*LedgerStoreImp) AddBlock

func (this *LedgerStoreImp) AddBlock(block *types.Block) error

func (*LedgerStoreImp) AddHeader

func (this *LedgerStoreImp) AddHeader(header *types.Header) error

sync block header

func (*LedgerStoreImp) AddHeaders

func (this *LedgerStoreImp) AddHeaders(headers []*types.Header) error

func (*LedgerStoreImp) Close

func (this *LedgerStoreImp) Close() error

func (*LedgerStoreImp) GetBlockByHash

func (this *LedgerStoreImp) GetBlockByHash(blockHash common.Uint256) (*types.Block, error)

func (*LedgerStoreImp) GetBlockByHeight

func (this *LedgerStoreImp) GetBlockByHeight(height uint32) (*types.Block, error)

func (*LedgerStoreImp) GetBlockHash

func (this *LedgerStoreImp) GetBlockHash(height uint32) common.Uint256

func (*LedgerStoreImp) GetBlockRootWithNewTxRoot

func (this *LedgerStoreImp) GetBlockRootWithNewTxRoot(txRoot common.Uint256) common.Uint256

func (*LedgerStoreImp) GetBookkeeperState

func (this *LedgerStoreImp) GetBookkeeperState() (*states.BookkeeperState, error)

func (*LedgerStoreImp) GetContractState

func (this *LedgerStoreImp) GetContractState(contractHash common.Address) (*payload.DeployCode, error)

func (*LedgerStoreImp) GetCurrentBlock

func (this *LedgerStoreImp) GetCurrentBlock() (uint32, common.Uint256)

func (*LedgerStoreImp) GetCurrentBlockHash

func (this *LedgerStoreImp) GetCurrentBlockHash() common.Uint256

func (*LedgerStoreImp) GetCurrentBlockHeight

func (this *LedgerStoreImp) GetCurrentBlockHeight() uint32

func (*LedgerStoreImp) GetCurrentHeaderHash

func (this *LedgerStoreImp) GetCurrentHeaderHash() common.Uint256

func (*LedgerStoreImp) GetCurrentHeaderHeight

func (this *LedgerStoreImp) GetCurrentHeaderHeight() uint32

func (*LedgerStoreImp) GetEventNotifyByBlock

func (this *LedgerStoreImp) GetEventNotifyByBlock(height uint32) ([]common.Uint256, error)

func (*LedgerStoreImp) GetEventNotifyByTx

func (this *LedgerStoreImp) GetEventNotifyByTx(tx common.Uint256) ([]*event.NotifyEventInfo, error)

func (*LedgerStoreImp) GetHeaderByHash

func (this *LedgerStoreImp) GetHeaderByHash(blockHash common.Uint256) (*types.Header, error)

func (*LedgerStoreImp) GetHeaderByHeight

func (this *LedgerStoreImp) GetHeaderByHeight(height uint32) (*types.Header, error)

func (*LedgerStoreImp) GetStorageItem

func (this *LedgerStoreImp) GetStorageItem(key *states.StorageKey) (*states.StorageItem, error)

func (*LedgerStoreImp) GetSysFeeAmount

func (this *LedgerStoreImp) GetSysFeeAmount(blockHash common.Uint256) (common.Fixed64, error)

func (*LedgerStoreImp) GetTransaction

func (this *LedgerStoreImp) GetTransaction(txHash common.Uint256) (*types.Transaction, uint32, error)

func (*LedgerStoreImp) InitLedgerStoreWithGenesisBlock

func (this *LedgerStoreImp) InitLedgerStoreWithGenesisBlock(genesisBlock *types.Block, defaultBookkeeper []keypair.PublicKey) error

func (*LedgerStoreImp) IsContainBlock

func (this *LedgerStoreImp) IsContainBlock(blockHash common.Uint256) (bool, error)

func (*LedgerStoreImp) IsContainTransaction

func (this *LedgerStoreImp) IsContainTransaction(txHash common.Uint256) (bool, error)

func (*LedgerStoreImp) PreExecuteContract

func (this *LedgerStoreImp) PreExecuteContract(tx *types.Transaction) ([]interface{}, error)

type StateCache

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

func NewStateCache

func NewStateCache() (*StateCache, error)

func (*StateCache) AddState

func (this *StateCache) AddState(key []byte, state states.StateValue)

func (*StateCache) DeleteState

func (this *StateCache) DeleteState(key []byte)

func (*StateCache) GetState

func (this *StateCache) GetState(key []byte) states.StateValue

type StateStore

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

func NewStateStore

func NewStateStore(dbDir, merklePath string) (*StateStore, error)

func (*StateStore) AddMerkleTreeRoot

func (this *StateStore) AddMerkleTreeRoot(txRoot common.Uint256) error

func (*StateStore) ClearAll

func (this *StateStore) ClearAll() error

func (*StateStore) Close

func (this *StateStore) Close() error

func (*StateStore) CommitTo

func (this *StateStore) CommitTo() error

func (*StateStore) GetBlockRootWithNewTxRoot

func (this *StateStore) GetBlockRootWithNewTxRoot(txRoot common.Uint256) common.Uint256

func (*StateStore) GetBookkeeperState

func (this *StateStore) GetBookkeeperState() (*states.BookkeeperState, error)

func (*StateStore) GetContractState

func (this *StateStore) GetContractState(contractHash common.Address) (*payload.DeployCode, error)

func (*StateStore) GetCurrentBlock

func (this *StateStore) GetCurrentBlock() (common.Uint256, uint32, error)

func (*StateStore) GetMerkleTree

func (this *StateStore) GetMerkleTree() (uint32, []common.Uint256, error)

func (*StateStore) GetStorageState

func (this *StateStore) GetStorageState(key *states.StorageKey) (*states.StorageItem, error)

func (*StateStore) GetVoteStates

func (this *StateStore) GetVoteStates() (map[common.Address]*states.VoteState, error)

func (*StateStore) HandleClaimTransaction

func (this *StateStore) HandleClaimTransaction(stateBatch *statestore.StateBatch, tx *types.Transaction) error

func (*StateStore) HandleDeployTransaction

func (this *StateStore) HandleDeployTransaction(stateBatch *statestore.StateBatch, tx *types.Transaction) error

func (*StateStore) HandleInvokeTransaction

func (this *StateStore) HandleInvokeTransaction(store store.LedgerStore, stateBatch *statestore.StateBatch, tx *types.Transaction, block *types.Block, eventStore scommon.EventStore) error

func (*StateStore) HandleVoteTransaction

func (this *StateStore) HandleVoteTransaction(stateBatch *statestore.StateBatch, tx *types.Transaction) error

func (*StateStore) NewBatch

func (this *StateStore) NewBatch()

func (*StateStore) NewStateBatch

func (this *StateStore) NewStateBatch() *statestore.StateBatch

func (*StateStore) SaveBookkeeperState

func (this *StateStore) SaveBookkeeperState(bookkeeperState *states.BookkeeperState) error

func (*StateStore) SaveCurrentBlock

func (this *StateStore) SaveCurrentBlock(height uint32, blockHash common.Uint256) error

type TransactionCacheaValue

type TransactionCacheaValue struct {
	Tx     *types.Transaction
	Height uint32
}

Jump to

Keyboard shortcuts

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