cache

package
v0.0.0-...-39d5f47 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {

	// Put stores a stream of `size` bytes from `r` into the cache. If `expectedSha256` is
	// not the empty string, and the contents don't match it, an error is returned
	Put(key string, size int64, expectedSha256 string, r io.Reader) error

	// Get writes the content of the cache item stored under `key` to `w`. If the item is
	// not found, it returns ok = false.
	Get(key string, actionCache bool) (data io.ReadCloser, sizeBytes int64, err error)

	// Contains returns true if the `key` exists.
	Contains(key string, actionCache bool) (ok bool)

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

	// CurrentSize returns the current cache size in bytes.
	CurrentSize() int64

	// NumItems returns the number of items stored in the cache.
	NumItems() int
}

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

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
A Cache implementation that can read and write through artifacts to another remote http cache.
A Cache implementation that can read and write through artifacts to another remote http cache.

Jump to

Keyboard shortcuts

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