Documentation ¶
Index ¶
- type BlockEvent
- type BlockProvider
- type BlockTracker
- func (b *BlockTracker) AcquireLock() Lock
- func (t *BlockTracker) AddBlockLocked(block *core.Block) error
- func (b *BlockTracker) BlocksBlocked() []*core.Block
- func (b *BlockTracker) Close() error
- func (t *BlockTracker) HandleBlockEvent(block *core.Block) (*BlockEvent, error)
- func (t *BlockTracker) HandleReconcile(block *core.Block) error
- func (t *BlockTracker) Init() (err error)
- func (b *BlockTracker) LastBlocked() *core.Block
- func (b *BlockTracker) Len() int
- func (b *BlockTracker) MaxBlockBacklog() uint64
- func (b *BlockTracker) Start() error
- func (b *BlockTracker) Subscribe() chan *BlockEvent
- type BlockTrackerInterface
- type Config
- type ConfigOption
- type Event
- type EventType
- type JSONBlockTracker
- type Lock
- type SubscriptionBlockTracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockEvent ¶
BlockEvent is an event emitted when a new block is included
type BlockProvider ¶
type BlockProvider interface { GetBlockByHash(hash core.Hash, full bool) (*core.Block, error) GetBlockByNumber(i core.BlockNumber, full bool) (*core.Block, error) }
BlockProvider are the eth1x methods required by the block tracker
type BlockTracker ¶
type BlockTracker struct {
// contains filtered or unexported fields
}
BlockTracker is an interface to track new blocks on the chain
func NewBlockTracker ¶
func NewBlockTracker(provider BlockProvider, opts ...ConfigOption) *BlockTracker
func (*BlockTracker) AcquireLock ¶
func (b *BlockTracker) AcquireLock() Lock
func (*BlockTracker) AddBlockLocked ¶
func (t *BlockTracker) AddBlockLocked(block *core.Block) error
func (*BlockTracker) BlocksBlocked ¶
func (b *BlockTracker) BlocksBlocked() []*core.Block
func (*BlockTracker) Close ¶
func (b *BlockTracker) Close() error
func (*BlockTracker) HandleBlockEvent ¶
func (t *BlockTracker) HandleBlockEvent(block *core.Block) (*BlockEvent, error)
func (*BlockTracker) HandleReconcile ¶
func (t *BlockTracker) HandleReconcile(block *core.Block) error
func (*BlockTracker) Init ¶
func (t *BlockTracker) Init() (err error)
func (*BlockTracker) LastBlocked ¶
func (b *BlockTracker) LastBlocked() *core.Block
func (*BlockTracker) Len ¶
func (b *BlockTracker) Len() int
func (*BlockTracker) MaxBlockBacklog ¶
func (b *BlockTracker) MaxBlockBacklog() uint64
func (*BlockTracker) Start ¶
func (b *BlockTracker) Start() error
func (*BlockTracker) Subscribe ¶
func (b *BlockTracker) Subscribe() chan *BlockEvent
type BlockTrackerInterface ¶
type Config ¶
type Config struct { Tracker BlockTrackerInterface MaxBlockBacklog uint64 }
func DefaultConfig ¶
func DefaultConfig() *Config
type ConfigOption ¶
type ConfigOption func(*Config)
func WithBlockMaxBacklog ¶
func WithBlockMaxBacklog(b uint64) ConfigOption
func WithTracker ¶
func WithTracker(b BlockTrackerInterface) ConfigOption
type JSONBlockTracker ¶
type JSONBlockTracker struct { PollInterval time.Duration // contains filtered or unexported fields }
JSONBlockTracker implements the BlockTracker interface using the http jsonrpc endpoint
func NewJSONBlockTracker ¶
func NewJSONBlockTracker(logger *log.Logger, provider BlockProvider) *JSONBlockTracker
NewJSONBlockTracker creates a new json block tracker
type SubscriptionBlockTracker ¶
type SubscriptionBlockTracker struct {
// contains filtered or unexported fields
}
SubscriptionBlockTracker is an interface to track new blocks using the newHeads subscription endpoint
func NewSubscriptionBlockTracker ¶
func NewSubscriptionBlockTracker(logger *log.Logger, client *jsonrpc.Client) (*SubscriptionBlockTracker, error)
NewSubscriptionBlockTracker creates a new block tracker using the subscription endpoint
Click to show internal directories.
Click to hide internal directories.