lcache

package
v0.0.0-...-8e6cb86 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const LatestDir = "latest"

Variables

View Source
var ArtifactSkip = errors.New("skip artifact")
View Source
var ErrFileModifiedSinceHashing = errors.New("modified since hashing")
View Source
var ErrFileModifiedWhileHashing = errors.New("modified while hashing")

Functions

func GenArtifact

func GenArtifact(ctx context.Context, dir string, a ArtifactWithProducer, compress bool, progress func(percent float64)) error

func SanitizeTargetName

func SanitizeTargetName(s string) string

func UncompressedPathFromArtifact

func UncompressedPathFromArtifact(ctx context.Context, target graph.Targeter, artifact artifacts.Artifact, dir string, size int64) (string, error)

Types

type ActualFileCollector

type ActualFileCollector interface {
	PopulateActualFiles(ctx context.Context, t *Target, outputs []string) error
}

type ActualFileCollectorDir

type ActualFileCollectorDir struct {
	Dir string
}

func (ActualFileCollectorDir) PopulateActualFiles

func (c ActualFileCollectorDir) PopulateActualFiles(ctx context.Context, target *Target, outputs []string) error

type ActualOutNamedPaths

type ActualOutNamedPaths = tgt.NamedPaths[xfs.RelPaths, xfs.RelPath]

type ArtifactGenContext

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

func (*ArtifactGenContext) EstimatedWriteSize

func (g *ArtifactGenContext) EstimatedWriteSize(size int64)

func (*ArtifactGenContext) Writer

func (g *ArtifactGenContext) Writer() io.Writer

type ArtifactManifest

type ArtifactManifest struct {
	Size int64
}

type ArtifactProducer

type ArtifactProducer interface {
	Gen(ctx context.Context, gctx *ArtifactGenContext) error
}

type ArtifactWithProducer

type ArtifactWithProducer interface {
	artifacts.Artifact
	ArtifactProducer
}

type LocalCacheState

type LocalCacheState struct {
	Location        *vfsos.Location
	Path            xfs.Path
	Targets         *graph.Targets
	Metas           *TargetMetas[*Target]
	Root            *hroot.State
	Observability   *observability.Observability
	Finalizers      *finalizers.Finalizers
	EnableGC        bool
	ParallelCaching bool
	Pool            *worker.Pool
}

func NewState

func NewState(root *hroot.State, pool *worker.Pool, targets *graph.Targets, obs *observability.Observability, finalizers *finalizers.Finalizers, gc, parallelCaching bool) (*LocalCacheState, error)

func (*LocalCacheState) ArtifactExists

func (e *LocalCacheState) ArtifactExists(ctx context.Context, target graph.Targeter, artifact artifacts.Artifact) (bool, error)

func (*LocalCacheState) ArtifactManifest

func (e *LocalCacheState) ArtifactManifest(ctx context.Context, target graph.Targeter, artifact artifacts.Artifact) (ArtifactManifest, bool, error)

func (*LocalCacheState) CleanTarget

func (e *LocalCacheState) CleanTarget(target specs.Specer, async bool) error

func (*LocalCacheState) Expand

func (e *LocalCacheState) Expand(ctx context.Context, ttarget graph.Targeter, outputs []string) (xfs.Path, error)

func (*LocalCacheState) GC

func (e *LocalCacheState) GC(ctx context.Context, flog func(string, ...interface{}), dryrun bool) error

func (*LocalCacheState) GCTargets

func (e *LocalCacheState) GCTargets(targets []*graph.Target, flog func(string, ...interface{}), dryrun bool) error

func (*LocalCacheState) GenArtifacts deprecated

func (e *LocalCacheState) GenArtifacts(ctx context.Context, gtarget graph.Targeter, arts []ArtifactWithProducer, compress bool) error

Deprecated: use ScheduleGenArtifacts instead

func (*LocalCacheState) GetLocalCache

func (e *LocalCacheState) GetLocalCache(ctx context.Context, target *graph.Target, outputs []string, withRestoreCache, onlyMeta, skipSpan, uncompress bool) (bool, error)

func (*LocalCacheState) HasArtifact

func (e *LocalCacheState) HasArtifact(ctx context.Context, target graph.Targeter, artifact artifacts.Artifact, skipSpan bool) (bool, error)

func (*LocalCacheState) HashInput

func (e *LocalCacheState) HashInput(target graph.Targeter) (string, error)

func (*LocalCacheState) HashOutput

func (e *LocalCacheState) HashOutput(target graph.Targeter, output string) (string, error)
func (e *LocalCacheState) IsCodegenLink(path string) bool

func (*LocalCacheState) LatestArtifactManifest

func (e *LocalCacheState) LatestArtifactManifest(ctx context.Context, target graph.Targeter, artifact artifacts.Artifact) (ArtifactManifest, bool)

