server

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package server is the Connect translation layer over the transport-neutral service implementations (CONSTRAINTS C13), with one adapter per service and each method a pure unwrap/call/wrap plus the sentinel-to-code mapping in toConnectErr. No business logic lives here, so another transport (grpc-gateway, a real gRPC server) would be a sibling package wrapping the same service/ implementations.

Index

Constants

View Source
const SnapshotRefreshedHeader = "Agni-Snapshot-Refreshed"

SnapshotRefreshedHeader is the response header naming the tiers a refreshed snapshot found changed, comma-separated, when a question read a snapshot again rather than refusing it as stale (agni issue 1639). A snapshot refreshes only when its definition sets refresh.

View Source
const TimingHeader = "Agni-Timing"

TimingHeader is the request header that asks for a request's timing, and the response header that carries it back as a RequestTiming in protojson. A value containing "explain" also asks each query evaluation for its plan, and one containing "memory" asks each stage for the memory as it ended.

Variables

This section is empty.

Functions

func ConnectError added in v0.2.4

func ConnectError(err error) *connect.Error

ConnectError converts a service error to its wire form. It maps the service tier's error sentinels to Connect codes and adds a query's syntax-error position as a detail. An unclassified error is treated as an invalid argument, the service tier's documented default (load/parse failures). The CLI writes a failed request through it under --format json, so a script reading the CLI and a client reading the API see one error shape.

func SlowLine added in v0.2.2

func SlowLine(procedure string, over time.Duration, s timing.Snapshot) string

SlowLine is the log line for one slow request: what took longest, which tier answered each cached read, the slowest rules, and the plan when evaluating a query was the slowest stage.

Types

type API added in v0.2.2

type API struct {
	Workspace *service.WorkspaceService
	Project   *service.ProjectService
	// Snapshot ingests designs, and every other service answers questions about them (agni issue
	// 1061). It must hold the same ProjectResolver as they do, or a question names a snapshot that
	// none of them holds.
	Snapshot   *service.SnapshotService
	DesignView *service.DesignViewService
	// Design serves the stored designs, "designs/{design}" (agni issue 1694). Nil serves an empty
	// catalog that refuses every write.
	Design *service.DesignService
	// Pack serves the stored packs, "packs/{pack}" (agni issue 1704). Nil serves none and refuses
	// every write.
	Pack *service.PackService
	// Connection serves the sign-ins private sources are read through, "connections/{connection}"
	// (agni issue 1724). Nil serves none and refuses a write.
	Connection *service.ConnectionService
	Check      *service.CheckService
	Diff       *service.DiffService
	Query      *service.QueryService
	Review     *service.ReviewService
	// Info answers ServerService.GetServerInfo (agni issue 1629). Nil answers this build's version and
	// the snapshot features alone, as the browser engine does.
	Info *service.ServerInfoService
	// Timing times the requests that ask, and logs the slow ones (agni issue 914). Its zero value
	// still answers a request that asks with the Agni-Timing header.
	Timing Timing
	// Hooks run inside Timing around every service's requests, so a host can act on what a request
	// names. `agni serve` warms a design's browser-engine seed this way (agni issue 1572).
	Hooks []connect.Interceptor
}

API is the set of services one host serves over Connect. `agni serve` and the wasm engine both register through it, so the two cannot serve different lists of handlers. TableService holds no state, so it has no field here and every host serves it.

func (API) Register added in v0.2.2

func (a API) Register(mux *http.ServeMux, queryOpts ...connect.HandlerOption) []string

Register mounts every service on mux and returns the paths it registered, in a fixed order. queryOpts apply to the services that evaluate queries (check, query, review). A deployment's query budget attaches to those services.

type Budget added in v0.2.2

type Budget struct {
	// Enforce caps each evaluation's work. Zero enforces nothing, so a deployment can watch what its
	// queries cost (Warn) before it chooses a cap.
	Enforce int64
	// Warn is the work above which a query is logged with its cost and a suggested cap. Zero logs
	// nothing.
	Warn int64
	// Log receives each line. Nil discards them.
	Log func(format string, args ...any)
}

Budget is the work budget a server applies to every query it evaluates, and how it reports the queries that cost the most (agni issue 792). Work is what a fact base counts. It counts candidate comparisons, each row a generator emits, and the connections a circuit walk examines.

func (Budget) Interceptor added in v0.2.2

func (b Budget) Interceptor() connect.UnaryInterceptorFunc

Interceptor sets the budget on every request's context. The request's queries and query-backed rules read it there. A request may narrow the budget but never raise it. Interceptor also logs each query whose reported work passes Warn, and each one the budget stopped.

type Check

type Check struct {
	webapiconnect.UnimplementedCheckServiceHandler
	// contains filtered or unexported fields
}

Check adapts service.CheckService to the generated Connect handler interface.

func NewCheck

func NewCheck(svc *service.CheckService) *Check

NewCheck wraps svc for Connect.

func (*Check) RenderCheckReport added in v0.2.2

type Connection added in v0.9.0

type Connection struct {
	webapiconnect.UnimplementedConnectionServiceHandler
	// contains filtered or unexported fields
}

