hash

package
v0.0.0-...-0a43815 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package hash contains the capnp schema and hashing functions for the turbo cache

it depends on the generated capnp schema in ./capnp. to regenerate the schema, you need the capnp binary as well as capnpc-go available in your path. then run:

capnp compile -I std -ogo proto.capnp

in crates/turborepo-lib/src/hash or run `make turbo-capnp` in the `cli` directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashFileHashes

func HashFileHashes(fileHashes map[turbopath.AnchoredUnixPath]string) (string, error)

HashFileHashes hashes files

func HashGlobalHashable

func HashGlobalHashable(global *GlobalHashable) (string, error)

HashGlobalHashable performs the hash for a GlobalHashable, using capnproto for stable cross platform / language hashing

NOTE: This function is _explicitly_ ordered and should not be sorted.

		Order is important for the hash, and is as follows:
		- GlobalCacheKey
		- GlobalFileHashMap
		- RootExternalDepsHash
   - Env
   - ResolvedEnvVars
   - PassThroughEnv
   - EnvMode
   - FrameworkInference
   - DotEnv

func HashLockfilePackages

func HashLockfilePackages(packages []lockfile.Package) (string, error)

HashLockfilePackages hashes lockfile packages

func HashMessage

func HashMessage(msg *capnp.Message) (string, error)

HashMessage hashes a capnp message using xxhash

func HashTaskHashable

func HashTaskHashable(task *TaskHashable) (string, error)

HashTaskHashable performs the hash for a TaskHashable, using capnproto for stable cross platform / language hashing

NOTE: This function is _explicitly_ ordered and should not be sorted.

	Order is important for the hash, and is as follows:
	- GlobalHash
	- PackageDir
	- HashOfFiles
	- ExternalDepsHash
	- Task
	- EnvMode
	- Outputs
	- TaskDependencyHashes
	- PassThruArgs
	- Env
	- PassThroughEnv
 - DotEnv
 - ResolvedEnvVars

Types

type GlobalHashable

type GlobalHashable struct {
	GlobalCacheKey       string
	GlobalFileHashMap    map[turbopath.AnchoredUnixPath]string
	RootExternalDepsHash string
	Env                  []string
	ResolvedEnvVars      env.EnvironmentVariablePairs
	PassThroughEnv       []string
	EnvMode              util.EnvMode
	FrameworkInference   bool

	// NOTE! This field is _explicitly_ ordered and should not be sorted.
	DotEnv turbopath.AnchoredUnixPathArray
}

GlobalHashable is a hashable representation of global dependencies for tasks

type TaskHashable

type TaskHashable struct {
	GlobalHash           string
	TaskDependencyHashes []string
	HashOfFiles          string
	ExternalDepsHash     string

	PackageDir   turbopath.AnchoredUnixPath
	Task         string
	Outputs      TaskOutputs
	PassThruArgs []string

	Env             []string
	ResolvedEnvVars env.EnvironmentVariablePairs
	PassThroughEnv  []string
	EnvMode         util.EnvMode
	DotEnv          turbopath.AnchoredUnixPathArray
}

TaskHashable is a hashable representation of a task to be run

type TaskOutputs

type TaskOutputs struct {
	Inclusions []string
	Exclusions []string
}

TaskOutputs represents the patterns for including and excluding files from outputs

func (*TaskOutputs) Sort

func (to *TaskOutputs) Sort()

Sort contents of task outputs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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