cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2020 License: Apache-2.0 Imports: 4 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetValidatedActionResult

func GetValidatedActionResult(c Cache, hash string) (*pb.ActionResult, []byte, error)

If `hash` refers to a valid ActionResult with all the dependencies available in the CAS, return it and its serialized value. If not, return nil values. If something unexpected went wrong, return an error.

Types

type Cache

type Cache interface {

	// Put stores a stream of `size` bytes from `rdr` into the cache. If `hash` is
	// not the empty string, and the contents don't match it, a non-nil error is
	// returned.
	Put(kind EntryKind, hash string, size int64, rdr io.Reader) error

	// Get returns an io.ReadCloser with the content of the cache item stored under `hash`
	// and the number of bytes that can be read from it. If the item is not found, `rdr` is
	// nil. If some error occurred when processing the request, then it is returned.
	Get(kind EntryKind, hash string) (rdr io.ReadCloser, sizeBytes int64, err error)

	// Contains returns true if the `hash` key exists in the cache.
	Contains(kind EntryKind, hash string) (ok bool)

	// MaxSize returns the maximum cache size in bytes.
	MaxSize() int64

	// Return the current size of the cache in bytes, and the number of
	// items stored in the cache.
	Stats() (int64, int)
}

Cache is the interface for a generic blob storage backend. Implementers should handle locking internally.

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
	// Like Action Cache, but without ActionResult validation.
	// 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.

Directories

Path Synopsis
Package gcs provides cache implementation that proxies requests to/from Google Cloud Storage (GCS).
Package gcs provides cache implementation that proxies requests to/from Google Cloud Storage (GCS).
Package http is a cache implementation that can proxy artifacts from/to another HTTP-based remote cache
Package http 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