Connection adapts service.ConnectionService to the generated Connect handler interface (agni issue 1724).

func NewConnection added in v0.9.0

func NewConnection(svc *service.ConnectionService) *Connection

NewConnection wraps svc for Connect.

func (*Connection) CreateConnection added in v0.9.0

func (*Connection) DeleteConnection added in v0.9.0

func (*Connection) GetConnection added in v0.9.0

func (*Connection) ListConnections added in v0.9.0

type Design

type Design struct {
	webapiconnect.UnimplementedDesignServiceHandler
	// contains filtered or unexported fields
}

Design adapts service.DesignService to the generated Connect handler interface.

func NewDesign

func NewDesign(svc *service.DesignService) *Design

NewDesign wraps svc for Connect.

func (*Design) AddDesigns added in v0.9.0

func (*Design) CreateDesign added in v0.9.0

func (*Design) CreateReport added in v0.9.0

func (*Design) DeleteArtifact added in v0.9.0

func (*Design) DeleteDesign added in v0.9.0

func (*Design) DeleteReport added in v0.9.0

func (*Design) GetArtifact added in v0.9.0

func (*Design) GetDesign

func (*Design) GetReport added in v0.9.0

func (*Design) ImportDesignFiles added in v0.9.0

func (*Design) LinkArtifact added in v0.9.0

func (*Design) ListArtifacts added in v0.9.0

func (*Design) ListDesigns added in v0.9.0

func (*Design) ListReports added in v0.9.0

func (*Design) SyncDesign added in v0.9.0

func (*Design) UnlinkArtifact added in v0.9.0

func (*Design) UpdateArtifact added in v0.9.0

func (*Design) UpdateDesign added in v0.9.0

type DesignView added in v0.9.0

type DesignView struct {
	webapiconnect.UnimplementedDesignViewServiceHandler
	// contains filtered or unexported fields
}

DesignView adapts service.DesignViewService to the generated Connect handler interface.

func NewDesignView added in v0.9.0

func NewDesignView(svc *service.DesignViewService) *DesignView

NewDesignView wraps svc for Connect.

func (*DesignView) GetBoardGeometry added in v0.9.0

func (*DesignView) GetBoardMeshes added in v0.9.0

func (*DesignView) GetLayoutReport added in v0.9.0

func (*DesignView) GetSheet added in v0.9.0

func (*DesignView) GetSummary added in v0.9.0

func (*DesignView) HighlightSheet added in v0.9.0

func (*DesignView) ListWalkKinds added in v0.9.0

func (*DesignView) LocateSubjects added in v0.9.0

func (*DesignView) ReachablePins added in v0.9.0

func (*DesignView) TraceDesign added in v0.9.0

func (*DesignView) WalkDesign added in v0.9.0

type Diff

type Diff struct {
	webapiconnect.UnimplementedDiffServiceHandler
	// contains filtered or unexported fields
}

Diff adapts service.DiffService to the generated Connect handler interface.

func NewDiff

func NewDiff(svc *service.DiffService) *Diff

NewDiff wraps svc for Connect.

type Lexicon added in v0.4.0

type Lexicon struct {
	webapiconnect.UnimplementedLexiconServiceHandler
	// contains filtered or unexported fields
}

Lexicon adapts service.LexiconService to the generated Connect handler interface.

func NewLexicon added in v0.4.0

func NewLexicon(svc *service.LexiconService) *Lexicon

NewLexicon wraps svc for Connect.

func (*Lexicon) CompareLexicons added in v0.4.0

func (*Lexicon) ExplainNet added in v0.4.0

func (*Lexicon) GetLexicon added in v0.4.0

func (*Lexicon) RenderConvention added in v0.4.0

type Pack added in v0.9.0

type Pack struct {
	webapiconnect.UnimplementedPackServiceHandler
	// contains filtered or unexported fields
}

Pack adapts service.PackService to the generated Connect handler interface (agni issue 1704).

func NewPack added in v0.9.0

func NewPack(svc *service.PackService) *Pack

NewPack wraps svc for Connect.

func (*Pack) CreatePack added in v0.9.0

func (*Pack) DeletePack added in v0.9.0

func (*Pack) GetPack added in v0.9.0

func (*Pack) ImportPackFiles added in v0.9.0

func (*Pack) ListPacks added in v0.9.0

func (*Pack) UpdatePack added in v0.9.0

type Project added in v0.2.0

type Project struct {
	webapiconnect.UnimplementedProjectServiceHandler
	// contains filtered or unexported fields
}

Project adapts service.ProjectService to the generated Connect handler interface.

func NewProject added in v0.2.0

func NewProject(svc *service.ProjectService) *Project

NewProject wraps svc for Connect.

func (*Project) CreateProject added in v0.9.0

func (*Project) DeleteProject added in v0.9.0

func (*Project) GetProject added in v0.2.0

func (*Project) ListProjects added in v0.2.0

func (*Project) ResolveDesign added in v0.2.0

func (*Project) UpdateProject added in v0.9.0

type Query

