probedb

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package probedb defines a probe data store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateAttestation added in v0.3.1

type AggregateAttestation struct {
	IPAddr          net.IP
	Source          string
	Method          string
	Slot            uint32
	CommitteeIndex  uint16
	AggregationBits []byte
	BeaconBlockRoot []byte
	SourceRoot      []byte
	TargetRoot      []byte
	DelayMS         uint32
}

AggregateAttestation holds information about an aggregate attestation.

type AggregateAttestationFilter added in v0.3.1

type AggregateAttestationFilter struct {
	// IPAddr is the IP address from which to fetch results.
	// If empty then there is no IP address filter.
	IPAddr string

	// Sources are the beacon nodes from which to fetch results.
	// If empty then there is no source filter.
	Sources []string

	// Methods are the collection methods from which to fetch results.
	// If empty then there is no method filter.
	Methods []string

	// From is the slot of the earliest result to fetch.
	// If nil then there is no earliest slot.
	From *phase0.Slot

	// To is the slot of the latest result to fetch.
	// If nil then there is no latest slot.
	To *phase0.Slot

	// Order is either OrderEarliest, in which case the earliest results
	// that match the filter are returned, or OrderLatest, in which case the
	// latest results that match the filter are returned.
	// The default is OrderEarliest.
	Order Order

	// Limit is the maximum number of results to return.
	// If 0 then there is no limit.
	Limit uint32
}

AggregateAttestationFilter defines a filter for fetching aggregate attestations. Filter elements are ANDed together. Results are always returned in ascending slot/method/IP address/source order.

type AggregateAttestationsProvider added in v0.3.1

type AggregateAttestationsProvider interface {
	// AggregateAttestations obtains the aggregate attestations for a filter.
	AggregateAttestations(ctx context.Context, filter *AggregateAttestationFilter) ([]*AggregateAttestation, error)
}

AggregateAttestationsProvider defines functions to obtain aggregate attestations.

type AggregateAttestationsSetter added in v0.3.1

type AggregateAttestationsSetter interface {
	Service

	// SetAggregateAttestation sets an aggregate attestation.
	SetAggregateAttestation(ctx context.Context, aggregateAttestation *AggregateAttestation) error
}

AggregateAttestationsSetter defines functions to create and update aggregate attestations.

type AttestationSummariesProvider added in v0.3.1

type AttestationSummariesProvider interface {
	// AttestationSummaries obtains the attestation summaries for a filter.
	AttestationSummaries(ctx context.Context, filter *AttestationSummaryFilter) ([]*AttestationSummary, error)
}

AttestationSummariesProvider defines functions to obtain attestation summaries.

type AttestationSummariesSetter added in v0.3.1

type AttestationSummariesSetter interface {
	Service

	// SetAttestationSummary sets an attestation summary.
	SetAttestationSummary(ctx context.Context, summary *AttestationSummary) error
}

AttestationSummariesSetter defines functions to create and update attestation summaries.

type AttestationSummary added in v0.3.1

type AttestationSummary struct {
	IPAddr          net.IP
	Source          string
	Method          string
	Slot            uint32
	CommitteeIndex  uint16
	BeaconBlockRoot []byte
	SourceRoot      []byte
	TargetRoot      []byte
	// AttesterBuckets contains the information about when specific indices
	// were first seen.
	// This is a raw representation of a github.com/prysmaticlabs/go-bitfield.Bitlist
	AttesterBuckets [][]byte
}

AttestationSummary holds summary information about an attestation.

type AttestationSummaryFilter added in v0.3.1

type AttestationSummaryFilter struct {
	// IPAddr is the IP address from which to fetch data.
	// If empty then there is no IP address filter.
	IPAddr string

	// Sources are the beacon nodes from which to fetch results.
	// If empty then there is no source filter.
	Sources []string

	// Methods are the collection methods from which to fetch results.
	// If empty then there is no method filter.
	Methods []string

	// From is the slot of the earliest data to fetch.
	// If nil then there is no earliest slot.
	From *phase0.Slot

	// To is the slot of the latest data to fetch.
	// If nil then there is no latest slot.
	To *phase0.Slot

	// Order is either OrderEarliest, in which case the earliest results
	// that match the filter are returned, or OrderLatest, in which case the
	// latest results that match the filter are returned.
	// The default is OrderEarliest.
	Order Order

	// Limit is the maximum number of results to return.
	// If 0 then there is no limit.
	Limit uint32
}

