store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockStore

type BlockStore struct {
	log.Logger
	// contains filtered or unexported fields
}

func NewBlockStore

func NewBlockStore(logger log.Logger) (*BlockStore, error)

func (*BlockStore) Close

func (bs *BlockStore) Close() error

func (*BlockStore) DeleteHashByHeight

func (bs *BlockStore) DeleteHashByHeight(height uint64)

func (*BlockStore) DeleteHashByHeightFrom

func (bs *BlockStore) DeleteHashByHeightFrom(height uint64)

func (*BlockStore) DeleteHeaderHeight

func (bs *BlockStore) DeleteHeaderHeight(hash types.Hash)

DeleteHeaderHeight removes hash->height mapping.

func (*BlockStore) DeleteTd

func (bs *BlockStore) DeleteTd(height uint64, hash types.Hash)

DeleteTd removes all block total difficulty data associated with a hash.

func (*BlockStore) GetSqliteDB added in v0.1.0

func (bs *BlockStore) GetSqliteDB() *SqliteStore

func (*BlockStore) ReadBlock

func (bs *BlockStore) ReadBlock(height uint64, hash types.Hash) *types.Block

func (*BlockStore) ReadData

func (bs *BlockStore) ReadData(hash types.Hash, result interface{}) error

ReadData retrieves the data corresponding to the hash and decode into result.

func (*BlockStore) ReadDataRLP

func (bs *BlockStore) ReadDataRLP(hash types.Hash) rlp.RawValue

ReadDataRLP retrieves the data in RLP encoding.

func (*BlockStore) ReadHashByHeight

func (bs *BlockStore) ReadHashByHeight(height uint64) types.Hash

func (*BlockStore) ReadHeadBlock

func (bs *BlockStore) ReadHeadBlock() *types.Block

func (*BlockStore) ReadHeadBlockHash

func (bs *BlockStore) ReadHeadBlockHash() types.Hash

func (*BlockStore) ReadHeader

func (bs *BlockStore) ReadHeader(height uint64, hash types.Hash) *types.Header

ReadHeader retrieves the block header corresponding to the hash.

func (*BlockStore) ReadHeightByHash

func (bs *BlockStore) ReadHeightByHash(hash types.Hash) *uint64

ReadHeightByHash returns the header height assigned to a hash.

func (*BlockStore) ReadReceipt

func (bs *BlockStore) ReadReceipt(hash types.Hash) (result *types.StoredReceipt)

func (*BlockStore) ReadTd

func (bs *BlockStore) ReadTd(height uint64, hash types.Hash) *big.Int

ReadTd retrieves a block's total difficulty corresponding to the hash.

func (*BlockStore) ReadTx

func (bs *BlockStore) ReadTx(hash types.Hash) (result types.Tx)

func (*BlockStore) WriteBlock

func (bs *BlockStore) WriteBlock(block *types.Block)

func (*BlockStore) WriteData

func (bs *BlockStore) WriteData(hash types.Hash, data interface{})

func (*BlockStore) WriteHashByHeight

func (bs *BlockStore) WriteHashByHeight(height uint64, hash types.Hash, miner types.Address)

GetHashByHeight stores hash by height for the head chain

func (*BlockStore) WriteHeadBlockHash

func (bs *BlockStore) WriteHeadBlockHash(hash types.Hash)

func (*BlockStore) WriteHeader

func (bs *BlockStore) WriteHeader(header *types.Header)

WriteHeader writes the block header corresponding to the hash.

func (*BlockStore) WriteHeightByHash

func (bs *BlockStore) WriteHeightByHash(hash types.Hash, height uint64)

WriteHeightByHash stores the hash->height mapping.

func (*BlockStore) WriteTd

func (bs *BlockStore) WriteTd(height uint64, hash types.Hash, td *big.Int)

WriteTd stores the total difficulty of a block into the database.

type SqliteStore added in v0.1.0

type SqliteStore struct {
	log.Logger
	Db *sql.DB
	// contains filtered or unexported fields
}

func (*SqliteStore) AddMiner added in v0.1.0

func (s *SqliteStore) AddMiner(height uint64, miner types.Address) bool

func (*SqliteStore) CountBlockByMiner added in v0.1.0

func (s *SqliteStore) CountBlockByMiner(miner types.Address, limit int) int

func (*SqliteStore) Init added in v0.1.0

func (s *SqliteStore) Init(sqlite3DbPath string) bool

func (*SqliteStore) QueryBlockByMiner added in v0.1.0

func (s *SqliteStore) QueryBlockByMiner(miner types.Address, limit int, page int) []uint64

func (*SqliteStore) RemoveMinerByHeight added in v0.1.0

func (s *SqliteStore) RemoveMinerByHeight(height uint64) bool

func (*SqliteStore) RemoveMinerFromHeight added in v0.1.0

func (s *SqliteStore) RemoveMinerFromHeight(height uint64) bool

Jump to

Keyboard shortcuts

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