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) Serves ¶
Serves reports whether this binding is eligible to route requests for the given snapshot name. Empty Snapshots means "all"; otherwise membership.
func (*Binding) Validate ¶
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.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the HostBinding data-access type.