Documentation
¶
Overview ¶
Package host is the domain layer for the Host entity — a serving endpoint the relay forwards requests to. Examples: openai-direct (api.openai.com), bedrock-us-east-1 (AWS Bedrock in that region), azure-prod-eastus (one Azure OpenAI deployment), together, groq, fireworks. Each represents a distinct URL + auth combination.
Hosts are operator-defined infrastructure (Owner.Kind=system). HostKeys belong to Hosts. Which Hosts can serve a Model is declared by standalone HostBinding entities (app/binding), not on the Model.
Storage: not yet wired to PG (needs a new hosts table + sqlc queries). The catalog composition layer consumes a HostLister interface; tests supply in-memory fakes. The real Store will land alongside the schema migration.
store.go is the data-access layer for Host. It maps Host domain structs to and from the sqlc-generated row types. Metadata JSONB encoding is delegated to app/meta; this file only knows about Host's Spec.
Store is concrete — no interface declared here. Consumers (snapshot composer, admin handlers, seed) each declare their own narrow interface locally if they want a test seam.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct {
Meta meta.Metadata `json:"metadata" yaml:"metadata"`
Spec Spec `json:"spec" yaml:"spec"`
}
Host is a single upstream serving endpoint.
type Spec ¶
type Spec struct {
// BaseURL is the upstream root. Required.
BaseURL string `json:"baseURL" yaml:"baseURL" validate:"required,http_url"`
// Backend is the free-form bag of backend-specific config (Bedrock region,
// Azure deployment, Vertex project/location, etc.). Each provider client
// reads the keys it needs and ignores the rest. Optional.
Backend map[string]string `json:"backend,omitempty" yaml:"backend,omitempty"`
// Policies is the host's menu of upstream tier Policy ids a HostKey can
// mirror. Every entry must be a Policy with Meta.Owner = {kind:host, id:
// <this host's id>}. The composition layer enforces the menu invariant.
Policies []string `json:"policies,omitempty" yaml:"policies,omitempty"`
// DefaultPolicy is the Policy id from Policies a HostKey inherits when
// its Spec.PolicyID is empty. Must be one of Policies. Optional — if
// empty, HostKey.Spec.PolicyID becomes required.
DefaultPolicy string `json:"defaultPolicy,omitempty" yaml:"defaultPolicy,omitempty"`
// Enabled defaults to true when nil.
Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
// Display metadata — operator-set, optional.
HomepageURL string `json:"homepageURL,omitempty" yaml:"homepageURL,omitempty" validate:"omitempty,http_url"`
DocsURL string `json:"docsURL,omitempty" yaml:"docsURL,omitempty" validate:"omitempty,http_url"`
ConsoleURL string `json:"consoleURL,omitempty" yaml:"consoleURL,omitempty" validate:"omitempty,http_url"`
StatusPageURL string `json:"statusPageURL,omitempty" yaml:"statusPageURL,omitempty" validate:"omitempty,http_url"`
Icon *meta.Icon `json:"icon,omitempty" yaml:"icon,omitempty"`
}
Spec carries the routing + display fields.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the Host data-access type. Holds a sqlc Queries handle.
func NewStore ¶
NewStore constructs a Store from an existing sqlc Queries handle. The caller owns the pgxpool / transaction; Store performs no connection mgmt.
func (*Store) Delete ¶
Delete removes a Host by id. sqlc returns nil on a no-rows delete; callers can pre-check existence via the snapshot if they need a 404.