store

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: LGPL-3.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInconsistentReceipt is returned if the transacion cannot map to a receipt
	ErrInconsistentReceipt = errors.New("inconsistent receipt")
)
View Source
var (
	// ErrModifiedData returns if the data is modified by others. Update your local states if we received the error.
	ErrModifiedData = errors.New("modified data")
)

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// Init the store manager to load the erc20 list
	Init(ctx context.Context) error
	// FindERC20 finds the erc20 code
	FindERC20(ctx context.Context, address gethCommon.Address) (*model.ERC20, error)
	// InsertERC20 inserts the erc20 code
	InsertERC20(ctx context.Context, code *model.ERC20) error
	// InsertTd writes the total difficulty for a block
	InsertTd(ctx context.Context, data *model.TotalDifficulty) error
	// FindLatestBlock returns a latest header from db
	FindLatestBlock(ctx context.Context) (*model.Header, error)
	// FindBlockByNumber returns the header of the given block number
	FindBlockByNumber(ctx context.Context, number int64) (*model.Header, error)
	// FindTd returns the TD of the given block hash
	FindTd(ctx context.Context, hash []byte) (*model.TotalDifficulty, error)
	// InsertBlocks updates all block data
	InsertBlocks(ctx context.Context, balancer client.Balancer, blocks []*types.Block, receipts [][]*types.Receipt, events [][]*types.TransferLog) error
	// ReorgBlocks inserts reorg event and deletes the forked block data.
	// To improve the deletion performance, we delete block data by `deleteChunk` size.
	// The chunk solution is referenced by http://mysql.rjweb.org/doc.php/deletebig.
	ReorgBlocks(ctx context.Context, reorgEvent *model.Reorg) error
}

Manager is a wrapper interface to insert block, receipt and states quickly

func NewManager

func NewManager(db *sqlx.DB, chainConfig *params.ChainConfig) Manager

NewManager news a store manager to insert block, receipts and states.

Directories

Path Synopsis
mocks
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
mocks
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
mocks
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
mocks
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
mocks
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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