api

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package api defines the wire contract between the edge and the central.

Index

Constants

View Source
const (
	PathHealth      = "/healthz"
	PathAssignments = "/v1/assignments"
	PathResults     = "/v1/results"
)

Paths of the edge API, served by the central.

View Source
const (
	KindTCP  = "tcp"
	KindHTTP = "http"
)

Kinds of check.

View Source
const (
	MaxResultsPerBatch = 1000
	MaxErrorLength     = 512
)

Limits shared by both sides.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignments

type Assignments struct {
	Checks []Check `json:"checks"`
}

Assignments is what the central answers to an edge poll.

type Check

type Check struct {
	ID              string `json:"id"`
	Kind            string `json:"kind"`
	Target          string `json:"target"`
	IntervalSeconds int    `json:"interval_seconds"`
}

Check is one measurement an edge runs on a schedule.

func (Check) Validate

func (c Check) Validate() error

Validate reports why a check cannot be run.

type Result

type Result struct {
	CheckID   string    `json:"check_id"`
	At        time.Time `json:"at"`
	OK        bool      `json:"ok"`
	RTTMillis float64   `json:"rtt_millis"`
	Error     string    `json:"error,omitempty"`
}

Result is the outcome of one run of a check.

func (Result) Validate

func (r Result) Validate() error

Validate reports why a result must be refused.

type ResultsRequest

type ResultsRequest struct {
	Results []Result `json:"results"`
}

ResultsRequest is a batch of results posted by an edge.

func (ResultsRequest) Validate

func (r ResultsRequest) Validate() error

Validate reports why a batch must be refused.

Jump to

Keyboard shortcuts

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