index

package
v0.0.0-...-5cda5f8 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterStateBatchAppendedEvent

func FilterStateBatchAppendedEvent(cli *ethclient.Client, startHeight, endHeight int64, contract common.Address) ([]map[[32]byte]uint64, error)

Types

type Hook

type Hook interface {
	AfterStateBatchIndexed([32]byte) error
}

type Indexer

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

func NewIndexer

func NewIndexer(store IndexerStore, l1url string, l1ConfirmBlocks int, sccContractAddr string, taskInterval string, l1StartBlockNumber uint64) (Indexer, error)

func (Indexer) ObserveStateBatchAppended

func (o Indexer) ObserveStateBatchAppended(scannedHeight uint64)

func (Indexer) SetHook

func (o Indexer) SetHook(hook Hook) Indexer

func (Indexer) Start

func (o Indexer) Start()

func (Indexer) Stop

func (o Indexer) Stop()

type IndexerStore

type IndexerStore interface {
	StateBatchStore
	ScanHeightStore
}

type ScanHeightStore

type ScanHeightStore interface {
	UpdateHeight(uint64) error
	GetScannedHeight() (uint64, error)
}

type StateBatchInfo

type StateBatchInfo struct {
	BatchRoot    [32]byte `json:"batch_root"`
	ElectionId   uint64   `json:"election_id"`
	AbsentNodes  []string `json:"absent_nodes"`
	WorkingNodes []string `json:"working_nodes"`
	BatchIndex   uint64   `json:"batch_index"`
}

type StateBatchStore

type StateBatchStore interface {
	SetStateBatch(StateBatchInfo) error
	GetStateBatch([32]byte) (bool, StateBatchInfo)
	IndexStateBatch(uint64, [32]byte) error
	GetIndexStateBatch(index uint64) (bool, [32]byte)
}

Jump to

Keyboard shortcuts

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