sync

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpVerify = "verify"
	OpStore  = "store"
	OpFetch  = "fetch"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventListener added in v0.7.0

type EventListener interface {
	OnSyncStepDone(op string, blockNum uint64, took time.Duration)
	OnReorg(blockNum uint64)
}

type HeaderSubscription added in v0.7.4

type HeaderSubscription struct {
	*feed.Subscription[*core.Header]
}

This is a work-around. mockgen chokes when the instantiated generic type is in the interface.

type NoopSynchronizer added in v0.10.0

type NoopSynchronizer struct{}

This is temporary and will be removed once the p2p synchronizer implements this interface.

func (*NoopSynchronizer) HighestBlockHeader added in v0.10.0

func (n *NoopSynchronizer) HighestBlockHeader() *core.Header

func (*NoopSynchronizer) StartingBlockNumber added in v0.10.0

func (n *NoopSynchronizer) StartingBlockNumber() (uint64, error)

func (*NoopSynchronizer) SubscribeNewHeads added in v0.10.0

func (n *NoopSynchronizer) SubscribeNewHeads() HeaderSubscription

type Reader added in v0.6.2

type Reader interface {
	StartingBlockNumber() (uint64, error)
	HighestBlockHeader() *core.Header
	SubscribeNewHeads() HeaderSubscription
}

Todo: Since this is also going to be implemented by p2p package we should move this interface to node package

type SelectiveListener added in v0.7.0

type SelectiveListener struct {
	OnSyncStepDoneCb func(op string, blockNum uint64, took time.Duration)
	OnReorgCb        func(blockNum uint64)
}

func (*SelectiveListener) OnReorg added in v0.7.0

func (l *SelectiveListener) OnReorg(blockNum uint64)

func (*SelectiveListener) OnSyncStepDone added in v0.7.0

func (l *SelectiveListener) OnSyncStepDone(op string, blockNum uint64, took time.Duration)

type Synchronizer

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

Synchronizer manages a list of StarknetData to fetch the latest blockchain updates

func New added in v0.2.1

func New(bc *blockchain.Blockchain, starkNetData starknetdata.StarknetData,
	log utils.SimpleLogger, pendingPollInterval time.Duration, readOnlyBlockchain bool,
) *Synchronizer

func (*Synchronizer) HighestBlockHeader added in v0.3.0

func (s *Synchronizer) HighestBlockHeader() *core.Header

func (*Synchronizer) Run

func (s *Synchronizer) Run(ctx context.Context) error

Run starts the Synchronizer, returns an error if the loop is already running

func (*Synchronizer) StartingBlockNumber added in v0.3.0

func (s *Synchronizer) StartingBlockNumber() (uint64, error)

func (*Synchronizer) SubscribeNewHeads added in v0.7.4

func (s *Synchronizer) SubscribeNewHeads() HeaderSubscription

func (*Synchronizer) WithListener added in v0.7.0

func (s *Synchronizer) WithListener(listener EventListener) *Synchronizer

WithListener registers an EventListener

Jump to

Keyboard shortcuts

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