store

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type BlockStore

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

func NewBlockStore

func NewBlockStore(db KeyValueReaderWriter) *BlockStore

func (*BlockStore) GetLastStoredBlock

func (bs *BlockStore) GetLastStoredBlock(domainID uint8) (*big.Int, error)

GetLastStoredBlock queries the blockstore and returns latest known block

func (*BlockStore) GetStartBlock

func (bs *BlockStore) GetStartBlock(domainID uint8, startBlock *big.Int, latest bool, fresh bool) (*big.Int, error)

GetStartBlock queries the blockstore for the latest known block. If the latest block is greater than configured startBlock, then startBlock is replaced with the latest known block.

func (*BlockStore) StoreBlock

func (bs *BlockStore) StoreBlock(block *big.Int, domainID uint8) error

StoreBlock stores block number per domainID into blockstore

type KeyValueReader

type KeyValueReader interface {
	GetByKey(key []byte) ([]byte, error)
}

type KeyValueReaderWriter

type KeyValueReaderWriter interface {
	KeyValueReader
	KeyValueWriter
}

type KeyValueWriter

type KeyValueWriter interface {
	SetByKey(key []byte, value []byte) error
}

type NonceStore

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

func NewNonceStore

func NewNonceStore(db KeyValueReaderWriter) *NonceStore

func (*NonceStore) GetNonce

func (ns *NonceStore) GetNonce(chainID *big.Int) (*big.Int, error)

GetNonce queries the blockstore and returns latest nonce

func (*NonceStore) StoreNonce

func (ns *NonceStore) StoreNonce(chainID *big.Int, nonce *big.Int) error

StoreNonce stores nonce per chainID

Directories

Path Synopsis
Package mock_blockstore is a generated GoMock package.
Package mock_blockstore is a generated GoMock package.

Jump to

Keyboard shortcuts

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