Documentation ¶
Index ¶
- Constants
- func NewTimestampFinder(btg BlockTimeGetter, logger log.Logger, metrics metric.Factory) *finder
- type BlockNumberAndTime
- type BlockTimeGetter
- type EthereumBasedBlockTimeGetter
- type FakeBlockTimeGetter
- func (f *FakeBlockTimeGetter) GetTimestampForBlockNumber(ctx context.Context, blockNumber *big.Int) (*BlockNumberAndTime, error)
- func (f *FakeBlockTimeGetter) GetTimestampForLatestBlock(ctx context.Context) (*BlockNumberAndTime, error)
- func (f *FakeBlockTimeGetter) WithLatency(d time.Duration) *FakeBlockTimeGetter
- type TimestampFinder
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 ¶
func (f *FakeBlockTimeGetter) WithLatency(d time.Duration) *FakeBlockTimeGetter
type TimestampFinder ¶
type TimestampFinder interface {
FindBlockByTimestamp(ctx context.Context, referenceTimestampNano primitives.TimestampNano) (*BlockNumberAndTime, error)
}
Click to show internal directories.
Click to hide internal directories.