cache

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package cache implements opt-in, per-task content-hash caching for tasks carrying [cache(inputs=[...], outputs=[...])]. There is NO timestamp-based skipping (Principle I): a task is skipped iff its fingerprint matches the stored one AND every declared output exists. Every decision is logged (cached/running) by the caller; corruption is treated as a miss, never an error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(root string) error

Clear removes the project-local cache directory.

func Store

func Store(spec Spec, hash, createdAt string) error

Store writes the fingerprint record after a successful run. createdAt is informational only and never part of the hash.

Types

type Decision

type Decision struct {
	Skip       bool
	Hash       string
	InputFiles []string
}

Decision is the result of evaluating the cache for a task.

func Decide

func Decide(spec Spec) (Decision, error)

Decide computes the current fingerprint and reports whether the task may be skipped (hash matches the stored record AND all outputs exist).

type Fingerprint

type Fingerprint struct {
	Key       string   `json:"key"`
	Namespace string   `json:"namespace"`
	Hash      string   `json:"hash"`
	Inputs    []string `json:"inputs"`
	Outputs   []string `json:"outputs"`
	Executor  string   `json:"executor"`
	CreatedAt string   `json:"createdAt"`
}

Fingerprint is the on-disk cache record (contracts/cache-fingerprint.md).

type Spec

type Spec struct {
	Key       string            // task name (display)
	Namespace string            // mod namespace ("" at top level)
	Root      string            // directory containing the Runefile (cache + glob base)
	Inputs    []string          // input glob patterns
	Outputs   []string          // output path patterns
	Body      string            // raw body text (pre-interpolation)
	Vars      map[string]string // resolved variables/params referenced by the task
	Executor  string            // executor identity (e.g. "sh" or "python:[python3]")
}

Spec describes a cacheable task invocation.

Jump to

Keyboard shortcuts

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