db

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContractNotFound = errors.New("db: contract record not found")
	ErrFutureBlock      = errors.New("db: block number is greater than last persisted block")
)

Functions

func NewSqliteDb

func NewSqliteDb(dbpath string) (*rosettaSqlDb, error)

Types

type BlockChangeSet

type BlockChangeSet struct {
	BlockNumber     *big.Int
	GasPriceMinimum *big.Int
	RegistryChanges []RegistryChange
}

type RegistryChange

type RegistryChange struct {
	TxIndex    uint
	Contract   string
	NewAddress common.Address
}

type RosettaDB

type RosettaDB interface {
	RosettaDBReader
	RosettaDBWriter
}

type RosettaDBReader

type RosettaDBReader interface {
	// LastPersistedBlock will return the last block that was persisted
	// In case of not block, it will return 0
	LastPersistedBlock(ctx context.Context) (*big.Int, error)

	// GasPriceMinimumOn return the gasPriceMinimum registered for that block
	// In case of no value, will return with fallbackValue which is 0
	GasPriceMinimumFor(ctx context.Context, block *big.Int) (*big.Int, error)

	// RegistryAddressStartOf returns the address of the contract at the start of (block, tx)
	// In case there's no record for that contract it will fail with ErrContractNotFound
	RegistryAddressStartOf(ctx context.Context, block *big.Int, txIndex uint, contractName string) (common.Address, error)

	// RegistryAddressesStartOf returns the address of the contracts at the start of (block, tx)
	// For the case a contract is not yet deployed, that contract won't be in the result map
	RegistryAddressesStartOf(ctx context.Context, block *big.Int, txIndex uint, contractName ...string) (map[string]common.Address, error)
}

type RosettaDBWriter

type RosettaDBWriter interface {
	ApplyChanges(ctx context.Context, changeSet *BlockChangeSet) error
}

Jump to

Keyboard shortcuts

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