chain_plugins

package
v2.9.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: GPL-3.0 Imports: 22 Imported by: 4

Documentation

Index

Constants

View Source
const (
	OnRoadInfoKeyPrefix = byte(1)

	DiffTokenHash = byte(2)
)

Variables

This section is empty.

Functions

func CreateOnRoadInfoKey

func CreateOnRoadInfoKey(addr *types.Address, tId *types.TokenTypeId) []byte

func CreateOnRoadInfoPrefixKey

func CreateOnRoadInfoPrefixKey(addr *types.Address) []byte

Types

type Chain

type Chain interface {
	Flusher() *chain_flusher.Flusher
	GetLatestSnapshotBlock() *ledger.SnapshotBlock
	GetSnapshotBlocksByHeight(height uint64, higher bool, count uint64) ([]*ledger.SnapshotBlock, error)
	GetSubLedgerAfterHeight(height uint64) ([]*ledger.SnapshotChunk, error)
	GetSubLedger(startHeight, endHeight uint64) ([]*ledger.SnapshotChunk, error)
	GetAccountBlockByHash(blockHash types.Hash) (*ledger.AccountBlock, error)

	IsAccountBlockExisted(hash types.Hash) (bool, error)
	IsGenesisAccountBlock(hash types.Hash) bool

	GetAllUnconfirmedBlocks() []*ledger.AccountBlock

	LoadAllOnRoad() (map[types.Address][]types.Hash, error)
}

type FilterToken

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

func (*FilterToken) DeleteAccountBlocks

func (ft *FilterToken) DeleteAccountBlocks(batch *leveldb.Batch, accountBlocks []*ledger.AccountBlock) error

func (*FilterToken) DeleteSnapshotBlocks

func (ft *FilterToken) DeleteSnapshotBlocks(batch *leveldb.Batch, chunks []*ledger.SnapshotChunk) error

func (*FilterToken) GetBlocks

func (ft *FilterToken) GetBlocks(addr types.Address, tokenId types.TokenTypeId, blockHash *types.Hash, count uint64) ([]*ledger.AccountBlock, error)

func (*FilterToken) InsertAccountBlock

func (ft *FilterToken) InsertAccountBlock(batch *leveldb.Batch, accountBlock *ledger.AccountBlock) error

func (*FilterToken) InsertSnapshotBlock

func (ft *FilterToken) InsertSnapshotBlock(batch *leveldb.Batch, snapshotBlock *ledger.SnapshotBlock, confirmedBlocks []*ledger.AccountBlock) error

func (*FilterToken) RemoveNewUnconfirmed

func (ft *FilterToken) RemoveNewUnconfirmed(*leveldb.Batch, []*ledger.AccountBlock) error

func (*FilterToken) SetStore

func (ft *FilterToken) SetStore(store *chain_db.Store)

type OnRoadInfo

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

func (*OnRoadInfo) DeleteAccountBlocks

func (or *OnRoadInfo) DeleteAccountBlocks(batch *leveldb.Batch, blocks []*ledger.AccountBlock) error

func (*OnRoadInfo) DeleteSnapshotBlocks

func (or *OnRoadInfo) DeleteSnapshotBlocks(batch *leveldb.Batch, chunks []*ledger.SnapshotChunk) error

func (*OnRoadInfo) GetAccountInfo

func (or *OnRoadInfo) GetAccountInfo(addr *types.Address) (*ledger.AccountInfo, error)

func (*OnRoadInfo) GetOnRoadInfoUnconfirmedHashList

func (or *OnRoadInfo) GetOnRoadInfoUnconfirmedHashList(addr types.Address) ([]*types.Hash, error)

func (*OnRoadInfo) InsertAccountBlock

func (or *OnRoadInfo) InsertAccountBlock(batch *leveldb.Batch, block *ledger.AccountBlock) error

func (*OnRoadInfo) InsertSnapshotBlock

func (or *OnRoadInfo) InsertSnapshotBlock(batch *leveldb.Batch, snapshotBlock *ledger.SnapshotBlock, confirmedBlocks []*ledger.AccountBlock) error

func (*OnRoadInfo) RemoveFromUnconfirmedCache

func (or *OnRoadInfo) RemoveFromUnconfirmedCache(addr types.Address, hashList []*types.Hash) error

func (*OnRoadInfo) RemoveNewUnconfirmed

func (or *OnRoadInfo) RemoveNewUnconfirmed(rollbackBatch *leveldb.Batch, allUnconfirmedBlocks []*ledger.AccountBlock) error

func (*OnRoadInfo) SetStore

func (or *OnRoadInfo) SetStore(store *chain_db.Store)

func (*OnRoadInfo) UpdateOnRoadInfo

func (or *OnRoadInfo) UpdateOnRoadInfo(addr types.Address, tkId types.TokenTypeId, number uint64, amount big.Int) error

type Plugin

type Plugin interface {
	SetStore(store *chain_db.Store)

	InsertAccountBlock(*leveldb.Batch, *ledger.AccountBlock) error

	InsertSnapshotBlock(*leveldb.Batch, *ledger.SnapshotBlock, []*ledger.AccountBlock) error

	DeleteAccountBlocks(*leveldb.Batch, []*ledger.AccountBlock) error

	DeleteSnapshotBlocks(*leveldb.Batch, []*ledger.SnapshotChunk) error

	RemoveNewUnconfirmed(*leveldb.Batch, []*ledger.AccountBlock) error
}

type Plugins

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

func NewPlugins

func NewPlugins(chainDir string, chain Chain) (*Plugins, error)

func (*Plugins) Close

func (p *Plugins) Close() error

func (*Plugins) DeleteAccountBlocks

func (p *Plugins) DeleteAccountBlocks(blocks []*ledger.AccountBlock) error

func (*Plugins) DeleteSnapshotBlocks

func (p *Plugins) DeleteSnapshotBlocks(chunks []*ledger.SnapshotChunk) error

func (*Plugins) GetPlugin

func (p *Plugins) GetPlugin(name string) Plugin

func (*Plugins) InsertAccountBlocks

func (p *Plugins) InsertAccountBlocks(blocks []*vm_db.VmAccountBlock) error

func (*Plugins) InsertSnapshotBlocks

func (p *Plugins) InsertSnapshotBlocks(chunks []*ledger.SnapshotChunk) error

func (*Plugins) PrepareDeleteAccountBlocks

func (p *Plugins) PrepareDeleteAccountBlocks(blocks []*ledger.AccountBlock) error

func (*Plugins) PrepareDeleteSnapshotBlocks

func (p *Plugins) PrepareDeleteSnapshotBlocks(chunks []*ledger.SnapshotChunk) error

func (*Plugins) PrepareInsertAccountBlocks

func (p *Plugins) PrepareInsertAccountBlocks(vmBlocks []*vm_db.VmAccountBlock) error

func (*Plugins) PrepareInsertSnapshotBlocks

func (p *Plugins) PrepareInsertSnapshotBlocks(chunks []*ledger.SnapshotChunk) error

func (*Plugins) RebuildData

func (p *Plugins) RebuildData() error

func (*Plugins) RemovePlugin

func (p *Plugins) RemovePlugin(name string)

func (*Plugins) StartWrite

func (p *Plugins) StartWrite()

func (*Plugins) StopWrite

func (p *Plugins) StopWrite()

func (*Plugins) Store

func (p *Plugins) Store() *chain_db.Store

Jump to

Keyboard shortcuts

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