Documentation
¶
Index ¶
- func DownloadHandler(service Service, cacheDir string, opts MachineOptions) http.HandlerFunc
- func FileHandler(service Service, cacheDir string, opts MachineOptions) http.HandlerFunc
- func ManifestHandler(service Service, cacheDir string, opts MachineOptions) http.HandlerFunc
- func ParseOlderDuration(value string) (time.Duration, error)
- func ValidRoot(root string) bool
- type CacheMirrorStatus
- type CacheScanOptions
- type CleanOptions
- type CleanResult
- type CleanSkip
- type Entry
- type Kind
- type KindSummary
- type ListFile
- type ListOptions
- type ListResult
- type MachineOptions
- type Manifest
- type ManifestCache
- type ManifestFile
- type ManifestServer
- type Service
- func (s Service) ApplyClean(preview CleanResult) (CleanResult, error)
- func (s Service) Clean(cacheDir string, opts CleanOptions) (CleanResult, error)
- func (s Service) List(cacheDir string, opts ListOptions) (ListResult, error)
- func (s Service) PreviewClean(cacheDir string, opts CleanOptions) (CleanResult, error)
- func (s Service) ResolveCacheDir() (string, error)
- func (s Service) Scan(cacheDir string, opts CacheScanOptions) ([]Entry, error)
- func (s Service) Status(cacheDir string) (StatusResult, error)
- type StatusResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadHandler ¶ added in v1.11.0
func DownloadHandler(service Service, cacheDir string, opts MachineOptions) http.HandlerFunc
DownloadHandler serves /download/<path-md5 key>, the protocol eget clients use to fetch a cached file by content path.
func FileHandler ¶ added in v1.11.0
func FileHandler(service Service, cacheDir string, opts MachineOptions) http.HandlerFunc
FileHandler serves /files/<relative path> for direct browsing.
func ManifestHandler ¶ added in v1.11.0
func ManifestHandler(service Service, cacheDir string, opts MachineOptions) http.HandlerFunc
ManifestHandler serves the cache manifest at /manifest.json.
Types ¶
type CacheMirrorStatus ¶ added in v1.7.5
type CacheScanOptions ¶
type CleanOptions ¶
type CleanResult ¶
type CleanResult struct {
CacheDir string `json:"cache_dir"`
MatchedFiles int `json:"matched_files"`
RemovedFiles int `json:"removed_files"`
MatchedSize int64 `json:"matched_size"`
RemovedSize int64 `json:"removed_size"`
KeptLatestFiles int `json:"kept_latest_files"`
UnrecognizedFiles int `json:"unrecognized_files"`
Skipped []CleanSkip `json:"skipped"`
// contains filtered or unexported fields
}
func (CleanResult) NeedsConfirmation ¶
func (r CleanResult) NeedsConfirmation() bool
type KindSummary ¶ added in v1.7.5
type ListOptions ¶ added in v1.7.5
type ListOptions struct {
Root string
}
type ListResult ¶ added in v1.7.5
type MachineOptions ¶ added in v1.11.0
MachineOptions configures the machine endpoints (/manifest.json, /download/*, /files/*). Authentication is the caller's job: `eget web` wraps these handlers with its own token middleware, so no token lives here.
type Manifest ¶
type Manifest struct {
Schema int `json:"schema"`
Server ManifestServer `json:"server"`
Cache ManifestCache `json:"cache"`
Files []ManifestFile `json:"files"`
}
Manifest is the JSON cache index eget clients use as a cache mirror source.
type ManifestCache ¶
type ManifestFile ¶
type ManifestServer ¶
type Service ¶
func (Service) ApplyClean ¶ added in v1.9.0
func (s Service) ApplyClean(preview CleanResult) (CleanResult, error)
ApplyClean removes only unchanged files captured by PreviewClean.
func (Service) Clean ¶
func (s Service) Clean(cacheDir string, opts CleanOptions) (CleanResult, error)
func (Service) List ¶ added in v1.7.5
func (s Service) List(cacheDir string, opts ListOptions) (ListResult, error)
func (Service) PreviewClean ¶
func (s Service) PreviewClean(cacheDir string, opts CleanOptions) (CleanResult, error)
func (Service) ResolveCacheDir ¶
type StatusResult ¶ added in v1.7.5
type StatusResult struct {
CacheDir string `json:"cache_dir"`
GeneratedAt time.Time `json:"generated_at"`
TotalFiles int `json:"total_files"`
TotalSize int64 `json:"total_size"`
Kinds map[string]KindSummary `json:"kinds"`
ServeCommand string `json:"serve_command"`
CacheMirror CacheMirrorStatus `json:"cache_mirror"`
}
Click to show internal directories.
Click to hide internal directories.