service

package
v0.0.56 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidID                  = errors.New("invalid id")
	ErrInvalidFilter              = errors.New("invalid filter")
	ErrUnknownServerErrorOccurred = errors.New("unknown server error occurred")
	ErrFrameNotFound              = errors.New("frame not found")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Sources []source.Config `yaml:"sources"`

	Store store.Config `yaml:"store"`

	Indexer db.IndexerConfig `yaml:"indexer"`

	RetentionPeriod human.Duration `yaml:"retention_period" default:"24h"`

	Ethereum ethereum.Config `yaml:"ethereum"`
}

type ForkChoice

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

func NewForkChoice

func NewForkChoice(namespace string, log logrus.FieldLogger, config *Config, opts *Options) (*ForkChoice, error)

func (*ForkChoice) AddNewFrame

func (f *ForkChoice) AddNewFrame(ctx context.Context, sourceName string, frame *types.Frame) error

func (*ForkChoice) BackfillConsensusClient added in v0.0.46

func (f *ForkChoice) BackfillConsensusClient(ctx context.Context) error

func (*ForkChoice) BackfillEventSource added in v0.0.46

func (f *ForkChoice) BackfillEventSource(ctx context.Context) error

func (*ForkChoice) DeleteFrame

func (f *ForkChoice) DeleteFrame(ctx context.Context, id string) error

func (*ForkChoice) DeleteOldFrames

func (f *ForkChoice) DeleteOldFrames(ctx context.Context) error

func (*ForkChoice) DeleteUselessLabels added in v0.0.46

func (f *ForkChoice) DeleteUselessLabels(ctx context.Context) error

func (*ForkChoice) GetEthereumNetworkName

func (f *ForkChoice) GetEthereumNetworkName(_ context.Context) string

func (*ForkChoice) GetEthereumNow

func (f *ForkChoice) GetEthereumNow(_ context.Context) (phase0.Slot, phase0.Epoch, error)

func (*ForkChoice) GetEthereumSpecGenesisTime

func (f *ForkChoice) GetEthereumSpecGenesisTime(_ context.Context) time.Time

func (*ForkChoice) GetEthereumSpecSecondsPerSlot

func (f *ForkChoice) GetEthereumSpecSecondsPerSlot(_ context.Context) uint64

func (*ForkChoice) GetEthereumSpecSlotsPerEpoch

func (f *ForkChoice) GetEthereumSpecSlotsPerEpoch(_ context.Context) uint64

func (*ForkChoice) GetFrame

func (f *ForkChoice) GetFrame(ctx context.Context, id string) (*types.Frame, error)

func (*ForkChoice) ListEpochs

func (f *ForkChoice) ListEpochs(ctx context.Context, filter *FrameFilter, page PaginationCursor) ([]phase0.Epoch, *PaginationResponse, error)

func (*ForkChoice) ListLabels

func (f *ForkChoice) ListLabels(ctx context.Context, filter *FrameFilter, page PaginationCursor) ([]string, *PaginationResponse, error)

func (*ForkChoice) ListMetadata

func (*ForkChoice) ListNodes

func (f *ForkChoice) ListNodes(ctx context.Context, filter *FrameFilter, page PaginationCursor) ([]string, *PaginationResponse, error)

func (*ForkChoice) ListSlots

func (f *ForkChoice) ListSlots(ctx context.Context, filter *FrameFilter, page PaginationCursor) ([]phase0.Slot, *PaginationResponse, error)

func (*ForkChoice) Start

func (f *ForkChoice) Start(ctx context.Context) error

func (*ForkChoice) Stop

func (f *ForkChoice) Stop(ctx context.Context) error

type FrameFilter

type FrameFilter struct {
	Node            *string    `json:"node"`
	Before          *time.Time `json:"before"`
	After           *time.Time `json:"after"`
	Slot            *uint64    `json:"slot"`
	Epoch           *uint64    `json:"epoch"`
	Labels          *[]string  `json:"labels"`
	ConsensusClient *string    `json:"consensus_client"`
	EventSource     *string    `json:"event_source"`
}

func (*FrameFilter) AsDBFilter

func (f *FrameFilter) AsDBFilter() *db.FrameFilter

func (*FrameFilter) Validate

func (f *FrameFilter) Validate() error

type Metrics

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

func NewMetrics

func NewMetrics(namespace string, config *Config, enabled bool) *Metrics

func (*Metrics) ObserveOperation

func (m *Metrics) ObserveOperation(operation Operation)

func (*Metrics) ObserveOperationError

func (m *Metrics) ObserveOperationError(operation Operation)

type Operation

type Operation string
const (
	OperationAddFrame    Operation = "add_frame"
	OperationGetFrame    Operation = "get_frame"
	OperationDeleteFrame Operation = "delete_frame"

	OperationListMetadata   Operation = "list_metadata"
	OperationUpdateMetadata Operation = "update_metadata"

	OperationListNodes  Operation = "list_nodes"
	OperationListSlots  Operation = "list_slots"
	OperationListEpochs Operation = "list_epochs"
	OperationListLabels Operation = "list_labels"

	OperationGetEthereumNow         Operation = "get_ethereum_now"
	OperationGetEthereumSpec        Operation = "get_ethereum_spec"
	OperationGetEthereumNetworkName Operation = "get_ethereum_network_name"
)

type Options

type Options struct {
	MetricsEnabled bool
}

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) WithMetricsDisabled

func (o *Options) WithMetricsDisabled() *Options

func (*Options) WithMetricsEnabled

func (o *Options) WithMetricsEnabled() *Options

type PaginationCursor

type PaginationCursor struct {
	// The cursor to start from.
	Offset int `json:"offset"`
	// The number of items to return.
	Limit int `json:"limit"`
}

func DefaultPagination

func DefaultPagination() *PaginationCursor

func (*PaginationCursor) AsDBPageCursor

func (p *PaginationCursor) AsDBPageCursor() *db.PaginationCursor

type PaginationResponse

type PaginationResponse struct {
	// The total number of items.
	Total int64 `json:"total"`
}

type SourceMetadata

type SourceMetadata struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

Jump to

Keyboard shortcuts

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