server

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package server serves the embedded web dashboard and canonical analytics API.

Index

Constants

View Source
const DefaultHost = networkprefs.DefaultHost
View Source
const DefaultPort = networkprefs.DefaultPort

Variables

This section is empty.

Functions

func Listen added in v0.1.5

func Listen(host string, port int) (net.Listener, error)

Listen binds only the web/API server.

func NewDataHandler added in v0.1.5

func NewDataHandler(ctx context.Context, store DataSource, log io.Writer, bindHost, instance string, allowIngestion bool) http.Handler

Local compositions expose writes only through their private control socket.

func NewDataHandlerWithOptions added in v0.1.5

func NewDataHandlerWithOptions(ctx context.Context, store DataSource, log io.Writer, options DataHandlerOptions) http.Handler

func NewPersonalDataHandler added in v0.1.5

func NewPersonalDataHandler(ctx context.Context, store DataSource, log io.Writer, host, instance string, progress *collectorprogress.Registry) http.Handler

func ValidateHost

func ValidateHost(host string) error

Types

type DataHandlerOptions added in v0.1.5

type DataHandlerOptions struct {
	Host, InstanceID, Hostname string
	AllowIngestion             bool
	Policy                     serverfeatures.Policy
	Accounts                   *accounts.Service
	PublicURL                  string
	Progress                   *collectorprogress.Registry
	ProcessUsage               ProcessUsage
}

type DataSource added in v0.1.5

type DataSource interface {
	Kind() string
	Receiver(datasetID string) evidence.Receiver
	Queries(datasetID string) analytics.Repository
}

DataSource binds storage ports to an authenticated dataset. Composition selects the adapter once; HTTP never opens databases or selects a backend from a request. Receiver and Queries must use the same database/dataset identity. Scoping never creates a dataset or falls back to another dataset when it is absent.

type DirectQuery added in v0.1.5

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

DirectQuery adapts the same query validation, analytics and presentation used by REST without constructing HTTP requests or opening a listener.

func NewDirectQuery added in v0.1.5

func NewDirectQuery(source analytics.Repository, instance, hostname string) *DirectQuery

func (*DirectQuery) AllUsage added in v0.1.5

func (d *DirectQuery) AllUsage(ctx context.Context, params api.GetUsageParams, maxRows int) (api.UsageResponseV2, error)

AllUsage is composed for local viewers only; REST retains bounded pages.

func (*DirectQuery) Facets added in v0.1.5

func (*DirectQuery) Instance added in v0.1.5

func (d *DirectQuery) Instance(ctx context.Context) (api.InstanceResponseV2, error)

func (*DirectQuery) Status added in v0.1.5

func (*DirectQuery) Usage added in v0.1.5

type Options

type Options struct {
	Defaults   viewer.Selection
	InstanceID string
	Hostname   string
}

type ProcessUsage added in v0.1.5

type ProcessUsage interface {
	Snapshot(context.Context) processusage.Sample
}

ProcessUsage samples the command-owned process; missing measurements remain unknown.

type Row

type Row = analytics.Row

Directories

Path Synopsis
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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