cache

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(service Service, cacheDir string, opts ServeOptions) http.Handler

func ParseOlderDuration

func ParseOlderDuration(value string) (time.Duration, error)

func ValidRoot

func ValidRoot(root string) bool

Types

type CacheScanOptions

type CacheScanOptions struct {
	Kinds []Kind
	Root  string
}

type CleanOptions

type CleanOptions struct {
	Older  time.Duration
	All    bool
	DryRun bool
	Yes    bool
	Kinds  []Kind
}

type CleanResult

type CleanResult struct {
	CacheDir     string
	MatchedFiles int
	RemovedFiles int
	MatchedSize  int64
	RemovedSize  int64
	Skipped      []CleanSkip
}

func (CleanResult) NeedsConfirmation

func (r CleanResult) NeedsConfirmation() bool

type CleanSkip

type CleanSkip struct {
	Path   string
	Reason string
}

type Entry

type Entry struct {
	Kind      Kind
	Path      string
	RelPath   string
	Size      int64
	ModTime   time.Time
	IsPartial bool
}

type Kind

type Kind string
const (
	KindPkg      Kind = "pkg"
	KindAPI      Kind = "api"
	KindSDK      Kind = "sdk"
	KindSDKIndex Kind = "sdk-index"
	KindPartial  Kind = "partial"
)

type Manifest

type Manifest struct {
	Schema int            `json:"schema"`
	Server ManifestServer `json:"server"`
	Cache  ManifestCache  `json:"cache"`
	Files  []ManifestFile `json:"files"`
}

type ManifestCache

type ManifestCache struct {
	Root        string    `json:"root"`
	GeneratedAt time.Time `json:"generated_at"`
}

type ManifestFile

type ManifestFile struct {
	Kind    string    `json:"kind"`
	Path    string    `json:"path"`
	URL     string    `json:"url"`
	Size    int64     `json:"size"`
	ModTime time.Time `json:"mod_time"`
}

type ManifestServer

type ManifestServer struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	BaseURL string `json:"base_url"`
}

type ServeOptions

type ServeOptions struct {
	Host    string
	Port    int
	Root    string
	NoIndex bool
	Version string
}

type Service

type Service struct {
	Config *cfgpkg.File
	Now    func() time.Time
}

func (Service) Clean

func (s Service) Clean(cacheDir string, opts CleanOptions) (CleanResult, error)

func (Service) PreviewClean

func (s Service) PreviewClean(cacheDir string, opts CleanOptions) (CleanResult, error)

func (Service) ResolveCacheDir

func (s Service) ResolveCacheDir() (string, error)

func (Service) Scan

func (s Service) Scan(cacheDir string, opts CacheScanOptions) ([]Entry, error)

Jump to

Keyboard shortcuts

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