Help us shape the future of Go! Take the 2026 Go Developer Survey

latency

package
v0.6.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractData

type ContractData struct {
	Locations []serviceability.Location
	Devices   []serviceability.Device
	Exchanges []serviceability.Exchange
	Links     []serviceability.Link
	Users     []serviceability.User
}

func FetchContractData

func FetchContractData(ctx context.Context, programId string, rpcEndpoint string) (*ContractData, error)

type DeviceCache

type DeviceCache struct {
	Devices []serviceability.Device
	Lock    sync.Mutex
}

type LatencyManager

type LatencyManager struct {
	SmartContractFunc SmartContractorFunc
	ProberFunc        ProberFunc
	DeviceCache       *DeviceCache
	ResultsCache      *LatencyResults
}

func (*LatencyManager) GetDeviceCache

func (l *LatencyManager) GetDeviceCache() []serviceability.Device

func (*LatencyManager) GetResultsCache

func (l *LatencyManager) GetResultsCache() []LatencyResult

func (*LatencyManager) ServeLatency

func (l *LatencyManager) ServeLatency(w http.ResponseWriter, r *http.Request)

func (*LatencyManager) Start

func (l *LatencyManager) Start(ctx context.Context, programId string, rpcEndpoint string, probeInterval, cacheUpdateInterval int) error

type LatencyResult

type LatencyResult struct {
	Min       int64                 `json:"min_latency_ns"`
	Max       int64                 `json:"max_latency_ns"`
	Avg       int64                 `json:"avg_latency_ns"`
	Loss      float64               `json:"loss_percentage"`
	Device    serviceability.Device `json:"-"`
	Reachable bool                  `json:"reachable"`
}

func (*LatencyResult) MarshalJSON

func (l *LatencyResult) MarshalJSON() ([]byte, error)

type LatencyResults

type LatencyResults struct {
	Results []LatencyResult
	Lock    sync.RWMutex `json:"-"`
}

func (*LatencyResults) MarshalJSON

func (l *LatencyResults) MarshalJSON() ([]byte, error)

type SmartContractorFunc

type SmartContractorFunc func(context.Context, string, string) (*ContractData, error)

Jump to

Keyboard shortcuts

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