AttestationSummaryFilter defines a filter for fetching attestation summaries. Filter elements are ANDed together. Results are always returned in ascending slot/method/IP address/source order.

type BlockDelaysProvider

type BlockDelaysProvider interface {
	// BlockDelays obtains the block delays for a range of slots.
	BlockDelays(ctx context.Context, filter *DelayFilter) ([]*Delay, error)
}

BlockDelaysProvider defines functions to obtain block delays.

type BlockDelaysSetter

type BlockDelaysSetter interface {
	Service

	// SetBlockDelay sets a block delay.
	SetBlockDelay(ctx context.Context, delay *Delay) error
}

BlockDelaysSetter defines functions to create and update block delays.

type Delay

type Delay struct {
	IPAddr  net.IP
	Source  string
	Method  string
	Slot    uint32
	DelayMS uint32
}

Delay holds information about a delay.

type DelayFilter

type DelayFilter struct {
	// IPAddr is the IP address from which to fetch delays.
	// If empty then there is no IP address filter.
	IPAddr string

	// Sources are the beacon nodes from which to fetch results.
	// If empty then there is no source filter.
	Sources []string

	// Methods are the collection methods from which to fetch results.
	// If empty then there is no method filter.
	Methods []string

	// From is the slot of the earliest delay to fetch.
	// If nil then there is no earliest slot.
	From *phase0.Slot

	// To is the slot of the latest delay to fetch.
	// If nil then there is no latest slot.
	To *phase0.Slot

	// Order is either OrderEarliest, in which case the earliest results
	// that match the filter are returned, or OrderLatest, in which case the
	// latest results that match the filter are returned.
	// The default is OrderEarliest.
	Order Order

	// Selection is the selection of the delay(s).
	// The default is SelectionMinimum.
	Selection Selection
}

DelayFilter defines a filter for fetching delays. Filter elements are ANDed together. Results are always returned in ascending slot/method/IP address/source order.

type HeadDelaysProvider

type HeadDelaysProvider interface {
	// HeadDelays obtains the minimum head delays for a range of slots.
	HeadDelays(ctx context.Context, filter *DelayFilter) ([]*Delay, error)
}

HeadDelaysProvider defines functions to obtain head delays.

type HeadDelaysSetter

type HeadDelaysSetter interface {
	Service

	// SetHeadDelay sets a head delay.
	SetHeadDelay(ctx context.Context, delay *Delay) error
}

HeadDelaysSetter defines functions to create and update head delays.

type Order

type Order uint8

Order is the order in which results should be fetched (N.B. fetched, not returned).

const (
	// OrderEarliest fetches earliest transactions first.
	OrderEarliest Order = iota
	// OrderLatest fetches latest transactions first.
	OrderLatest
)

type Selection

type Selection uint8

Selection is the selection criterion when multiple delays are present.

const (
	// SelectionAll fetches all delays.
	SelectionAll Selection = iota
	// SelectionMinimum fetches the minimum delay.
	SelectionMinimum
	// SelectionMaximum fetches the maximum delay.
	SelectionMaximum
	// SelectionMedian fetches the median delay.
	SelectionMedian
)

type Service

type Service interface {
	// BeginTx begins a transaction.
	BeginTx(ctx context.Context) (context.Context, context.CancelFunc, error)

	// CommitTx commits a transaction.
	CommitTx(ctx context.Context) error

	// SetMetadata sets a metadata key to a JSON value.
	SetMetadata(ctx context.Context, key string, value []byte) error

	// Metadata obtains the JSON value from a metadata key.
	Metadata(ctx context.Context, key string) ([]byte, error)
}

Service defines a minimal probe database service.

Directories

Path Synopsis
Package mock provides a mock probe database.
Package mock provides a mock probe database.
Package postgresql provides a postgresql implementation of the probe database.
Package postgresql provides a postgresql implementation of the probe database.

Jump to

Keyboard shortcuts

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