cache

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: Apache-2.0 Imports: 4 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key added in v1.3.0

func Key(kind EntryKind, hash string) string

Key returns the proper cache key for an entry kind and hash.

func TransformActionCacheKey added in v1.3.0

func TransformActionCacheKey(key, instance string, logger Logger) string

TransformActionCacheKey takes an ActionCache key and an instance name and returns a new ActionCache key to use instead. If the instance name is empty, then the original key is returned unchanged.

Types

type EntryKind

type EntryKind int

EntryKind describes the kind of cache entry

const (
	// AC stands for Action Cache.
	AC EntryKind = iota

	// CAS stands for Content Addressable Storage.
	CAS

	// RAW cache items are not validated. Not exposed externally, only
	// used for HTTP when running with the --disable_http_ac_validation
	// commandline flag.
	RAW
)

func (EntryKind) String

func (e EntryKind) String() string

type Error

type Error struct {
	// Corresponds to a http.Status* code
	Code int
	// A human-readable string describing the error
	Text string
}

Error is used by Cache implementations to return a structured error.

func (*Error) Error

func (e *Error) Error() string

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

Logger is designed to be satisfied by log.Logger.

type Proxy added in v1.1.0

type Proxy interface {
	// Put should make a reasonable effort to proxy this data to the backend.
	// This is allowed to fail silently (eg when under heavy load).
	Put(kind EntryKind, hash string, size int64, rdr io.ReadCloser)

	// Get should return the cache item identified by `hash`, or an error
	// if something went wrong. If the item was not found, the io.ReadCloser
	// will be nil.
	Get(kind EntryKind, hash string) (io.ReadCloser, int64, error)

	// Contains returns whether or not the cache item exists on the
	// remote end, and the size if it exists (and -1 if the size is
	// unknown).
	Contains(kind EntryKind, hash string) (bool, int64)
}

Proxy is the interface that (optional) proxy backends must implement. Implementations are expected to be safe for concurrent use.

Directories

Path Synopsis
Package gcsproxy provides cache implementation that proxies requests to/from Google Cloud Storage (GCS).
Package gcsproxy provides cache implementation that proxies requests to/from Google Cloud Storage (GCS).
Package httpproxy is a cache implementation that can proxy artifacts from/to another HTTP-based remote cache.
Package httpproxy is a cache implementation that can proxy artifacts from/to another HTTP-based remote cache.

Jump to

Keyboard shortcuts

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