fs

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package fs provides file system adapters for walking and hashing files.

Index

Constants

View Source
const (
	// WalkerNodeID is the unique identifier for the FS walker Graft node.
	WalkerNodeID graft.ID = "adapter.fs.walker"
	// ResolverNodeID is the unique identifier for the FS input resolver Graft node.
	ResolverNodeID graft.ID = "adapter.fs.resolver"
	// HasherNodeID is the unique identifier for the FS hasher Graft node.
	HasherNodeID graft.ID = "adapter.fs.hasher"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

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

Hasher provides hashing functionality for tasks and files.

func NewHasher

func NewHasher(walker *Walker) *Hasher

NewHasher creates a new Hasher.

func (*Hasher) ComputeFileHash

func (h *Hasher) ComputeFileHash(path string) (uint64, error)

ComputeFileHash computes the XXHash of a file's content.

func (*Hasher) ComputeInputHash

func (h *Hasher) ComputeInputHash(task *domain.Task, env map[string]string, inputs []string) (string, error)

ComputeInputHash computes a single hash representing the task configuration, environment, and input files.

func (*Hasher) ComputeOutputHash

func (h *Hasher) ComputeOutputHash(outputs []string, root string) (string, error)

ComputeOutputHash computes the hash of the output files or directories. Note: Unlike task inputs/outputs, the output file list comes from filesystem traversal or executor results, which are not guaranteed to be in a deterministic order. Therefore, we must explicitly sort the list before hashing to ensure consistency.

type Resolver

type Resolver struct{}

Resolver implements the InputResolver interface using filepath.Glob.

func NewResolver

func NewResolver() *Resolver

NewResolver creates a new Resolver.

func (*Resolver) ResolveInputs

func (r *Resolver) ResolveInputs(inputs []string, root string) ([]string, error)

ResolveInputs resolves the given input patterns to a list of concrete file paths.

type Walker

type Walker struct{}

Walker provides file walking functionality.

func NewWalker

func NewWalker() *Walker

NewWalker creates a new Walker.

func (*Walker) WalkFiles

func (w *Walker) WalkFiles(root string, ignores []string) iter.Seq[string]

WalkFiles yields all files in the root directory, skipping .git and ignored directories. It returns an iterator that yields file paths relative to the root (or absolute if root is absolute, but typically WalkDir yields paths including root). Actually, filepath.WalkDir yields paths starting with root.

Jump to

Keyboard shortcuts

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