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 ¶
- func HashFileHashes(fileHashes map[turbopath.AnchoredUnixPath]string) (string, error)
- func HashGlobalHashable(global *GlobalHashable) (string, error)
- func HashLockfilePackages(packages []lockfile.Package) (string, error)
- func HashMessage(msg *capnp.Message) (string, error)
- func HashTaskHashable(task *TaskHashable) (string, error)
- type GlobalHashable
- type TaskHashable
- type TaskOutputs
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 ¶
HashLockfilePackages hashes lockfile packages
func HashMessage ¶
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 ¶
TaskOutputs represents the patterns for including and excluding files from outputs