Documentation
¶
Overview ¶
Package live caches the response of provider /v1/models calls per (provider, keyID, unfiltered). Filtered entries are pre-gated by the provider's ListModelsPipeline against the key's allowed/blacklisted/aliases; callers reading filtered entries MUST NOT reapply that gate elsewhere or alias-backfill rows will be dropped.
The store is passive — it never calls the network. Callers (the HTTP server after key add/update, or a future background refresher) decide when to fetch and push results in via Upsert.
Index ¶
- type Entry
- type Key
- type Store
- func (s *Store) Invalidate(provider schemas.ModelProvider, keyID string)
- func (s *Store) InvalidateProvider(provider schemas.ModelProvider)
- func (s *Store) ModelsForProvider(provider schemas.ModelProvider) []string
- func (s *Store) Snapshot() map[Key]Entry
- func (s *Store) UnfilteredModelsForProvider(provider schemas.ModelProvider) []string
- func (s *Store) Upsert(provider schemas.ModelProvider, keyID string, unfiltered bool, models []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key struct {
Provider schemas.ModelProvider
KeyID string
Unfiltered bool
}
Key identifies one cached response. KeyID is "" for keyless providers (Vertex workload identity, Bedrock IAM, etc).
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Invalidate ¶
func (s *Store) Invalidate(provider schemas.ModelProvider, keyID string)
Invalidate drops both filtered and unfiltered entries for one key. Called when the key's credential value changes (cached models were computed against the old credential) or when the key is deleted.
func (*Store) InvalidateProvider ¶
func (s *Store) InvalidateProvider(provider schemas.ModelProvider)
InvalidateProvider drops every entry for the provider across all keys and modes. Called on provider delete.
func (*Store) ModelsForProvider ¶
func (s *Store) ModelsForProvider(provider schemas.ModelProvider) []string
ModelsForProvider returns the union of filtered entries for the provider, sorted. Filtered entries are pre-gated so this is the effective allowed set across the provider's keys.
func (*Store) Snapshot ¶
Snapshot returns a defensive copy of every entry for diagnostics. Slices are copied; the returned map is independent of store state.
func (*Store) UnfilteredModelsForProvider ¶
func (s *Store) UnfilteredModelsForProvider(provider schemas.ModelProvider) []string
UnfilteredModelsForProvider returns the union of unfiltered entries — the raw provider catalog with no key-level gating applied.