cache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetdataRestoreName = "core::restore-name"
)

Variables

View Source
var ErrEntryNotFound = errors.New("entry not found")

Functions

This section is empty.

Types

type CacheID

type CacheID string

CacheID is the ID of the cache.

type CachePutRequest

type CachePutRequest struct {
	Id       CacheID
	Path     string
	URL      string
	Metadata Metadata

	UsePathAsRoot bool
}

type CachedSource

type CachedSource struct {
	Id       CacheID
	Manifest Manifest
	Metadata Metadata
}

type DlCache

type DlCache interface {
	// Resolve resolves the URL to a cache ID.
	Resolve(ctx context.Context, url string, metadata Metadata) (CacheID, error)

	// Get returns the cached source for the given ID.
	Get(ctx context.Context, cid CacheID) (CachedSource, error)

	// Put puts the source to the cache.
	Put(ctx context.Context, req CachePutRequest) (CacheID, error)

	// Restore restores the cached source to the given directory.
	Restore(ctx context.Context, id CacheID, dir string) error

	// Delete deletes the cached source from the cache.
	Delete(ctx context.Context, id CacheID) error
}

type Manifest

type Manifest struct {
	Type Type
	Name string
}

type Metadata

type Metadata map[string]string

Metadata is the metadata of the cache.

Metadata is an additional information about the URL. It is useful for separate same URL to different cache id.

type Type

type Type uint8

Type is the type of the cache.

const (
	TypeUnset Type = iota
	TypeFile
	TypeDir
)

func (Type) String

func (t Type) String() string

Source Files

  • cache.go

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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