headtracker

package
v2.7.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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 *utils.MailboxMonitor,
	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 {
	utils.StartStopOnce
	// 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 NewHeadListener[
	HTH htrktypes.Head[BLOCK_HASH, ID],
	S types.Subscription,
	ID types.ID,
	BLOCK_HASH types.Hashable,
	CLIENT htrktypes.Client[HTH, S, ID, BLOCK_HASH],
](
	lggr logger.Logger,
	client CLIENT,
	config htrktypes.Config,
	chStop chan struct{},
) *HeadListener[HTH, S, ID, BLOCK_HASH]

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 {
	utils.StartStopOnce
	// 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

func (*HeadTracker[HTH, S, ID, BLOCK_HASH]) Start

func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) Start(ctx context.Context) error

Start starts HeadTracker service.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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