graphqlwiring

package
v1.131.1 Latest Latest
Warning

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

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

Documentation

Overview

Package graphqlwiring attaches the platform's dependencies to the live graphql toolkits and brings their schemas up.

It exists here rather than on the platform facade for the reason the other seams under internal/platform do: the facade is at its size budget, and a connection kind's wiring is cohesive enough to own its own file. pkg/platform keeps one thin entry point that assembles the dependencies it holds and hands them over.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachExport added in v1.131.1

func AttachExport(reg *registry.Registry, deps *graphqlkit.ExportDeps)

AttachExport enables graphql_export on every live graphql toolkit. A nil deps leaves the tool unregistered, which is what a deployment with no portal wants.

Separate from Wire, and called from a much earlier point in the boot sequence, because a toolkit registers its export tool only when the dependencies are already set: the platform registers every toolkit's tools before it reaches Wire, so attaching here would leave the name in the toolkit's Tools() list and the tool unknown to every client (#1675).

func ReloadStoredSchema added in v1.131.1

func ReloadStoredSchema(ctx context.Context, reg *registry.Registry, name string)

ReloadStoredSchema installs the stored schema on every live graphql toolkit holding the connection. The reload bus calls it when a peer replica stored a schema, an upload or a re-read, so every replica answers from the store rather than from whatever its own last read left it with (#1676). The endpoint is not touched: the store already holds the answer.

func Toolkits

func Toolkits(reg *registry.Registry) []*graphqlkit.Toolkit

Toolkits returns the live graphql toolkits in a registry.

func Wire

func Wire(ctx context.Context, d Deps)

Wire attaches every dependency and then reads each connection's schema: the stored one when the store holds it, a fresh introspection otherwise. Schemas are read last because the read goes through the connection's own credential and its own transport, both of which the steps above install.

Every step is nil-safe and idempotent, so Wire is safe to call once per boot whatever the deployment is missing.

Types

type Deps

type Deps struct {
	// Registry holds the live toolkits.
	Registry *registry.Registry
	// DB backs the schema store and the operation-embedding reads. Nil
	// keeps schemas in memory for the process's life.
	DB *sql.DB
	// Embedder embeds a caller's query for semantic and hybrid ranking.
	Embedder embedding.Provider
	// RoutePolicy authorizes one operation. Nil leaves the platform's
	// tool and connection gates as the only ones.
	RoutePolicy *routepolicy.Policy
	// OAuthStore and AuthEvents back the authorization_code grant.
	OAuthStore connoauth.Store
	AuthEvents *authevents.Writer
	// MemBudget is the process-wide in-flight response budget, shared
	// with the other buffered gateway kinds.
	MemBudget *membudget.Budget
	// Metrics instruments outbound calls.
	Metrics *observability.Metrics
}

Deps is everything the graphql kind needs from the platform. Every field is optional: a deployment with no database, no embedding provider or no portal still runs graphql connections, with the capabilities those dependencies enable absent rather than the connection broken.

Jump to

Keyboard shortcuts

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