data

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxPoints = 1000
)

Variables

View Source
var (
	ErrInvalidEnvironment = fmt.Errorf("invalid environment")
)

Functions

func NewProvider

func NewProvider(cfg *ProviderConfig) (*provider, error)

Types

type Circuit

type Circuit struct {
	Code         string `json:"code"`
	OriginDevice Device `json:"origin_device"`
	TargetDevice Device `json:"target_device"`
	Link         Link   `json:"link"`
}

type CircuitLatenciesWithHeader

type CircuitLatenciesWithHeader struct {
	Header  *telemetry.DeviceLatencySamplesHeader
	Samples []datastats.CircuitLatencySample
}

type Device

type Device struct {
	PK       solana.PublicKey `json:"pk"`
	Code     string           `json:"code"`
	Location Location         `json:"location"`
}

type EpochRange

type EpochRange struct {
	From uint64
	To   uint64
}

func (*EpochRange) String

func (e *EpochRange) String() string

type GetCircuitLatenciesConfig

type GetCircuitLatenciesConfig struct {
	Epochs    *EpochRange
	Time      *TimeRange
	Interval  time.Duration
	MaxPoints uint64
	Unit      Unit
	Circuit   string
}
type Link struct {
	PK   solana.PublicKey `json:"pk"`
	Code string           `json:"code"`
}

type Location

type Location struct {
	PK        solana.PublicKey `json:"pk"`
	Name      string           `json:"name"`
	Country   string           `json:"country"`
	Latitude  float64          `json:"latitude"`
	Longitude float64          `json:"longitude"`
}

type Provider

type Provider interface {
	GetCircuits(ctx context.Context) ([]Circuit, error)
	GetCircuitLatencies(ctx context.Context, cfg GetCircuitLatenciesConfig) ([]stats.CircuitLatencyStat, error)
}

type ProviderConfig

type ProviderConfig struct {
	Logger               *slog.Logger
	ServiceabilityClient ServiceabilityClient
	TelemetryClient      TelemetryClient
	EpochFinder          epoch.Finder

	CircuitsCacheTTL               time.Duration
	HistoricEpochLatenciesCacheTTL time.Duration
	CurrentEpochLatenciesCacheTTL  time.Duration
	GetCircuitLatenciesPoolSize    int
}

func (*ProviderConfig) Validate

func (c *ProviderConfig) Validate() error

type Server

type Server struct {
	Mux *http.ServeMux
	// contains filtered or unexported fields
}

func NewServer

func NewServer(log *slog.Logger, mainnetProvider, testnetProvider, devnetProvider Provider) (*Server, error)

type ServiceabilityClient

type ServiceabilityClient interface {
	GetProgramData(ctx context.Context) (*serviceability.ProgramData, error)
}

type TelemetryClient

type TelemetryClient interface {
	GetDeviceLatencySamples(ctx context.Context, originDevicePubKey, targetDevicePubKey, linkPubKey solana.PublicKey, epoch uint64) (*telemetry.DeviceLatencySamples, error)
}

type TimeRange

type TimeRange struct {
	From time.Time
	To   time.Time
}

func (*TimeRange) String

func (t *TimeRange) String() string

type Unit

type Unit string
const (
	UnitMillisecond Unit = "ms"
	UnitMicrosecond Unit = "us"
)

Jump to

Keyboard shortcuts

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