Documentation
¶
Overview ¶
Package build owns local file materialization evaluation.
Index ¶
- Constants
- Variables
- func ComparisonKey(path string) string
- func IdentityKey(path string) string
- func ResolvePath(raw, base string, output bool) (string, error)
- type FileSnapshot
- type Materialization
- type MaterializationCommit
- type MaterializationLock
- type MaterializationStore
- type PathKeyResolver
- type PathLockMode
- type PathLockRequest
- type PrepareRequest
- type Session
- func (s *Session) Close(staging string) error
- func (s *Session) Commit(ctx context.Context, staging string) error
- func (s *Session) Evaluate(ctx context.Context) error
- func (s *Session) HasPathOutput() bool
- func (s *Session) InputPaths() map[string]string
- func (s *Session) Metadata() ir.BuildExecution
- func (s *Session) NewAttempt(retry int) (map[string]string, string, error)
- func (s *Session) PublishedOutputs() map[string]string
- func (s *Session) Reused() bool
- func (s *Session) SetResolvedRecipe(step ir.Step, environment map[string]string)
Constants ¶
const MaterializationSchemaVersion = 1
MaterializationSchemaVersion identifies the persisted manifest format.
Variables ¶
var ( // ErrMaterializationNotFound indicates that no committed manifest exists. ErrMaterializationNotFound = errors.New("materialization not found") // ErrMaterializationRecovery indicates that an incomplete commit could not be recovered. ErrMaterializationRecovery = errors.New("materialization recovery failed") )
Functions ¶
func ComparisonKey ¶
ComparisonKey returns the canonical path used for equality and locking.
func IdentityKey ¶
IdentityKey returns the canonical path used to identify one materialization.
Types ¶
type FileSnapshot ¶
type FileSnapshot struct {
Name string `json:"name"`
Path string `json:"path"`
Size int64 `json:"size"`
Digest string `json:"digest"`
}
FileSnapshot is a verified regular-file content snapshot.
func Snapshot ¶
func Snapshot(name, path string) (FileSnapshot, error)
Snapshot hashes a stable regular-file snapshot.
type Materialization ¶
type Materialization struct {
SchemaVersion int `json:"schemaVersion"`
MaterializationKey string `json:"materializationKey"`
CommitID string `json:"commitId"`
DAGName string `json:"dagName"`
StepID string `json:"stepId"`
RecipeDigest string `json:"recipeDigest"`
Fingerprint string `json:"fingerprint"`
Inputs []FileSnapshot `json:"inputs,omitempty"`
Output FileSnapshot `json:"output"`
ProducerRun ir.DAGRunRef `json:"producerRun"`
ProducerAttemptID string `json:"producerAttemptId,omitempty"`
CompletedAt time.Time `json:"completedAt"`
}
Materialization records one committed build output.
type MaterializationCommit ¶
type MaterializationCommit struct {
StagingPath string
FinalPath string
Manifest Materialization
PreserveManifest bool
}
MaterializationCommit describes publication of a staged output and its manifest state.
type MaterializationLock ¶
type MaterializationLock interface {
Release() error
}
MaterializationLock protects all paths involved in one evaluation.
type MaterializationStore ¶
type MaterializationStore interface {
Get(ctx context.Context, key string) (*Materialization, error)
AcquirePaths(ctx context.Context, requests []PathLockRequest) (MaterializationLock, error)
Commit(ctx context.Context, lock MaterializationLock, req MaterializationCommit) error
}
MaterializationStore persists manifests and coordinates path access.
type PathKeyResolver ¶
type PathKeyResolver struct {
// contains filtered or unexported fields
}
PathKeyResolver caches filesystem comparison behavior for one planning or evaluation pass.
func NewPathKeyResolver ¶
func NewPathKeyResolver() *PathKeyResolver
NewPathKeyResolver creates a path comparison key resolver.
func (*PathKeyResolver) ComparisonKey ¶
func (r *PathKeyResolver) ComparisonKey(path string) string
ComparisonKey returns the canonical path used for equality and locking.
type PathLockMode ¶
type PathLockMode string
PathLockMode identifies how a materialization path is protected.
const ( PathLockExclusive PathLockMode = "exclusive" )
type PathLockRequest ¶
type PathLockRequest struct {
Key string
Mode PathLockMode
}
PathLockRequest requests protection for one canonical filesystem path.
type PrepareRequest ¶
type PrepareRequest struct {
DAG *ir.DAG
Step ir.Step
DAGRunID string
AttemptID string
WorkingDir string
RunWorkDir string
Shell []string
Environment map[string]string
HasSecrets bool
NoReuse bool
Dry bool
Deferred bool
ControlDependencyRan bool
ControlTokens map[string]string
}
PrepareRequest contains resolved runtime information used before execution.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session holds path locks and one ready-node materialization decision.
func Prepare ¶
func Prepare(ctx context.Context, store MaterializationStore, request PrepareRequest) (*Session, error)
Prepare acquires path locks for a ready node before its preconditions run.
func (*Session) Evaluate ¶
Evaluate snapshots inputs and selects execution or reuse after preconditions pass.
func (*Session) HasPathOutput ¶
HasPathOutput reports whether the session stages and publishes an output.
func (*Session) InputPaths ¶
InputPaths returns final input paths scoped to the step.
func (*Session) Metadata ¶
func (s *Session) Metadata() ir.BuildExecution
Metadata returns the current persisted decision metadata.
func (*Session) NewAttempt ¶
NewAttempt allocates a fresh absent sibling staging path.
func (*Session) PublishedOutputs ¶
PublishedOutputs returns final path outputs after reuse or commit.