binding

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 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 binding is the domain layer for the HostBinding entity — the first-class join that declares "Model M is served by Host H, via wire adapter A, under upstream name U, priced by Pricing P."

Bindings used to live embedded in model.Spec.Hosts[]. Promoting them to their own entity gives pricing and routing a real row to reference (the embedded array was unaddressable), and lets one Model be bound by many Hosts — including aggregators re-serving another provider's model — without coupling the binding to who owns the Model.

Identity: a binding is a join, owned by no single side, so Owner is system-kind. The (ModelID, HostID) pair is unique — enforced at the DB (UNIQUE constraint) and re-checked in the catalog composition layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	Meta meta.Metadata `json:"metadata" yaml:"metadata"`
	Spec Spec          `json:"spec"     yaml:"spec"`
}

Binding declares how one Host serves one Model.

func (*Binding) IsEnabled

func (b *Binding) IsEnabled() bool

IsEnabled returns true when Enabled is unset or explicitly true.

func (*Binding) Serves

func (b *Binding) Serves(snapshotName string) bool

Serves reports whether this binding is eligible to route requests for the given snapshot name. Empty Snapshots means "all"; otherwise membership.

func (*Binding) Validate

func (b *Binding) Validate() error

Validate runs intra-row rules via the shared meta.Validator and enforces the binding-specific invariants:

  • Adapter defaults to OpenAI when omitted, then must be a valid upstream binding (the dispatch key — see adapters.UpstreamBindingNames).
  • The owner is never a user, team or project: a binding decides which host a model's traffic goes to, so it is shared catalog data.

Cross-entity checks (ModelID/HostID/PricingID resolve; the (model, host) pair is unique; Snapshots name real model snapshots) live in the catalog composition + catalogvalidate layers.

type Spec

type Spec struct {
	ModelID      string        `` /* 159-byte string literal not displayed */
	HostID       string        `json:"hostId"                 yaml:"hostId"                 validate:"required,uuid" doc:"Id of the host serving the model."`
	Adapter      adapters.Name `` /* 191-byte string literal not displayed */
	UpstreamName string        `json:"upstreamName,omitempty" yaml:"upstreamName,omitempty" doc:"Model name sent upstream. Empty sends the model's own name."`
	PricingID    string        `` /* 238-byte string literal not displayed */
	Enabled      *bool         `` /* 129-byte string literal not displayed */
	// Snapshots optionally narrows which of the Model's snapshots this Host
	// serves. Empty/nil means "all snapshots"; a non-empty list filters
	// routing to those names only.
	Snapshots []string `` /* 127-byte string literal not displayed */
}

Spec carries the (model, host) join plus the per-host serving terms: the wire adapter, the upstream model name, an optional Pricing ref, and an optional snapshot subset. Cross-refs are stored as ids (the manifest layer resolves names↔ids); PricingID is optional.

Jump to

Keyboard shortcuts

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