chain_cache

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDataSet

func NewDataSet() *dataSet

Types

type Cache

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

func NewCache

func NewCache(chain Chain) (*Cache, error)

func (*Cache) Destroy

func (cache *Cache) Destroy()

func (*Cache) GetAccountBlockByHash

func (cache *Cache) GetAccountBlockByHash(hash types.Hash) *ledger.AccountBlock

func (*Cache) GetAccountBlockByHeight

func (cache *Cache) GetAccountBlockByHeight(addr types.Address, height uint64) *ledger.AccountBlock

func (*Cache) GetGlobalQuota

func (cache *Cache) GetGlobalQuota() types.QuotaInfo

func (*Cache) GetLatestAccountBlock

func (cache *Cache) GetLatestAccountBlock(address types.Address) *ledger.AccountBlock

func (*Cache) GetLatestSnapshotBlock

func (cache *Cache) GetLatestSnapshotBlock() *ledger.SnapshotBlock

func (*Cache) GetQuotaUsedList

func (cache *Cache) GetQuotaUsedList(addr types.Address) []types.QuotaInfo

func (*Cache) GetSnapshotBlockByHash

func (cache *Cache) GetSnapshotBlockByHash(hash types.Hash) *ledger.SnapshotBlock

func (*Cache) GetSnapshotBlockByHeight

func (cache *Cache) GetSnapshotBlockByHeight(height uint64) *ledger.SnapshotBlock

func (*Cache) GetSnapshotHeaderByHash

func (cache *Cache) GetSnapshotHeaderByHash(hash types.Hash) *ledger.SnapshotBlock

func (*Cache) GetSnapshotHeaderByHeight

func (cache *Cache) GetSnapshotHeaderByHeight(height uint64) *ledger.SnapshotBlock

func (*Cache) GetStatus

func (cache *Cache) GetStatus() []interfaces.DBStatus

func (*Cache) GetUnconfirmedBlocks

func (cache *Cache) GetUnconfirmedBlocks() []*ledger.AccountBlock

func (*Cache) GetUnconfirmedBlocksByAddress

func (cache *Cache) GetUnconfirmedBlocksByAddress(address *types.Address) []*ledger.AccountBlock

func (*Cache) Init

func (cache *Cache) Init() error

func (*Cache) InsertAccountBlock

func (cache *Cache) InsertAccountBlock(block *ledger.AccountBlock)

func (*Cache) InsertSnapshotBlock

func (cache *Cache) InsertSnapshotBlock(snapshotBlock *ledger.SnapshotBlock, confirmedBlocks []*ledger.AccountBlock)

func (*Cache) IsAccountBlockExisted

func (cache *Cache) IsAccountBlockExisted(hash types.Hash) bool

func (*Cache) IsSnapshotBlockExisted

func (cache *Cache) IsSnapshotBlockExisted(hash types.Hash) bool

func (*Cache) ResetUnconfirmedQuotas

func (cache *Cache) ResetUnconfirmedQuotas(unconfirmedBlocks []*ledger.AccountBlock)

func (*Cache) RollbackAccountBlocks

func (cache *Cache) RollbackAccountBlocks(accountBlocks []*ledger.AccountBlock) error

func (*Cache) RollbackSnapshotBlocks

func (cache *Cache) RollbackSnapshotBlocks(deletedChunks []*ledger.SnapshotChunk, unconfirmedBlocks []*ledger.AccountBlock) error

type Chain

type Chain interface {
	QueryLatestSnapshotBlock() (*ledger.SnapshotBlock, error)
	QuerySnapshotBlockByHeight(height uint64) (*ledger.SnapshotBlock, error)
	GetSnapshotBlockByHeight(height uint64) (*ledger.SnapshotBlock, error)

	GetSubLedger(endHeight, startHeight uint64) ([]*ledger.SnapshotChunk, error)
	GetSubLedgerAfterHeight(height uint64) ([]*ledger.SnapshotChunk, error)
}

type UnconfirmedPool

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

func NewUnconfirmedPool

func NewUnconfirmedPool(ds *dataSet) *UnconfirmedPool

func (*UnconfirmedPool) DeleteAllBlocks

func (up *UnconfirmedPool) DeleteAllBlocks()

func (*UnconfirmedPool) DeleteBlocks

func (up *UnconfirmedPool) DeleteBlocks(blocks []*ledger.AccountBlock)

func (*UnconfirmedPool) GetBlocks

func (up *UnconfirmedPool) GetBlocks() []*ledger.AccountBlock

No lock

func (*UnconfirmedPool) GetBlocksByAddress

func (up *UnconfirmedPool) GetBlocksByAddress(addr *types.Address) []*ledger.AccountBlock

func (*UnconfirmedPool) InsertAccountBlock

func (up *UnconfirmedPool) InsertAccountBlock(block *ledger.AccountBlock)

Jump to

Keyboard shortcuts

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