source

package
v0.0.54 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingName = errors.New("missing name")

	ErrFrameNotFound = errors.New("frame not found")
)
View Source
var BeaconNodeType = "beacon_node"
View Source
var XatuHTTPType = "xatu_http"

Functions

This section is empty.

Types

type BasicMetrics

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

func NewBasicMetrics

func NewBasicMetrics(namespace, sourceType, sourceName string, enabled bool) *BasicMetrics

func (*BasicMetrics) ObserveItemFetched

func (m *BasicMetrics) ObserveItemFetched(itemType string)

type BeaconNode

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

func NewBeaconNode

func NewBeaconNode(namespace string, log logrus.FieldLogger, config *BeaconNodeConfig, name string, metrics *BasicMetrics) (*BeaconNode, error)

func (*BeaconNode) Name

func (b *BeaconNode) Name() string

func (*BeaconNode) OnFrame

func (b *BeaconNode) OnFrame(callback func(ctx context.Context, frame *types.Frame))

func (*BeaconNode) Ready

func (b *BeaconNode) Ready(ctx context.Context) bool

func (*BeaconNode) Start

func (b *BeaconNode) Start(ctx context.Context) error

func (*BeaconNode) Stop

func (b *BeaconNode) Stop(ctx context.Context) error

func (*BeaconNode) Type

func (b *BeaconNode) Type() string

type BeaconNodeConfig

type BeaconNodeConfig struct {
	Address         string       `yaml:"address"`
	PollingInterval string       `yaml:"polling_interval"`
	Store           store.Config `yaml:"store"`
	Labels          []string     `yaml:"labels"`
}

func (*BeaconNodeConfig) Validate

func (b *BeaconNodeConfig) Validate() error

type Config

type Config struct {
	Name   string          `yaml:"name"`
	Type   string          `yaml:"type"`
	Config yaml.RawMessage `yaml:"config"`
}

type Data

type Data string
var (
	DataFrame Data = "frame"
	DataBlock Data = "block"
)

type Options

type Options struct {
	MetricsEnabled          bool
	AllowedEthereumNetworks []string
}

func DefaultOptions

func DefaultOptions() *Options

func (*Options) SetMetricsEnabled

func (o *Options) SetMetricsEnabled(enabled bool) *Options

func (*Options) Validate

func (o *Options) Validate() error

func (*Options) WithAllowedEthereumNetworks added in v0.0.12

func (o *Options) WithAllowedEthereumNetworks(networks []string) *Options

func (*Options) WithMetricsDisabled

func (o *Options) WithMetricsDisabled() *Options

func (*Options) WithMetricsEnabled

func (o *Options) WithMetricsEnabled() *Options

type Source

type Source interface {
	// Name returns the user-defined name of the source.
	Name() string
	// Type returns the type of the source.
	Type() string
	// Start starts the source.
	Start(ctx context.Context) error
	// Stop stops the source.
	Stop(ctx context.Context) error

	// OnFrame is called when a new frame has been received.
	OnFrame(func(ctx context.Context, frame *types.Frame))
}

func NewSource

func NewSource(namespace string, log logrus.FieldLogger, name, sourceType string, config yaml.RawMessage, opts *Options) (Source, error)

type XatuHTTP added in v0.0.12

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

func NewXatuHTTP added in v0.0.12

func NewXatuHTTP(namespace, name string, log logrus.FieldLogger, config *XatuHTTPConfig, metrics *BasicMetrics, opts *Options) (*XatuHTTP, error)

func (*XatuHTTP) Name added in v0.0.12

func (x *XatuHTTP) Name() string

func (*XatuHTTP) OnFrame added in v0.0.12

func (x *XatuHTTP) OnFrame(fn func(ctx context.Context, frame *types.Frame))

func (*XatuHTTP) Start added in v0.0.12

func (x *XatuHTTP) Start(ctx context.Context) error

func (*XatuHTTP) Stop added in v0.0.12

func (x *XatuHTTP) Stop(ctx context.Context) error

func (*XatuHTTP) Type added in v0.0.12

func (x *XatuHTTP) Type() string

type XatuHTTPConfig added in v0.0.12

type XatuHTTPConfig struct {
	Address string `yaml:"address"`
	Path    string `yaml:"path"`
}

Jump to

Keyboard shortcuts

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