modcache

package
v0.13.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package modcache provides a file-based cache for modules.

WARNING: THIS PACKAGE IS EXPERIMENTAL. ITS API MAY CHANGE AT ANY TIME.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveAll

func RemoveAll(dir string) error

RemoveAll removes a directory written by the cache, first applying any permission changes needed to do so.

Types

type Cache

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

func New

func New(registry *modregistry.Client, dir string) (*Cache, error)

New returns r wrapped inside a caching layer that stores persistent cached content inside the given OS directory, typically ${CUE_CACHE_DIR}.

The `module.SourceLoc.FS` fields in the locations returned by the registry implement the `OSRootFS` interface, allowing a caller to find the native OS filepath where modules are stored.

The returned type implements [modconfig.Registry] and [modconfig.CachedRegistry].

func (*Cache) Fetch

func (c *Cache) Fetch(ctx context.Context, mv module.Version) (module.SourceLoc, error)

Fetch returns the location of the contents for the given module version, downloading it if necessary.

func (*Cache) FetchFromCache

func (c *Cache) FetchFromCache(mv module.Version) (module.SourceLoc, error)

FetchFromCache implements cuelang.org/go/mod/modconfig.CachedRegistry.

func (*Cache) ModuleVersions

func (c *Cache) ModuleVersions(ctx context.Context, mpath string) ([]string, error)

ModuleVersions implements [modload.Registry.ModuleVersions].

func (*Cache) Requirements

func (c *Cache) Requirements(ctx context.Context, mv module.Version) ([]module.Version, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