Documentation
¶
Index ¶
- Constants
- func ChangedServerKeysByUpdatedAt(cached, live []market.ServerDescriptor) map[string]bool
- func ExtractActionVersions(detailTools []market.DetailTool) map[string]string
- func HasActionVersionChanged(cached map[string]string, detailTools []market.DetailTool) bool
- func IsNotExist(err error) bool
- func ShouldRevalidate(now, savedAt time.Time) bool
- type DetailSnapshot
- type Freshness
- type RegistrySnapshot
- type Store
- func (s *Store) DeleteDetail(partition, serverKey string) error
- func (s *Store) DeleteTools(partition, serverKey string) error
- func (s *Store) ListToolsCacheEntries(partition string) ([]ToolsCacheEntrySummary, error)
- func (s *Store) LoadDetail(partition, serverKey string) (DetailSnapshot, Freshness, error)
- func (s *Store) LoadRegistry(partition string) (RegistrySnapshot, Freshness, error)
- func (s *Store) LoadTools(partition, serverKey string) (ToolsSnapshot, Freshness, error)
- func (s *Store) PurgeDiscoveryData() ([]string, error)
- func (s *Store) QuarantinePartition(partition string) (string, error)
- func (s *Store) SaveDetail(partition, serverKey string, snapshot DetailSnapshot) error
- func (s *Store) SaveRegistry(partition string, snapshot RegistrySnapshot) error
- func (s *Store) SaveTools(partition, serverKey string, snapshot ToolsSnapshot) error
- type ToolsCacheEntrySummary
- type ToolsSnapshot
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func ChangedServerKeysByUpdatedAt ¶
func ChangedServerKeysByUpdatedAt(cached, live []market.ServerDescriptor) map[string]bool
ChangedServerKeysByUpdatedAt returns the set of live server keys that should be refreshed because they are new or their existing registry updatedAt value changed. This intentionally uses only existing market registry metadata.
func ExtractActionVersions ¶
func ExtractActionVersions(detailTools []market.DetailTool) map[string]string
ExtractActionVersions builds a tool-name → actionVersion map from detail tools.
func HasActionVersionChanged ¶
func HasActionVersionChanged(cached map[string]string, detailTools []market.DetailTool) bool
HasActionVersionChanged compares cached actionVersion strings against the versions reported by a fresh Detail API response. It returns true when at least one tool's version has changed, signalling that the tools cache should be refreshed even if the TTL has not expired.
func IsNotExist ¶
func ShouldRevalidate ¶
ShouldRevalidate reports whether a still-valid snapshot is old enough to merit a live revalidation attempt before trusting it as the current truth.
Types ¶
type DetailSnapshot ¶
type DetailSnapshot struct {
SavedAt time.Time `json:"saved_at"`
MCPID int `json:"mcp_id"`
Payload json.RawMessage `json:"payload"`
}
type RegistrySnapshot ¶
type RegistrySnapshot struct {
SavedAt time.Time `json:"saved_at"`
Servers []market.ServerDescriptor `json:"servers"`
}
type Store ¶
func (*Store) DeleteDetail ¶
DeleteDetail removes the cached detail snapshot for a server.
func (*Store) DeleteTools ¶
DeleteTools removes the cached tools snapshot for a server, forcing a re-fetch on the next DiscoverServerRuntime call.
func (*Store) ListToolsCacheEntries ¶
func (s *Store) ListToolsCacheEntries(partition string) ([]ToolsCacheEntrySummary, error)
ListToolsCacheEntries walks the cache directory and returns a summary for each server whose tools snapshot is cached.
func (*Store) LoadDetail ¶
func (s *Store) LoadDetail(partition, serverKey string) (DetailSnapshot, Freshness, error)
func (*Store) LoadRegistry ¶
func (s *Store) LoadRegistry(partition string) (RegistrySnapshot, Freshness, error)
func (*Store) LoadTools ¶
func (s *Store) LoadTools(partition, serverKey string) (ToolsSnapshot, Freshness, error)
func (*Store) PurgeDiscoveryData ¶ added in v1.0.36
PurgeDiscoveryData deletes the discovery-derived cache for every partition under the cache root, leaving unrelated data that shares the root (e.g. the upgrade download cache in "downloads/") untouched. Returns the names of the partition directories that had data removed. Removal errors are collected into the returned error but do not stop the sweep.
func (*Store) QuarantinePartition ¶ added in v1.0.36
QuarantinePartition moves the entire on-disk cache for a partition aside, renaming it to "<partition>.quarantined", so the next load starts from an empty cache while the poisoned snapshot stays on disk for inspection. Returns the quarantine path, or "" when the partition has no cache on disk. A previous quarantine for the same partition is replaced, so repeated quarantines never accumulate.
func (*Store) SaveDetail ¶
func (s *Store) SaveDetail(partition, serverKey string, snapshot DetailSnapshot) error
func (*Store) SaveRegistry ¶
func (s *Store) SaveRegistry(partition string, snapshot RegistrySnapshot) error
type ToolsCacheEntrySummary ¶
type ToolsCacheEntrySummary struct {
ServerKey string `json:"server_key"`
Freshness Freshness `json:"freshness"`
SavedAt time.Time `json:"saved_at"`
ToolCount int `json:"tool_count"`
TTLRemaining string `json:"ttl_remaining"`
}
ToolsCacheEntrySummary summarises one cached tools snapshot.