timestampfinder

package
v1.3.17 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const FAKE_CLIENT_FIRST_TIMESTAMP_SECONDS = 1500000000
View Source
const FAKE_CLIENT_LAST_TIMESTAMP_EXPECTED_SECONDS = 1506108784
View Source
const FAKE_CLIENT_NUMBER_OF_BLOCKS = 1000000
View Source
const TIMESTAMP_FINDER_ALLOWED_HEURISTIC_STEPS = 10
View Source
const TIMESTAMP_FINDER_MAX_STEPS = 1000
View Source
const TIMESTAMP_FINDER_PROBABLE_RANGE_EFFICIENT = 1000
View Source
const TIMESTAMP_FINDER_PROBABLE_RANGE_INEFFICIENT = 10000

Variables

This section is empty.

Functions

func NewTimestampFinder

func NewTimestampFinder(btg BlockTimeGetter, logger log.Logger, metrics metric.Factory) *finder

Types

type BlockNumberAndTime

type BlockNumberAndTime struct {
	BlockNumber   int64
	BlockTimeNano primitives.TimestampNano
}

type BlockTimeGetter

type BlockTimeGetter interface {
	GetTimestampForBlockNumber(ctx context.Context, blockNumber *big.Int) (*BlockNumberAndTime, error)
	GetTimestampForLatestBlock(ctx context.Context) (*BlockNumberAndTime, error)
}

type EthereumBasedBlockTimeGetter

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

func NewEthereumBasedBlockTimeGetter

func NewEthereumBasedBlockTimeGetter(ethereum adapterHeaderFetcher) *EthereumBasedBlockTimeGetter

func (*EthereumBasedBlockTimeGetter) GetTimestampForBlockNumber

func (f *EthereumBasedBlockTimeGetter) GetTimestampForBlockNumber(ctx context.Context, blockNumber *big.Int) (*BlockNumberAndTime, error)

func (*EthereumBasedBlockTimeGetter) GetTimestampForLatestBlock

func (f *EthereumBasedBlockTimeGetter) GetTimestampForLatestBlock(ctx context.Context) (*BlockNumberAndTime, error)

type FakeBlockTimeGetter

type FakeBlockTimeGetter struct {
	TimesCalled int
	Latency     time.Duration
	// contains filtered or unexported fields
}

func NewFakeBlockTimeGetter

func NewFakeBlockTimeGetter(logger log.Logger) *FakeBlockTimeGetter

func (*FakeBlockTimeGetter) GetTimestampForBlockNumber

func (f *FakeBlockTimeGetter) GetTimestampForBlockNumber(ctx context.Context, blockNumber *big.Int) (*BlockNumberAndTime, error)

func (*FakeBlockTimeGetter) GetTimestampForLatestBlock

func (f *FakeBlockTimeGetter) GetTimestampForLatestBlock(ctx context.Context) (*BlockNumberAndTime, error)

func (*FakeBlockTimeGetter) WithLatency

type TimestampFinder

type TimestampFinder interface {
	FindBlockByTimestamp(ctx context.Context, referenceTimestampNano primitives.TimestampNano) (*BlockNumberAndTime, error)
}

Jump to

Keyboard shortcuts

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