chain_cache

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFragHeadHeightFromDbKey

func GetFragHeadHeightFromDbKey(dbKey []byte) uint64

func GetFragTailHeightFromDbKey

func GetFragTailHeightFromDbKey(dbKey []byte) uint64

func NewAccountTypeCache added in v1.3.0

func NewAccountTypeCache()

Types

type AdditionItem

type AdditionItem struct {
	Quota              uint64
	AggregateQuota     uint64
	SnapshotHashHeight *ledger.HashHeight
}

func (*AdditionItem) DeProto

func (ai *AdditionItem) DeProto(pb *vitepb.SnapshotAdditionalItem)

func (*AdditionItem) Proto

type AdditionList

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

func NewAdditionList

func NewAdditionList(chain Chain) (*AdditionList, error)

func (*AdditionList) Add

func (al *AdditionList) Add(block *ledger.SnapshotBlock, quota uint64)

func (*AdditionList) DeleteStartWith

func (al *AdditionList) DeleteStartWith(batch *leveldb.Batch, block *ledger.SnapshotBlock) error

func (*AdditionList) GetAggregateQuota

func (al *AdditionList) GetAggregateQuota(block *ledger.SnapshotBlock) (uint64, error)

func (*AdditionList) Start

func (al *AdditionList) Start()

func (*AdditionList) Stop

func (al *AdditionList) Stop()

type Chain

type Chain interface {
	GetUnConfirmedSubLedger() (map[types.Address][]*ledger.AccountBlock, error)
	GetUnConfirmedPartSubLedger(addrList []types.Address) (map[types.Address][]*ledger.AccountBlock, error)
	GetLatestSnapshotBlock() *ledger.SnapshotBlock
	GetConfirmSubLedgerBySnapshotBlocks(snapshotBlocks []*ledger.SnapshotBlock) (map[types.Address][]*ledger.AccountBlock, error)
	GetSnapshotBlocksByHeight(height uint64, count uint64, forward, containSnapshotContent bool) ([]*ledger.SnapshotBlock, error)

	ChainDb() *chain_db.ChainDb
}

type Fragment

type Fragment struct {
	HeadHeight uint64
	TailHeight uint64
	List       []*AdditionItem
}

func (*Fragment) Deserialize

func (frag *Fragment) Deserialize(buf []byte) error

func (*Fragment) GetDbKey

func (frag *Fragment) GetDbKey() []byte

func (*Fragment) Serialize

func (frag *Fragment) Serialize() ([]byte, error)

type NeedSnapshotBlock

type NeedSnapshotBlock struct {
	Block           *ledger.AccountBlock
	AccumulateQuota uint64
}

type NeedSnapshotCache

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

func NewNeedSnapshotCache

func NewNeedSnapshotCache(chain Chain) *NeedSnapshotCache

func (*NeedSnapshotCache) Build

func (nsCache *NeedSnapshotCache) Build()

func (*NeedSnapshotCache) GetBlockByHash

func (nsCache *NeedSnapshotCache) GetBlockByHash(addr types.Address, hashHeight *ledger.HashHeight) *ledger.AccountBlock

func (*NeedSnapshotCache) GetSnapshotContent

func (nsCache *NeedSnapshotCache) GetSnapshotContent() ledger.SnapshotContent

func (*NeedSnapshotCache) HasSnapshot

func (nsCache *NeedSnapshotCache) HasSnapshot(subLedger ledger.SnapshotContent) (uint64, error)

func (*NeedSnapshotCache) InsertAccountBlock

func (nsCache *NeedSnapshotCache) InsertAccountBlock(block *ledger.AccountBlock) error

func (*NeedSnapshotCache) NeedReSnapshot

func (nsCache *NeedSnapshotCache) NeedReSnapshot(subLedger map[types.Address][]*ledger.AccountBlock) error

func (*NeedSnapshotCache) NotSnapshot

func (nsCache *NeedSnapshotCache) NotSnapshot(horizontalLine map[types.Address]*ledger.AccountBlock)

Jump to

Keyboard shortcuts

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