live

package
v1.3.21 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Models []string
}

Entry is a single cached response.

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 New

func New(logger schemas.Logger) *Store

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

func (s *Store) Snapshot() map[Key]Entry

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.

func (*Store) Upsert

func (s *Store) Upsert(provider schemas.ModelProvider, keyID string, unfiltered bool, models []string)

Upsert stores a successful fetch.

Jump to

Keyboard shortcuts

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