type Query struct {
	webapiconnect.UnimplementedQueryServiceHandler
	// contains filtered or unexported fields
}

Query adapts service.QueryService to the generated Connect handler interface.

func NewQuery

func NewQuery(svc *service.QueryService) *Query

NewQuery wraps svc for Connect.

func (*Query) ListQuerySets added in v0.2.2

func (*Query) ParseQuerySet added in v0.2.2

func (*Query) RunQueries added in v0.2.2

type Review

type Review struct {
	webapiconnect.UnimplementedReviewServiceHandler
	// contains filtered or unexported fields
}

Review adapts service.ReviewService to the generated Connect handler interface.

func NewReview

func NewReview(svc *service.ReviewService) *Review

NewReview wraps svc for Connect.

func (*Review) CreateReview added in v0.2.0

func (*Review) DeleteReview added in v0.2.0

func (*Review) GetReview added in v0.2.0

func (*Review) GetReviewManifest added in v0.2.0

func (*Review) ListChecklists added in v0.2.2

func (*Review) ListReviews added in v0.2.0

func (*Review) RenderReviewReport added in v0.2.2

type ServerInfo added in v0.8.0

type ServerInfo struct {
	webapiconnect.UnimplementedServerServiceHandler
	// contains filtered or unexported fields
}

ServerInfo adapts service.ServerInfoService to the generated Connect handler interface.

func NewServerInfo added in v0.8.0

func NewServerInfo(svc *service.ServerInfoService) *ServerInfo

NewServerInfo wraps a ServerInfoService.

func (*ServerInfo) GetServerInfo added in v0.8.0

type Snapshot added in v0.3.0

type Snapshot struct {
	webapiconnect.UnimplementedSnapshotServiceHandler
	// contains filtered or unexported fields
}

Snapshot adapts service.SnapshotService to the generated Connect handler interface.

func NewSnapshot added in v0.3.0

func NewSnapshot(svc *service.SnapshotService) *Snapshot

NewSnapshot wraps svc for Connect.

func (*Snapshot) DeleteSnapshot added in v0.3.0

func (*Snapshot) GetSnapshot added in v0.3.0

func (*Snapshot) Ingest added in v0.3.0

func (*Snapshot) ListSnapshots added in v0.3.0

func (*Snapshot) UpdateSnapshot added in v0.3.0

func (*Snapshot) UploadBlobs added in v0.3.0

type Table added in v0.2.2

type Table struct {
	webapiconnect.UnimplementedTableServiceHandler
	// contains filtered or unexported fields
}

Table adapts service.TableService to the generated Connect handler interface.

func NewTable added in v0.2.2

func NewTable() *Table

NewTable wraps the projection service for Connect. It holds no state, so it takes none.

func (*Table) Encode added in v0.2.2

func (*Table) Tabulate added in v0.2.2

type Timing added in v0.2.2

type Timing struct {
	// Slow logs every request that takes longer, with the stage that took the most, the tier that
	// answered each cached read, the slowest rules, and the plan when evaluation was the slowest
	// stage. Zero logs nothing.
	Slow time.Duration
	// Log receives each line. Nil discards them.
	Log func(format string, args ...any)
}

Timing times requests and reports where their time went (agni issue 914). A request is timed when it asks (the Agni-Timing header) or when Slow is set, and a request that asked gets its breakdown in the Agni-Timing and Server-Timing response headers.

func (Timing) Interceptor added in v0.2.2

func (t Timing) Interceptor() connect.UnaryInterceptorFunc

Interceptor returns the timing interceptor. A request that neither asks nor could be slow-logged passes straight through.

type ViewerRoom added in v0.3.9

type ViewerRoom struct {
	webapiconnect.UnimplementedViewerRoomServiceHandler
	// contains filtered or unexported fields
}

ViewerRoom adapts service.ViewerRoomService to the generated Connect handler interface. `agni serve` registers it only under --viewer-rooms (agni issue 1154), so it is not part of API.

func NewViewerRoom added in v0.3.9

func NewViewerRoom(svc *service.ViewerRoomService) *ViewerRoom

NewViewerRoom wraps svc for Connect.

func (*ViewerRoom) JoinViewerRoom added in v0.3.9

type Workspace

type Workspace struct {
	webapiconnect.UnimplementedWorkspaceServiceHandler
	// contains filtered or unexported fields
}

Workspace adapts service.WorkspaceService to the generated Connect handler interface. The embedded Unimplemented handler keeps newly generated RPCs returning CodeUnimplemented until wired, so adding a proto method never breaks the build.

func NewWorkspace

func NewWorkspace(svc *service.WorkspaceService) *Workspace

NewWorkspace wraps svc for Connect.

func (*Workspace) CreateMount added in v0.9.0

func (*Workspace) DeclareCompanion added in v0.5.0

func (*Workspace) DeleteMount added in v0.9.0

func (*Workspace) GetMount added in v0.9.0

func (*Workspace) ListDesignFiles added in v0.2.2

func (*Workspace) ProposeDesigns added in v0.2.2

Jump to

Keyboard shortcuts

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