MCPcopy Index your code
hub / github.com/docker/docker-agent / Store

Struct Store

pkg/modelsdev/store.go:40–56  ·  view source on GitHub ↗

Store manages access to the models.dev data. All methods are safe for concurrent use. The database is loaded on first access via GetDatabase and then cached in memory for the lifetime of the Store.

Source from the content-addressed store, hash-verified

38// The database is loaded on first access via GetDatabase and
39// then cached in memory for the lifetime of the Store.
40type Store struct {
41 cacheFile string
42 knownProvider func(string) bool
43 // fetch retrieves the catalog from the network. It defaults to
44 // fetchFromAPI and is overridable via WithFetcher so tests can stub the
45 // network out without mutating package-level state.
46 fetch fetcher
47 mu sync.Mutex
48 // db is the authoritative catalog from the full (fetch-eligible) load path.
49 db *Database
50 // cacheDB is a cache-only snapshot served to fetch-disallowed lookups. It is
51 // kept separate from db because it may be empty or stale and must never
52 // satisfy a later fetch-eligible lookup for a known provider; memoizing it
53 // keeps the hot path from re-reading and re-parsing the catalog file on
54 // every custom-provider resolution.
55 cacheDB *Database
56}
57
58// Opt configures a Store created with NewStore.
59type Opt func(*storeOptions)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected