cache

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BundleMetadata

type BundleMetadata struct {
	URL       string `json:"url"`
	Version   string `json:"version,omitempty"` // Version tag (e.g., "agent-claude-v0.3.0")
	Checksum  string `json:"checksum"`
	Size      int64  `json:"size"`
	CachedAt  int64  `json:"cached_at"`
	FetchedAt int64  `json:"fetched_at,omitempty"` // When this version was fetched (for staleness check)
}

BundleMetadata stores information about a cached bundle

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache manages agent bundle storage and aliases

func New

func New(cacheDir string) *Cache

New creates a new cache instance

func (*Cache) GetAlias

func (c *Cache) GetAlias(name string) (string, error)

GetAlias retrieves a URL by alias name

func (*Cache) GetBundle

func (c *Cache) GetBundle(url, checksum string) (string, error)

GetBundle retrieves a cached bundle

func (*Cache) GetLatestAgentMetadata

func (c *Cache) GetLatestAgentMetadata() (*LatestAgentMetadata, error)

GetLatestAgentMetadata retrieves the cached latest agent metadata

func (*Cache) IsLatestAgentStale

func (c *Cache) IsLatestAgentStale() bool

IsLatestAgentStale checks if the cached latest agent metadata is stale Returns true if metadata is missing, older than 24 hours, or has empty version

func (*Cache) ListAliases

func (c *Cache) ListAliases() (map[string]string, error)

ListAliases returns all configured aliases

func (*Cache) RemoveAlias

func (c *Cache) RemoveAlias(name string) error

RemoveAlias removes an alias

func (*Cache) SetAlias

func (c *Cache) SetAlias(name, url string) error

SetAlias stores an alias for a URL

func (*Cache) SetLatestAgentMetadata

func (c *Cache) SetLatestAgentMetadata(metadata *LatestAgentMetadata) error

SetLatestAgentMetadata stores the latest agent metadata

func (*Cache) StoreBundle

func (c *Cache) StoreBundle(url, checksum string, reader io.Reader, size int64) (string, error)

StoreBundle stores a downloaded bundle in the cache

func (*Cache) StoreBundleWithVersion

func (c *Cache) StoreBundleWithVersion(url, checksum string, reader io.Reader, size int64, version string) (string, error)

StoreBundleWithVersion stores a downloaded bundle in the cache with version info

type LatestAgentMetadata

type LatestAgentMetadata struct {
	Version   string `json:"version"`    // Version tag (e.g., "agent-claude-v0.3.0")
	URL       string `json:"url"`        // Download URL
	Checksum  string `json:"checksum"`   // SHA256 checksum
	FetchedAt int64  `json:"fetched_at"` // When this was fetched (for staleness check)
}

LatestAgentMetadata stores metadata about the latest known agent version

Jump to

Keyboard shortcuts

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