Documentation ¶
Index ¶
- Constants
- func NewHeadTracker[HTH htrktypes.Head[BLOCK_HASH, ID], S types.Subscription, ID types.ID, ...](lggr logger.Logger, client htrktypes.Client[HTH, S, ID, BLOCK_HASH], ...) types.HeadTracker[HTH, BLOCK_HASH]
- type HeadBroadcaster
- func (hb *HeadBroadcaster[H, BLOCK_HASH]) BroadcastNewLongestChain(head H)
- func (hb *HeadBroadcaster[H, BLOCK_HASH]) Close() error
- func (hb *HeadBroadcaster[H, BLOCK_HASH]) HealthReport() map[string]error
- func (hb *HeadBroadcaster[H, BLOCK_HASH]) Name() string
- func (hb *HeadBroadcaster[H, BLOCK_HASH]) Start(context.Context) error
- func (hb *HeadBroadcaster[H, BLOCK_HASH]) Subscribe(callback types.HeadTrackable[H, BLOCK_HASH]) (currentLongestChain H, unsubscribe func())
- type HeadListener
- func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) Connected() bool
- func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) HealthReport() map[string]error
- func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) ListenForNewHeads(handleNewHead types.NewHeadHandler[HTH, BLOCK_HASH], done func())
- func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) Name() string
- func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) ReceivingHeads() bool
- type HeadTracker
- func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) Backfill(ctx context.Context, headWithChain HTH, depth uint) (err error)
- func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) Close() error
- func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) HealthReport() map[string]error
- func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) LatestChain() HTH
- func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) Name() string
- func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) Start(ctx context.Context) error
Constants ¶
View Source
const HeadsBufferSize = 10
HeadsBufferSize - The buffer is used when heads sampling is disabled, to ensure the callback is run for every head
View Source
const TrackableCallbackTimeout = 2 * time.Second
Variables ¶
This section is empty.
Functions ¶
func NewHeadTracker ¶
func NewHeadTracker[ HTH htrktypes.Head[BLOCK_HASH, ID], S types.Subscription, ID types.ID, BLOCK_HASH types.Hashable, ]( lggr logger.Logger, client htrktypes.Client[HTH, S, ID, BLOCK_HASH], config htrktypes.Config, htConfig htrktypes.HeadTrackerConfig, headBroadcaster types.HeadBroadcaster[HTH, BLOCK_HASH], headSaver types.HeadSaver[HTH, BLOCK_HASH], mailMon *mailbox.Monitor, getNilHead func() HTH, ) types.HeadTracker[HTH, BLOCK_HASH]
NewHeadTracker instantiates a new HeadTracker using HeadSaver to persist new block numbers.
Types ¶
type HeadBroadcaster ¶
type HeadBroadcaster[H types.Head[BLOCK_HASH], BLOCK_HASH types.Hashable] struct { services.StateMachine // contains filtered or unexported fields }
func NewHeadBroadcaster ¶
func NewHeadBroadcaster[ H types.Head[BLOCK_HASH], BLOCK_HASH types.Hashable, ]( lggr logger.Logger, ) *HeadBroadcaster[H, BLOCK_HASH]
NewHeadBroadcaster creates a new HeadBroadcaster
func (*HeadBroadcaster[H, BLOCK_HASH]) BroadcastNewLongestChain ¶
func (hb *HeadBroadcaster[H, BLOCK_HASH]) BroadcastNewLongestChain(head H)
func (*HeadBroadcaster[H, BLOCK_HASH]) Close ¶
func (hb *HeadBroadcaster[H, BLOCK_HASH]) Close() error
func (*HeadBroadcaster[H, BLOCK_HASH]) HealthReport ¶
func (hb *HeadBroadcaster[H, BLOCK_HASH]) HealthReport() map[string]error
func (*HeadBroadcaster[H, BLOCK_HASH]) Name ¶
func (hb *HeadBroadcaster[H, BLOCK_HASH]) Name() string
func (*HeadBroadcaster[H, BLOCK_HASH]) Start ¶
func (hb *HeadBroadcaster[H, BLOCK_HASH]) Start(context.Context) error
func (*HeadBroadcaster[H, BLOCK_HASH]) Subscribe ¶
func (hb *HeadBroadcaster[H, BLOCK_HASH]) Subscribe(callback types.HeadTrackable[H, BLOCK_HASH]) (currentLongestChain H, unsubscribe func())
Subscribe subscribes to OnNewLongestChain and Connect until HeadBroadcaster is closed, or unsubscribe callback is called explicitly
type HeadListener ¶
type HeadListener[ HTH htrktypes.Head[BLOCK_HASH, ID], S types.Subscription, ID types.ID, BLOCK_HASH types.Hashable, ] struct { // contains filtered or unexported fields }
func NewHeadListener ¶
func (*HeadListener[HTH, S, ID, BLOCK_HASH]) Connected ¶
func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) Connected() bool
func (*HeadListener[HTH, S, ID, BLOCK_HASH]) HealthReport ¶
func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) HealthReport() map[string]error
func (*HeadListener[HTH, S, ID, BLOCK_HASH]) ListenForNewHeads ¶
func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) ListenForNewHeads(handleNewHead types.NewHeadHandler[HTH, BLOCK_HASH], done func())
func (*HeadListener[HTH, S, ID, BLOCK_HASH]) Name ¶
func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) Name() string
func (*HeadListener[HTH, S, ID, BLOCK_HASH]) ReceivingHeads ¶
func (hl *HeadListener[HTH, S, ID, BLOCK_HASH]) ReceivingHeads() bool
type HeadTracker ¶
type HeadTracker[ HTH htrktypes.Head[BLOCK_HASH, ID], S types.Subscription, ID types.ID, BLOCK_HASH types.Hashable, ] struct { services.StateMachine // contains filtered or unexported fields }
func (*HeadTracker[HTH, S, ID, BLOCK_HASH]) Backfill ¶
func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) Backfill(ctx context.Context, headWithChain HTH, depth uint) (err error)
func (*HeadTracker[HTH, S, ID, BLOCK_HASH]) Close ¶
func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) Close() error
Close stops HeadTracker service.
func (*HeadTracker[HTH, S, ID, BLOCK_HASH]) HealthReport ¶
func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) HealthReport() map[string]error
func (*HeadTracker[HTH, S, ID, BLOCK_HASH]) LatestChain ¶
func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) LatestChain() HTH
func (*HeadTracker[HTH, S, ID, BLOCK_HASH]) Name ¶
func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) Name() string
Click to show internal directories.
Click to hide internal directories.