func (*LocalCacheState) LatestCacheDirExists

func (e *LocalCacheState) LatestCacheDirExists(target specs.Specer) bool

func (*LocalCacheState) LatestUncompressedPathFromArtifact

func (e *LocalCacheState) LatestUncompressedPathFromArtifact(ctx context.Context, target graph.Targeter, artifact artifacts.Artifact) (string, ArtifactManifest, error)

func (*LocalCacheState) LinkLatestCache

func (e *LocalCacheState) LinkLatestCache(target specs.Specer, hash string) error

func (*LocalCacheState) LockAllArtifacts

func (e *LocalCacheState) LockAllArtifacts(ctx context.Context, target graph.Targeter) (func(), error)

func (*LocalCacheState) LockArtifact

func (e *LocalCacheState) LockArtifact(ctx context.Context, target graph.Targeter, artifact artifacts.Artifact) (func(), error)

func (*LocalCacheState) LockArtifacts

func (e *LocalCacheState) LockArtifacts(ctx context.Context, target graph.Targeter, artifacts []artifacts.Artifact) (func(), error)

func (*LocalCacheState) LockPath

func (e *LocalCacheState) LockPath(target graph.Targeter, resource string) string

func (*LocalCacheState) PopulateActualFiles

func (e *LocalCacheState) PopulateActualFiles(ctx context.Context, target *Target, outputs []string) error

func (*LocalCacheState) Post

func (e *LocalCacheState) Post(ctx context.Context, target *graph.Target, outputs []string) error

func (*LocalCacheState) RegisterRemove

func (e *LocalCacheState) RegisterRemove(target graph.Targeter)

func (*LocalCacheState) ResetCacheHashInput

func (e *LocalCacheState) ResetCacheHashInput(spec specs.Specer)

func (*LocalCacheState) ScheduleGenArtifacts

func (e *LocalCacheState) ScheduleGenArtifacts(ctx context.Context, gtarget graph.Targeter, arts []ArtifactWithProducer, compress bool) (_ *worker.WaitGroup, rerr error)

func (*LocalCacheState) StoreCache

func (e *LocalCacheState) StoreCache(ctx context.Context, ttarget graph.Targeter, arts []ArtifactWithProducer, compress bool) (rerr error)

func (*LocalCacheState) Target

func (e *LocalCacheState) Target(ctx context.Context, target graph.Targeter, o TargetOpts) (*Target, error)

func (*LocalCacheState) UncompressedPathFromArtifact

func (e *LocalCacheState) UncompressedPathFromArtifact(ctx context.Context, target graph.Targeter, artifact artifacts.Artifact) (string, ArtifactManifest, error)

func (*LocalCacheState) UncompressedReaderFromArtifact

func (e *LocalCacheState) UncompressedReaderFromArtifact(ctx context.Context, artifact artifacts.Artifact, target graph.Targeter) (io.ReadCloser, ArtifactManifest, error)

func (*LocalCacheState) VFSLocation

func (e *LocalCacheState) VFSLocation(target graph.Targeter) (vfs.Location, error)

func (*LocalCacheState) VerifyHashInput

func (e *LocalCacheState) VerifyHashInput(target graph.Targeter) (string, error)

VerifyHashInput will make sure files haven't been changed since last hashing

type Target

type Target struct {
	*graph.Target
	// contains filtered or unexported fields
}

func (*Target) ActualOutFiles

func (t *Target) ActualOutFiles() *ActualOutNamedPaths

func (*Target) ActualRestoreCacheFiles

func (t *Target) ActualRestoreCacheFiles() xfs.RelPaths

func (*Target) ActualSupportFiles

func (t *Target) ActualSupportFiles() xfs.RelPaths

func (*Target) HasActualOutFiles

func (t *Target) HasActualOutFiles() bool

func (*Target) OutExpansionRoot

func (t *Target) OutExpansionRoot() xfs.Path

func (*Target) String

func (t *Target) String() string

type TargetMetas

type TargetMetas[T any] struct {
	// contains filtered or unexported fields
}

func NewTargetMetas

func NewTargetMetas[T any](factory func(k targetMetaKey) T) *TargetMetas[T]

func (*TargetMetas[T]) Delete

func (m *TargetMetas[T]) Delete(spec specs.Specer)

func (*TargetMetas[T]) Find

func (m *TargetMetas[T]) Find(gtarget graph.Targeter) T

func (*TargetMetas[T]) Len

func (m *TargetMetas[T]) Len() int

func (*TargetMetas[T]) Reset

func (m *TargetMetas[T]) Reset()

type TargetOpts

type TargetOpts struct {
	ActualFilesCollector        ActualFileCollector
	ActualFilesCollectorOutputs []string
}

Jump to

Keyboard shortcuts

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