buildcache

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

ErrNotFound is returned when a cache entry does not exist.

Functions

This section is empty.

Types

type ActionEntry

type ActionEntry struct {
	OutputID string `json:"output_id"` // hex-encoded output ID from the go tool
	BlobHash string `json:"blob_hash"` // canonical blob ref: "blake3:<hex>"
	Size     int64  `json:"size"`      // blob size in bytes
}

ActionEntry records the mapping from an actionID to a stored blob.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler implements the build cache HTTP API.

GET /buildcache/{actionID} → streams blob body with X-Output-ID + Content-Length headers PUT /buildcache/{actionID}?output_id= → stores blob, returns 204

func NewHandler

func NewHandler(index *Index, store store.Store, opts ...HandlerOption) *Handler

NewHandler creates a new build cache handler.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerOption

type HandlerOption func(*Handler)

HandlerOption configures a Handler.

func WithLogger

func WithLogger(logger *slog.Logger) HandlerOption

WithLogger sets the logger for the handler.

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index manages the actionID → blob mapping using metadb envelope storage.

func NewIndex

func NewIndex(entries *metadb.EnvelopeIndex) *Index

NewIndex creates a new build cache index backed by the given envelope index.

func (*Index) Get

func (idx *Index) Get(ctx context.Context, actionID string) (*ActionEntry, error)

Get retrieves the entry for the given actionID.

func (*Index) Put

func (idx *Index) Put(ctx context.Context, actionID string, entry *ActionEntry) error

Put stores an entry for the given actionID, referencing the blob.

Jump to

Keyboard shortcuts

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