Documentation
¶
Overview ¶
Package treestamp is a native Go library for deterministic repository scanning.
It selects files under ignore and filter rules, hashes selected content, and explains why a path was kept or dropped. Start with ScanWith, ScanPathsWith, EachFile, or Compile. Explain is selection only; it does not re-read file bytes.
Requires Go 1.21 or newer. The command-line app is the nested module github.com/sergii-ziborov/treestamp/cmd/treestamp.
Index ¶
- Constants
- Variables
- func CollapsePathPrefixes(prefixes []string) []string
- func DirEntryDepth(entry fs.DirEntry) int
- func FindRepositoryRoot(start string) string
- func IsNotImplemented(err error) bool
- func IsSameOrDescendant(path, prefix string) bool
- func MinimumScratchBufferSize() int
- func NameSort(a, b os.DirEntry) int
- func NewParallelMultiWalker(root string) *parallelMulti
- func NewScratchBuffer() []byte
- func NewStatefulWalkBuilder[R, E any](root string, rootState R) *walk.StatefulWalkBuilder[R, E]
- func PathCoveredByPrefixes(path string, prefixes []string) bool
- func ReadDirents(dirname string) ([]os.DirEntry, error)
- func ReadDirentsScratch(dirname string, scratch []byte) ([]os.DirEntry, error)
- func ReadDirnames(dirname string, scratch []byte) ([]string, error)
- func SafeCause(err error) string
- func ScanPaths(ctx context.Context, root string) ([]string, error)
- func ScanPathsFS(ctx context.Context, fsys fs.FS, root string, opts ...Option) ([]string, error)
- func ScanPathsWith(ctx context.Context, root string, opts ...Option) ([]string, error)
- func StatDirEntry(path string, entry fs.DirEntry) (fs.FileInfo, error)
- func Walk(root string, fn WalkDirFunc) error
- func WalkDefault(root string, fn WalkDirFunc) error
- func WalkDirs(root string, opts DirWalkOptions) error
- func WalkFS(fsys fs.FS, root string, fn fs.WalkDirFunc) error
- func WalkParallel(root string, workers int, fn walk.WalkFunc) error
- func WalkUnsorted(root string, fn WalkDirFunc) error
- func WalkWithConfig(root string, cfg Config, fn WalkDirFunc) error
- type ByteLimit
- type CacheValidationPolicy
- type CancellationToken
- type ChangedContentVisitOutcome
- type ChangedContentVisitReport
- type CompactContentEvidence
- type CompactScanReport
- type CompactScannedFile
- type Config
- type ContentDiscoveryMode
- type ContentFile
- type ContentFileStatus
- type ContentValidationPolicy
- type ContentVisitControl
- type ContentVisitEvent
- type ContentVisitMode
- type ContentVisitReport
- type ContentVisitor
- type DeltaQuality
- type DirEntry
- type DirScanner
- type DirWalkOptions
- type EntryFilter
- type Error
- type ErrorCode
- type ErrorPolicy
- type EvidenceMode
- type FSEntry
- type FSWalker
- type File
- type FileIdentity
- type FileVersion
- type FileWalker
- func (w *FileWalker) AddRoot(directory string) *FileWalker
- func (w *FileWalker) AllowListExtensions(exts ...string) *FileWalker
- func (w *FileWalker) IgnoreBinaryFiles() *FileWalker
- func (w *FileWalker) IgnoreGitignore() *FileWalker
- func (w *FileWalker) IgnoreIgnoreFile() *FileWalker
- func (w *FileWalker) IncludeHidden(enabled bool) *FileWalker
- func (w *FileWalker) RespectGitModules() *FileWalker
- func (w *FileWalker) SetConcurrency(n int) *FileWalker
- func (w *FileWalker) SetErrorHandler(fn func(error) bool) *FileWalker
- func (w *FileWalker) SetMaxDepth(n int) *FileWalker
- func (w *FileWalker) Start() error
- func (w *FileWalker) Terminate()
- func (w *FileWalker) Walking() bool
- type Filters
- type FullRescanReason
- type IgnoreFile
- type IgnorePolicy
- func (p IgnorePolicy) WithCustomIgnore(enabled bool) IgnorePolicy
- func (p IgnorePolicy) WithDotIgnore(enabled bool) IgnorePolicy
- func (p IgnorePolicy) WithExplicitFile(path string) IgnorePolicy
- func (p IgnorePolicy) WithGitExclude(enabled bool) IgnorePolicy
- func (p IgnorePolicy) WithGitGlobal(enabled bool) IgnorePolicy
- func (p IgnorePolicy) WithGitIgnore(enabled bool) IgnorePolicy
- func (p IgnorePolicy) WithParentRules(enabled bool) IgnorePolicy
- func (p IgnorePolicy) WithRequireGit(enabled bool) IgnorePolicy
- type IgnoreSourceEvidence
- type IgnoreSourceKind
- type ModifiedFile
- type MultiContentVisitReport
- type MultiScanReport
- type MultiScanner
- func (m *MultiScanner) AddRoot(root string) *MultiScanner
- func (m *MultiScanner) Options(options Options) *MultiScanner
- func (m *MultiScanner) Scan(ctx context.Context) (*MultiScanReport, error)
- func (m *MultiScanner) VisitContent(ctx context.Context, factory func(root, worker int) ContentVisitor) (*MultiContentVisitReport, error)
- func (m *MultiScanner) WithAdmitTimeout(d time.Duration) *MultiScanner
- func (m *MultiScanner) WithRootParallelism(n int) *MultiScanner
- type MultiWalker
- type NamedFileTypes
- type Option
- func Using(opts Options) Option
- func WithAdmitTimeout(d time.Duration) Option
- func WithDetectBinary(on bool) Option
- func WithExcludeGlobs(globs ...string) Option
- func WithExtensions(exts ...string) Option
- func WithFailFast() Option
- func WithFilenameRegex(patterns ...string) Option
- func WithHashContents(on bool) Option
- func WithLocationExclude(globs ...string) Option
- func WithLogger(logger *slog.Logger) Option
- func WithMaxFileBytes(n uint64) Option
- func WithNoIgnore() Option
- func WithProgress(fn func(Progress)) Option
- func WithReadLimit(lim ByteLimit) Option
- func WithRequireCache() Option
- func WithScope(globs ...string) Option
- type Options
- func (o Options) MetadataOnly() Options
- func (o Options) SelectedFilesOnly() Options
- func (o Options) WithAdmitTimeout(d time.Duration) Options
- func (o Options) WithCacheValidation(policy CacheValidationPolicy) Options
- func (o Options) WithCancellation(token *CancellationToken) Options
- func (o Options) WithContentDiscovery(mode ContentDiscoveryMode) Options
- func (o Options) WithContentParallelism(n int) Options
- func (o Options) WithContentValidation(policy ContentValidationPolicy) Options
- func (o Options) WithExcludeDirectories(dirs ...string) Options
- func (o Options) WithExcludeDirectoryRegex(patterns ...string) Options
- func (o Options) WithExcludeFilenameRegex(patterns ...string) Options
- func (o Options) WithExcludeFilenames(names ...string) Options
- func (o Options) WithExtensions(exts ...string) Options
- func (o Options) WithFileTypes(types *NamedFileTypes) Options
- func (o Options) WithFilters(filters selection.Filters) Options
- func (o Options) WithGitModules(enabled bool) Options
- func (o Options) WithIgnoreCase(enabled bool) Options
- func (o Options) WithIgnoreFiles(names ...string) Options
- func (o Options) WithIgnorePolicy(policy IgnorePolicy) Options
- func (o Options) WithIncludeFilenameRegex(patterns ...string) Options
- func (o Options) WithIncludeFilenames(names ...string) Options
- func (o Options) WithMaxEntries(n uint64) Options
- func (o Options) WithMaxFileBytes(n uint64) Options
- func (o Options) WithMaxTotalBytes(n uint64) Options
- func (o Options) WithOverrideRules(rules ...string) Options
- func (o Options) WithParallelism(n int) Options
- func (o Options) WithSkipHidden(enabled bool) Options
- func (o Options) WithStandardSkips(enabled bool) Options
- func (o Options) WithTimeout(d time.Duration) Options
- func (o Options) WithTraversalParallelism(n int) Options
- func (o Options) WithVCSSkips(enabled bool) Options
- type ParallelExecutor
- type ParallelJob
- type ParallelMultiVisitReport
- type ParallelMultiWalkEvent
- type ParallelMultiWalkReport
- type ParallelMultiWalker
- type ParallelRuntime
- type ParallelVisitReport
- type ParallelWalkIter
- type ParallelWalkReport
- type ParallelWalker
- type PathExplanation
- type PathQuery
- type Plan
- func (p *Plan) Describe() string
- func (p *Plan) EachFile(ctx context.Context, root string, consume func(ScannedFile, []byte) error) (*ScanSummary, error)
- func (p *Plan) EachFileFS(ctx context.Context, fsys fs.FS, root string, ...) (*ScanSummary, error)
- func (p *Plan) Explain(root, relative string) (PathExplanation, error)
- func (p *Plan) Files(ctx context.Context, root string) func(func(ScannedFile, error) bool)
- func (p *Plan) Scan(ctx context.Context, root string) (*ScanReport, error)
- func (p *Plan) ScanCached(ctx context.Context, root string, cache *ScanCache) (*ScanReport, error)
- func (p *Plan) ScanFS(ctx context.Context, fsys fs.FS, root string) (*ScanReport, error)
- func (p *Plan) ScanPaths(ctx context.Context, root string) ([]string, error)
- func (p *Plan) ScanPathsFS(ctx context.Context, fsys fs.FS, root string) ([]string, error)
- func (p *Plan) WriteDiagnostics(w io.Writer, sum *ScanSummary) error
- type PortableIgnoreSourceEvidence
- type PortableScanReport
- type PortableScanWarning
- type PortableScannedFile
- type PortableSkippedEntry
- type Progress
- type RenamedFile
- type RepositoryMatch
- type RepositoryMatcher
- type RootSymlinkPolicy
- type ScanCache
- type ScanCacheEntry
- type ScanCacheStats
- type ScanDelta
- type ScanDescriptor
- type ScanLimits
- type ScanOptions
- type ScanReport
- func (r *ScanReport) ContentProvider() (*SnapshotContentProvider, error)
- func (r *ScanReport) Delta(current *ScanReport) ScanDelta
- func (r *ScanReport) PortableFilesPage(offset, limit int) []PortableScannedFile
- func (r *ScanReport) Summary() ScanSummary
- func (r *ScanReport) ToCache() ScanCache
- func (r *ScanReport) ToCompact() CompactScanReport
- func (r *ScanReport) ToPortable() PortableScanReport
- type ScanSession
- func (s *ScanSession) ApplyWatchPlan(ctx context.Context, plan WatchPlan) (*ScanReport, error)
- func (s *ScanSession) ApplyWatchPlanWithCancellation(ctx context.Context, plan WatchPlan, cancel *CancellationToken) (*ScanReport, error)
- func (s *ScanSession) FilesPage(generation uint64, offset, limit int) ([]PortableScannedFile, error)
- func (s *ScanSession) Generation() uint64
- func (s *ScanSession) IntoReport() *ScanReport
- func (s *ScanSession) LastUpdateReason() (WatchUpdateReason, bool)
- func (s *ScanSession) Report() *ScanReport
- func (s *ScanSession) Rescan(ctx context.Context) (*ScanReport, error)
- func (s *ScanSession) Root() string
- func (s *ScanSession) TreeRevision() string
- type ScanSink
- type ScanSinkControl
- type ScanSinkFunc
- type ScanStreamReport
- type ScanSummary
- type ScanTermination
- type ScanWarning
- type ScannedFile
- type Scanner
- func (s *Scanner) Explain(rel string) (PathExplanation, error)
- func (s *Scanner) Options(options Options) *Scanner
- func (s *Scanner) Scan(ctx context.Context) (*ScanReport, error)
- func (s *Scanner) ScanCached(ctx context.Context, cache *ScanCache) (*ScanReport, error)
- func (s *Scanner) ScanCompact(ctx context.Context) (*CompactScanReport, error)
- func (s *Scanner) ScanIncremental(ctx context.Context, previous *ScanReport) (*ScanReport, error)
- func (s *Scanner) ScanInto(ctx context.Context, sink ScanSink) (*ScanStreamReport, error)
- func (s *Scanner) ScanPaths(ctx context.Context) ([]string, error)
- func (s *Scanner) ScanWatchPlan(ctx context.Context, previous *ScanReport, plan WatchPlan) (*ScanReport, error)
- func (s *Scanner) ScanWatchPlanDetailed(ctx context.Context, previous *ScanReport, plan WatchPlan) (*WatchUpdate, error)
- func (s *Scanner) VisitChangedContent(ctx context.Context, plan WatchPlan, factory func(worker int) ContentVisitor) (ChangedContentVisitOutcome, error)
- func (s *Scanner) VisitContent(ctx context.Context, factory func(worker int) ContentVisitor) (*ContentVisitReport, error)
- func (s *Scanner) VisitContentManifest(ctx context.Context, factory func(worker int) ContentVisitor) (*CompactScanReport, error)
- func (s *Scanner) VisitContentStreaming(ctx context.Context, factory func(worker int) ContentVisitor) (*ContentVisitReport, error)
- type ScannerOption
- type SelectionDecision
- type SelectionDisposition
- type SelectionMatcher
- type SkipKind
- type SkippedEntry
- type SnapshotContent
- type SnapshotContentProvider
- type SnapshotEvidence
- type SnapshotReadError
- type SortMode
- type StandardSkips
- type TreeSnapshot
- type WalkBuilder
- type WalkControl
- type WalkDirFunc
- type WalkEntry
- type WalkError
- type WalkEvent
- type WalkFunc
- type WalkOperation
- type WalkOptions
- type WalkSkipReason
- type Walker
- type WatchEvent
- type WatchEventKind
- type WatchPlan
- type WatchUpdate
- type WatchUpdateReason
- type WatcherEventAdapter
Constants ¶
const ( ScanDescriptorVersion = scan.DescriptorVersion ScanCacheFormatVersion = scan.CacheFormatVersion )
const ( IgnoreGitGlobal = ignore.SourceGitGlobal IgnoreGitExclude = ignore.SourceGitExclude IgnoreGitIgnore = ignore.SourceGitIgnore IgnoreDotIgnore = ignore.SourceDotIgnore IgnoreCustom = ignore.SourceCustom IgnoreExplicit = ignore.SourceExplicit IgnoreOverride = ignore.SourceOverride IgnoreGitModules = ignore.SourceGitModules )
const ( SkipNone = selection.SkipNone SkipBinary = selection.SkipBinary SkipFileSystemBoundary = selection.SkipFileSystemBoundary SkipExtension = selection.SkipExtension SkipIgnored = selection.SkipIgnored SkipIOError = selection.SkipIOError SkipMaxDepth = selection.SkipMaxDepth SkipOversized = selection.SkipOversized SkipPathEscape = selection.SkipPathEscape SkipStandardDirectory = selection.SkipStandardDirectory SkipHidden = selection.SkipHidden SkipOverride = selection.SkipOverride SkipSymlink = selection.SkipSymlink SkipSymlinkLoop = selection.SkipSymlinkLoop SkipScanLimit = selection.SkipScanLimit SkipConcurrentModification = selection.SkipConcurrentModification )
const ( ErrorContinue = walk.ErrorContinue ErrorAbort = walk.ErrorAbort RootFollow = walk.RootFollow RootReject = walk.RootReject DefaultMaxOpen = walk.DefaultMaxOpen OpCanonicalize = walk.OpCanonicalize OpReadDirectory = walk.OpReadDirectory OpReadEntry = walk.OpReadEntry OpReadMetadata = walk.OpReadMetadata OpScheduleWorker = walk.OpScheduleWorker WalkSkipNone = walk.SkipNone WalkSkipMaxDepth = walk.SkipMaxDepth WalkSkipFileSystemBoundary = walk.SkipFileSystemBoundary WalkSkipPathEscape = walk.SkipPathEscape WalkSkipSymlinkLoop = walk.SkipSymlinkLoop WalkContinue = walk.WalkContinue WalkSkip = walk.WalkSkip WalkQuit = walk.WalkQuit WalkTraverseLink = walk.WalkTraverseLink SortNone = 0 SortLexical = 1 SortFilesFirst = 2 SortDirsFirst = 3 SelectedFile = selection.SelectedFile TraverseDirectory = selection.TraverseDirectory Unselected = selection.Unselected RepoMatchNone = ignore.MatchNone RepoMatchIgnore = ignore.MatchIgnore RepoMatchInclude = ignore.MatchInclude RepoOverrideIgnore = ignore.MatchOverrideIgnore RepoOverrideInclude = ignore.MatchOverrideInclude RepoMatchHidden = ignore.MatchHidden )
const Version = "0.1.5"
Version is the library module version published with this tree.
Variables ¶
var ( ErrPartial = dx.ErrPartial ErrStop = dx.ErrStop )
ErrPartial means selected work was incomplete. ErrStop is a deliberate EachFile halt.
var ( SkipDir = fs.SkipDir SkipAll = fs.SkipAll SkipThis = walk.ErrSkipThis ErrSkipFiles = walk.ErrSkipFiles ErrAdmitTimeout = runtime.ErrAdmitTimeout // ErrTraverseLink requests traversal of the callback's directory symlink. ErrTraverseLink = walk.ErrTraverseLink )
var ErrTerminateWalk = errors.New("treestamp terminated")
ErrTerminateWalk is returned when FileWalker.Terminate stops a walk.
Functions ¶
func CollapsePathPrefixes ¶
func DirEntryDepth ¶
DirEntryDepth returns callback depth or -1 for another DirEntry type.
func FindRepositoryRoot ¶
FindRepositoryRoot walks up from start looking for .git or .hg. If none is found it returns the absolute start directory.
func IsNotImplemented ¶
func IsSameOrDescendant ¶
func MinimumScratchBufferSize ¶
func MinimumScratchBufferSize() int
MinimumScratchBufferSize is the reusable getdents buffer floor. It is the page size on Unix and 0 on Windows.
func NewParallelMultiWalker ¶
func NewParallelMultiWalker(root string) *parallelMulti
func NewScratchBuffer ¶
func NewScratchBuffer() []byte
NewScratchBuffer allocates a reusable directory-read buffer.
func NewStatefulWalkBuilder ¶
func NewStatefulWalkBuilder[R, E any](root string, rootState R) *walk.StatefulWalkBuilder[R, E]
func PathCoveredByPrefixes ¶
func ReadDirents ¶
ReadDirents lists one directory. Prefer ReadDirentsScratch in a loop.
func ReadDirentsScratch ¶
ReadDirentsScratch lists one directory using an optional scratch buffer.
func ReadDirnames ¶
ReadDirnames lists child names using an optional scratch buffer.
func ScanPathsFS ¶ added in v0.1.5
ScanPathsFS is ScanPathsWith over an fs.FS. Content options are rejected.
func ScanPathsWith ¶
func StatDirEntry ¶
StatDirEntry returns cached os.Stat metadata when entry supports it.
func Walk ¶
func Walk(root string, fn WalkDirFunc) error
func WalkDefault ¶
func WalkDefault(root string, fn WalkDirFunc) error
func WalkDirs ¶
func WalkDirs(root string, opts DirWalkOptions) error
func WalkUnsorted ¶
func WalkUnsorted(root string, fn WalkDirFunc) error
func WalkWithConfig ¶
func WalkWithConfig(root string, cfg Config, fn WalkDirFunc) error
WalkWithConfig uses serial traversal when deterministic sorting is requested. Sort (bool) is the legacy global-order switch and is not SortMode. A callback may return ErrTraverseLink to select one directory symlink.
Types ¶
type CacheValidationPolicy ¶
type CacheValidationPolicy int
const ( CacheValidationFast CacheValidationPolicy = iota CacheValidationStrict )
type CancellationToken ¶
type CancellationToken struct {
// contains filtered or unexported fields
}
func NewCancellationToken ¶
func NewCancellationToken() *CancellationToken
func (*CancellationToken) Cancel ¶
func (t *CancellationToken) Cancel()
func (*CancellationToken) IsCancelled ¶
func (t *CancellationToken) IsCancelled() bool
type ChangedContentVisitOutcome ¶
type ChangedContentVisitOutcome struct {
Visited *ChangedContentVisitReport
FullRescanRequired bool
}
type ChangedContentVisitReport ¶
type ChangedContentVisitReport struct {
Content ContentVisitReport
Removed []string
}
type CompactContentEvidence ¶
type CompactContentEvidence struct {
ContentHash string `json:"content_hash,omitempty"`
ContentFingerprint string `json:"content_fingerprint,omitempty"`
Version FileVersion `json:"version"`
BinaryChecked bool `json:"binary_checked"`
}
type CompactScanReport ¶
type CompactScanReport struct {
Root string `json:"root"`
Files []CompactScannedFile `json:"files"`
Skipped []SkippedEntry `json:"skipped"`
Warnings []ScanWarning `json:"warnings"`
IgnoreSources []IgnoreSourceEvidence `json:"ignore_sources"`
Revision string `json:"revision"`
Descriptor ScanDescriptor `json:"descriptor"`
Complete bool `json:"complete"`
Termination ScanTermination `json:"termination,omitempty"`
Portable bool `json:"portable"`
Cache ScanCacheStats `json:"cache"`
}
func ScanCompact ¶
func ScanCompact(ctx context.Context, root string) (*CompactScanReport, error)
func (CompactScanReport) AbsolutePath ¶
func (r CompactScanReport) AbsolutePath(file CompactScannedFile) string
func (CompactScanReport) IntoScanReport ¶
func (r CompactScanReport) IntoScanReport() ScanReport
func (*CompactScanReport) Summary ¶
func (r *CompactScanReport) Summary() ScanSummary
func (*CompactScanReport) ToCache ¶
func (r *CompactScanReport) ToCache() ScanCache
type CompactScannedFile ¶
type CompactScannedFile struct {
Relative string `json:"relative"`
Bytes uint64 `json:"bytes"`
ContentHash string `json:"content_hash,omitempty"`
Content *CompactContentEvidence `json:"content,omitempty"`
}
type ContentDiscoveryMode ¶
type ContentDiscoveryMode int
const ( ContentDiscoveryStreaming ContentDiscoveryMode = iota ContentDiscoveryBufferedParallel )
type ContentFile ¶
type ContentFileStatus ¶
type ContentFileStatus int
const ( ContentFileSelected ContentFileStatus = iota ContentFileBinary ContentFileChanged )
type ContentValidationPolicy ¶
type ContentValidationPolicy int
const ( ContentValidationFast ContentValidationPolicy = iota ContentValidationStrict )
type ContentVisitControl ¶
type ContentVisitControl int
const ( ContentVisitContinue ContentVisitControl = iota ContentVisitSkipFile ContentVisitQuit )
type ContentVisitEvent ¶
type ContentVisitEvent struct {
FileStart, Chunk, FileEnd bool
WorkerIndex int
File ContentFile
Offset uint64
Bytes []byte
Status ContentFileStatus
BytesRead uint64
ContentHash string
ConsumerSkipped bool
}
type ContentVisitMode ¶
type ContentVisitMode int
const ( ContentVisitRevision ContentVisitMode = iota ContentVisitStreaming )
type ContentVisitReport ¶
type ContentVisitReport struct {
Mode ContentVisitMode
Root string
Discovered, Completed, Opened, Chunks, BytesRead, BytesEmitted, ConsumerSkipped uint64
Stopped bool
Skipped []SkippedEntry
Warnings []ScanWarning
IgnoreSources []IgnoreSourceEvidence
Revision string
Complete bool
Termination ScanTermination
Portable bool
Cache ScanCacheStats
}
type ContentVisitor ¶
type ContentVisitor func(ContentVisitEvent) ContentVisitControl
type DeltaQuality ¶
type DeltaQuality int
const ( DeltaContentHash DeltaQuality = iota DeltaMetadata DeltaPartial )
type DirScanner ¶
type DirScanner struct {
// contains filtered or unexported fields
}
DirScanner yields one child at a time from a single directory. It is not the repository Scanner.
func NewDirScanner ¶
func NewDirScanner(dirname string) (*DirScanner, error)
NewDirScanner opens a lazy single-directory scanner.
func NewDirScannerScratch ¶
func NewDirScannerScratch(dirname string, scratch []byte) (*DirScanner, error)
NewDirScannerScratch opens a lazy scanner with a reusable scratch buffer.
func (*DirScanner) Close ¶
func (s *DirScanner) Close() error
func (*DirScanner) Err ¶
func (s *DirScanner) Err() error
func (*DirScanner) Name ¶
func (s *DirScanner) Name() string
func (*DirScanner) Scan ¶
func (s *DirScanner) Scan() bool
type DirWalkOptions ¶
type DirWalkOptions struct {
Callback WalkDirFunc
PostChildrenCallback WalkDirFunc
ErrorCallback func(path string, err error) error
Unsorted bool
FollowSymbolicLinks bool
ContentsFirst bool
DirsFirst bool
AllowNonDirectory bool
NumWorkers int
ToSlash bool
ScratchBuffer []byte
MaxOpen int
Context context.Context
}
DirWalkOptions is the godirwalk-shaped callback surface.
type EntryFilter ¶ added in v0.1.5
type EntryFilter = walkcfg.EntryFilter
func NewEntryFilter ¶ added in v0.1.5
func NewEntryFilter() *EntryFilter
type ErrorCode ¶
type ErrorCode string
const ( CodeNotImplemented ErrorCode = "not_implemented" CodeInvalid ErrorCode = "invalid" CodeWalk ErrorCode = "walk" CodeCancelled ErrorCode = "cancelled" CodeTimeout ErrorCode = "timeout" CodeStale ErrorCode = "stale_snapshot" CodePartial ErrorCode = "partial" CodePermission ErrorCode = "permission" CodeChanged ErrorCode = "changed" CodeLimit ErrorCode = "limit" CodeAdmission ErrorCode = "admission" CodeUnsupported ErrorCode = "unsupported" CodeCallback ErrorCode = "callback" CodeCache ErrorCode = "cache_corrupt" )
type ErrorPolicy ¶
type ErrorPolicy = walk.ErrorPolicy
type EvidenceMode ¶
type EvidenceMode int
const ( EvidenceComplete EvidenceMode = iota EvidenceSelectedFiles )
type FileIdentity ¶
type FileVersion ¶
type FileVersion = walk.FileVersion
type FileWalker ¶
type FileWalker struct {
LocationExcludePattern []string
IncludeDirectory []string
ExcludeDirectory []string
IncludeFilename []string
ExcludeFilename []string
IncludeDirectoryRegex []*regexp.Regexp
ExcludeDirectoryRegex []*regexp.Regexp
IncludeFilenameRegex []*regexp.Regexp
ExcludeFilenameRegex []*regexp.Regexp
ExcludeListExtensions []string
CustomIgnore []string
CustomIgnorePatterns []string
// contains filtered or unexported fields
}
func NewFileWalker ¶
func NewFileWalker(directory string, queue chan *File) *FileWalker
func NewParallelFileWalker ¶
func NewParallelFileWalker(directory string, queue chan *File, workers int) *FileWalker
func (*FileWalker) AddRoot ¶
func (w *FileWalker) AddRoot(directory string) *FileWalker
func (*FileWalker) AllowListExtensions ¶
func (w *FileWalker) AllowListExtensions(exts ...string) *FileWalker
func (*FileWalker) IgnoreBinaryFiles ¶
func (w *FileWalker) IgnoreBinaryFiles() *FileWalker
func (*FileWalker) IgnoreGitignore ¶
func (w *FileWalker) IgnoreGitignore() *FileWalker
func (*FileWalker) IgnoreIgnoreFile ¶
func (w *FileWalker) IgnoreIgnoreFile() *FileWalker
func (*FileWalker) IncludeHidden ¶
func (w *FileWalker) IncludeHidden(enabled bool) *FileWalker
func (*FileWalker) RespectGitModules ¶
func (w *FileWalker) RespectGitModules() *FileWalker
func (*FileWalker) SetConcurrency ¶
func (w *FileWalker) SetConcurrency(n int) *FileWalker
func (*FileWalker) SetErrorHandler ¶
func (w *FileWalker) SetErrorHandler(fn func(error) bool) *FileWalker
func (*FileWalker) SetMaxDepth ¶
func (w *FileWalker) SetMaxDepth(n int) *FileWalker
func (*FileWalker) Start ¶
func (w *FileWalker) Start() error
func (*FileWalker) Terminate ¶
func (w *FileWalker) Terminate()
func (*FileWalker) Walking ¶
func (w *FileWalker) Walking() bool
type FullRescanReason ¶
type FullRescanReason int
const ( FullRescanPolicyChanged FullRescanReason = iota FullRescanIgnoreInputChanged FullRescanStructuralChange FullRescanIncompletePreviousState )
type IgnoreFile ¶
type IgnoreFile struct {
Kind IgnoreSourceKind
Location string
}
type IgnorePolicy ¶
type IgnorePolicy struct {
// contains filtered or unexported fields
}
func GitCompatibleIgnorePolicy ¶
func GitCompatibleIgnorePolicy() IgnorePolicy
func NoneIgnorePolicy ¶
func NoneIgnorePolicy() IgnorePolicy
func RepositoryIgnorePolicy ¶
func RepositoryIgnorePolicy() IgnorePolicy
func (IgnorePolicy) WithCustomIgnore ¶
func (p IgnorePolicy) WithCustomIgnore(enabled bool) IgnorePolicy
func (IgnorePolicy) WithDotIgnore ¶
func (p IgnorePolicy) WithDotIgnore(enabled bool) IgnorePolicy
func (IgnorePolicy) WithExplicitFile ¶
func (p IgnorePolicy) WithExplicitFile(path string) IgnorePolicy
func (IgnorePolicy) WithGitExclude ¶
func (p IgnorePolicy) WithGitExclude(enabled bool) IgnorePolicy
func (IgnorePolicy) WithGitGlobal ¶
func (p IgnorePolicy) WithGitGlobal(enabled bool) IgnorePolicy
func (IgnorePolicy) WithGitIgnore ¶
func (p IgnorePolicy) WithGitIgnore(enabled bool) IgnorePolicy
func (IgnorePolicy) WithParentRules ¶
func (p IgnorePolicy) WithParentRules(enabled bool) IgnorePolicy
func (IgnorePolicy) WithRequireGit ¶
func (p IgnorePolicy) WithRequireGit(enabled bool) IgnorePolicy
type IgnoreSourceEvidence ¶
type IgnoreSourceEvidence struct {
Kind IgnoreSourceKind `json:"kind"`
Location string `json:"location"`
ContentHash string `json:"content_hash"`
}
type IgnoreSourceKind ¶
type IgnoreSourceKind = ignore.SourceKind
type ModifiedFile ¶
type ModifiedFile struct{ Previous, Current ScannedFile }
type MultiContentVisitReport ¶
type MultiContentVisitReport struct{ Reports []ContentVisitReport }
func (MultiContentVisitReport) IsEmpty ¶
func (r MultiContentVisitReport) IsEmpty() bool
func (MultiContentVisitReport) Len ¶
func (r MultiContentVisitReport) Len() int
type MultiScanReport ¶
type MultiScanReport struct{ Reports []*ScanReport }
func (MultiScanReport) IsEmpty ¶
func (r MultiScanReport) IsEmpty() bool
func (MultiScanReport) Len ¶
func (r MultiScanReport) Len() int
func (MultiScanReport) Revision ¶ added in v0.1.5
func (r MultiScanReport) Revision() string
Revision is one digest over the ordered roots. It does not merge file lists.
type MultiScanner ¶
type MultiScanner struct {
// contains filtered or unexported fields
}
func NewMultiScanner ¶
func NewMultiScanner(root string) *MultiScanner
func (*MultiScanner) AddRoot ¶
func (m *MultiScanner) AddRoot(root string) *MultiScanner
func (*MultiScanner) Options ¶
func (m *MultiScanner) Options(options Options) *MultiScanner
func (*MultiScanner) Scan ¶
func (m *MultiScanner) Scan(ctx context.Context) (*MultiScanReport, error)
func (*MultiScanner) VisitContent ¶
func (m *MultiScanner) VisitContent(ctx context.Context, factory func(root, worker int) ContentVisitor) (*MultiContentVisitReport, error)
func (*MultiScanner) WithAdmitTimeout ¶
func (m *MultiScanner) WithAdmitTimeout(d time.Duration) *MultiScanner
func (*MultiScanner) WithRootParallelism ¶
func (m *MultiScanner) WithRootParallelism(n int) *MultiScanner
type MultiWalker ¶
type MultiWalker = walk.MultiWalker
type NamedFileTypes ¶
type NamedFileTypes = filetypes.NamedFileTypes
func DefaultFileTypes ¶
func DefaultFileTypes() *NamedFileTypes
type Option ¶
type Option func(*planBuilder) error
Option configures a compiled Plan. Scan and ScanPaths keep two-argument signatures.
func WithAdmitTimeout ¶ added in v0.1.2
func WithDetectBinary ¶
func WithExcludeGlobs ¶
func WithExtensions ¶
func WithFailFast ¶
func WithFailFast() Option
func WithFilenameRegex ¶
func WithHashContents ¶
func WithLocationExclude ¶
func WithLogger ¶
func WithMaxFileBytes ¶
func WithNoIgnore ¶
func WithNoIgnore() Option
func WithProgress ¶
func WithReadLimit ¶
func WithRequireCache ¶
func WithRequireCache() Option
type Options ¶
type Options struct {
MaxFileBytes uint64
IgnoreFiles []string
OverrideRules []string
IgnoreRules []string
Extensions []string
FileTypes *filetypes.NamedFileTypes
IgnorePolicy IgnorePolicy
IgnoreCase bool
SkipHidden bool
StandardSkips bool
VCSSkips bool
GitModules bool
Filters selection.Filters
HashFileContents bool
DetectBinaryFiles bool
EvidenceComplete bool
Evidence EvidenceMode
Walk WalkOptions
TraversalWorkers int
ContentWorkers int
Limits ScanLimits
Cancellation *CancellationToken
CacheValidation CacheValidationPolicy
ContentValidation ContentValidationPolicy
ContentDiscovery ContentDiscoveryMode
AdmitTimeout time.Duration
// contains filtered or unexported fields
}
func DefaultOptions ¶
func DefaultOptions() Options
func (Options) MetadataOnly ¶
func (Options) SelectedFilesOnly ¶
func (Options) WithAdmitTimeout ¶ added in v0.1.2
func (Options) WithCacheValidation ¶
func (o Options) WithCacheValidation(policy CacheValidationPolicy) Options
func (Options) WithCancellation ¶
func (o Options) WithCancellation(token *CancellationToken) Options
func (Options) WithContentDiscovery ¶
func (o Options) WithContentDiscovery(mode ContentDiscoveryMode) Options
func (Options) WithContentParallelism ¶
func (Options) WithContentValidation ¶
func (o Options) WithContentValidation(policy ContentValidationPolicy) Options
func (Options) WithExcludeDirectories ¶
func (Options) WithExcludeDirectoryRegex ¶
func (Options) WithExcludeFilenameRegex ¶
func (Options) WithExcludeFilenames ¶
func (Options) WithExtensions ¶
func (Options) WithFileTypes ¶
func (o Options) WithFileTypes(types *NamedFileTypes) Options
func (Options) WithGitModules ¶
func (Options) WithIgnoreCase ¶
func (Options) WithIgnoreFiles ¶
func (Options) WithIgnorePolicy ¶
func (o Options) WithIgnorePolicy(policy IgnorePolicy) Options
func (Options) WithIncludeFilenameRegex ¶
func (Options) WithIncludeFilenames ¶
func (Options) WithMaxEntries ¶
func (Options) WithMaxFileBytes ¶
func (Options) WithMaxTotalBytes ¶
func (Options) WithOverrideRules ¶
func (Options) WithParallelism ¶
func (Options) WithSkipHidden ¶
func (Options) WithStandardSkips ¶
func (Options) WithTraversalParallelism ¶
func (Options) WithVCSSkips ¶ added in v0.1.5
type ParallelExecutor ¶
type ParallelJob ¶
type ParallelMultiWalkEvent ¶
type ParallelMultiWalkReport ¶
type ParallelMultiWalkReport struct{ Reports []ParallelWalkReport }
type ParallelMultiWalker ¶
type ParallelMultiWalker = walk.MultiWalker
type ParallelRuntime ¶
func DedicatedRuntime ¶
func DedicatedRuntime(n int) ParallelRuntime
func GlobalRuntime ¶
func GlobalRuntime() ParallelRuntime
func OwnedRuntime ¶
func OwnedRuntime(exec ParallelExecutor) ParallelRuntime
type ParallelVisitReport ¶
type ParallelVisitReport = walk.ParallelVisitReport
type ParallelWalkIter ¶
type ParallelWalkIter = walk.ParallelWalkIter
type ParallelWalkReport ¶
type ParallelWalkReport = walk.ParallelWalkReport
type ParallelWalker ¶
type ParallelWalker = walk.ParallelWalker
func NewParallelWalker ¶
func NewParallelWalker(root string) *ParallelWalker
type PathExplanation ¶
type Plan ¶
type Plan struct {
// contains filtered or unexported fields
}
Plan is an immutable compiled scan configuration. It does not hold Context.
func (*Plan) EachFile ¶
func (p *Plan) EachFile(ctx context.Context, root string, consume func(ScannedFile, []byte) error) (*ScanSummary, error)
func (*Plan) EachFileFS ¶ added in v0.1.5
func (*Plan) ScanCached ¶
func (*Plan) ScanPathsFS ¶ added in v0.1.5
func (*Plan) WriteDiagnostics ¶
func (p *Plan) WriteDiagnostics(w io.Writer, sum *ScanSummary) error
type PortableIgnoreSourceEvidence ¶
type PortableIgnoreSourceEvidence struct {
Kind IgnoreSourceKind `json:"kind"`
RepositoryRelative string `json:"repository_relative,omitempty"`
ContentHash string `json:"content_hash"`
}
type PortableScanReport ¶
type PortableScanReport struct {
Files []PortableScannedFile `json:"files"`
Skipped []PortableSkippedEntry `json:"skipped"`
Warnings []PortableScanWarning `json:"warnings"`
IgnoreSources []PortableIgnoreSourceEvidence `json:"ignore_sources"`
Revision string `json:"revision"`
Descriptor ScanDescriptor `json:"descriptor"`
Complete bool `json:"complete"`
Termination ScanTermination `json:"termination,omitempty"`
SelectionPortable bool `json:"selection_portable"`
}
type PortableScanWarning ¶
type PortableScannedFile ¶
type PortableSkippedEntry ¶
type RenamedFile ¶
type RenamedFile struct{ Previous, Current ScannedFile }
type RepositoryMatch ¶
type RepositoryMatcher ¶
type RepositoryMatcher struct {
// contains filtered or unexported fields
}
func NewRepositoryMatcher ¶
func NewRepositoryMatcher(root string, opts Options) (*RepositoryMatcher, error)
func (*RepositoryMatcher) EnterDir ¶
func (m *RepositoryMatcher) EnterDir(abs, rel string) []string
func (*RepositoryMatcher) Match ¶
func (m *RepositoryMatcher) Match(relative string, isDir bool) RepositoryMatch
func (*RepositoryMatcher) Sources ¶
func (m *RepositoryMatcher) Sources() []IgnoreSourceEvidence
type RootSymlinkPolicy ¶
type RootSymlinkPolicy = walk.RootSymlinkPolicy
type ScanCache ¶
type ScanCache struct {
FormatVersion uint32 `json:"format_version"`
Root string `json:"root"`
Entries []ScanCacheEntry `json:"entries"`
}
func (*ScanCache) ApplyWatchPlan ¶
func (*ScanCache) Invalidate ¶
func (ScanCache) IsCompatible ¶
type ScanCacheEntry ¶
type ScanCacheStats ¶
type ScanDelta ¶
type ScanDelta struct {
FromRevision, ToRevision string
Added, Removed []ScannedFile
Modified []ModifiedFile
Renamed []RenamedFile
Unchanged uint64
SelectionInputsChanged, PolicyChanged, ScanStateChanged bool
Quality DeltaQuality
}
func DeltaBetween ¶
func DeltaBetween(previous, current *ScanReport) ScanDelta
type ScanDescriptor ¶
func DescriptorFromOptions ¶
func DescriptorFromOptions(opts Options) ScanDescriptor
func (ScanDescriptor) Matches ¶
func (d ScanDescriptor) Matches(opts Options) bool
type ScanLimits ¶
type ScanOptions ¶
type ScanOptions = Options
type ScanReport ¶
type ScanReport struct {
Root string `json:"root"`
Files []ScannedFile `json:"files"`
Skipped []SkippedEntry `json:"skipped"`
Warnings []ScanWarning `json:"warnings"`
IgnoreSources []IgnoreSourceEvidence `json:"ignore_sources"`
Revision string `json:"revision"`
Descriptor ScanDescriptor `json:"descriptor"`
Complete bool `json:"complete"`
Termination ScanTermination `json:"termination,omitempty"`
Portable bool `json:"portable"`
Cache ScanCacheStats `json:"cache"`
}
func ScanFS ¶ added in v0.1.5
ScanFS is ScanWith over an fs.FS. Walk is lexical and does not follow symlinks. Native identity, ConfineAt, and cache reuse do not apply.
func (*ScanReport) ContentProvider ¶
func (r *ScanReport) ContentProvider() (*SnapshotContentProvider, error)
func (*ScanReport) Delta ¶
func (r *ScanReport) Delta(current *ScanReport) ScanDelta
func (*ScanReport) PortableFilesPage ¶
func (r *ScanReport) PortableFilesPage(offset, limit int) []PortableScannedFile
func (*ScanReport) Summary ¶
func (r *ScanReport) Summary() ScanSummary
func (*ScanReport) ToCache ¶
func (r *ScanReport) ToCache() ScanCache
func (*ScanReport) ToCompact ¶
func (r *ScanReport) ToCompact() CompactScanReport
func (*ScanReport) ToPortable ¶
func (r *ScanReport) ToPortable() PortableScanReport
type ScanSession ¶
type ScanSession struct {
// contains filtered or unexported fields
}
func OpenScanSession ¶
func (*ScanSession) ApplyWatchPlan ¶
func (s *ScanSession) ApplyWatchPlan(ctx context.Context, plan WatchPlan) (*ScanReport, error)
func (*ScanSession) ApplyWatchPlanWithCancellation ¶
func (s *ScanSession) ApplyWatchPlanWithCancellation(ctx context.Context, plan WatchPlan, cancel *CancellationToken) (*ScanReport, error)
func (*ScanSession) FilesPage ¶
func (s *ScanSession) FilesPage(generation uint64, offset, limit int) ([]PortableScannedFile, error)
func (*ScanSession) Generation ¶
func (s *ScanSession) Generation() uint64
func (*ScanSession) IntoReport ¶
func (s *ScanSession) IntoReport() *ScanReport
func (*ScanSession) LastUpdateReason ¶
func (s *ScanSession) LastUpdateReason() (WatchUpdateReason, bool)
func (*ScanSession) Report ¶
func (s *ScanSession) Report() *ScanReport
func (*ScanSession) Rescan ¶
func (s *ScanSession) Rescan(ctx context.Context) (*ScanReport, error)
func (*ScanSession) Root ¶
func (s *ScanSession) Root() string
func (*ScanSession) TreeRevision ¶
func (s *ScanSession) TreeRevision() string
type ScanSink ¶
type ScanSink interface {
OnFile(*ScannedFile) ScanSinkControl
}
type ScanSinkControl ¶
type ScanSinkControl int
const ( ScanSinkContinue ScanSinkControl = iota ScanSinkStop )
type ScanSinkFunc ¶
type ScanSinkFunc func(*ScannedFile) ScanSinkControl
func (ScanSinkFunc) OnFile ¶
func (f ScanSinkFunc) OnFile(file *ScannedFile) ScanSinkControl
type ScanStreamReport ¶
type ScanStreamReport struct {
Root string
Selected, Emitted uint64
Stopped bool
Skipped []SkippedEntry
Warnings []ScanWarning
IgnoreSources []IgnoreSourceEvidence
Revision string
Complete bool
Termination ScanTermination
Portable bool
Cache ScanCacheStats
}
func ScanIntoErr ¶
func ScanIntoErr(ctx context.Context, root string, fn func(*ScannedFile) error, opts ...Option) (*ScanStreamReport, error)
type ScanSummary ¶
type ScanSummary struct {
SelectedFiles, HashedFiles, BinaryCheckedFiles, RecordedSkips, Warnings, IgnoreSources int
SelectedBytes uint64
SkippedByKind map[SkipKind]int
Complete, Stopped bool
Termination ScanTermination
Portable bool
Cache ScanCacheStats
}
func EachFile ¶
func EachFile(ctx context.Context, root string, consume func(ScannedFile, []byte) error, opts ...Option) (*ScanSummary, error)
func EachFileFS ¶ added in v0.1.5
func EachFileFS(ctx context.Context, fsys fs.FS, root string, consume func(ScannedFile, []byte) error, opts ...Option) (*ScanSummary, error)
EachFileFS is EachFile over an fs.FS. A callback error is not replayed.
func (ScanSummary) LogValue ¶
func (s ScanSummary) LogValue() slog.Value
func (ScanSummary) String ¶
func (s ScanSummary) String() string
type ScanTermination ¶
type ScanTermination int
const ( TerminationNone ScanTermination = iota TerminationMaxEntries TerminationMaxTotalBytes TerminationTimeout TerminationCancelled )
func (ScanTermination) String ¶
func (t ScanTermination) String() string
type ScanWarning ¶
type ScannedFile ¶
type ScannedFile struct {
Absolute string `json:"absolute"`
Relative string `json:"relative"`
ContentHash string `json:"content_hash,omitempty"`
ContentFingerprint string `json:"content_fingerprint,omitempty"`
Bytes uint64 `json:"bytes"`
Version FileVersion `json:"version"`
BinaryChecked bool `json:"binary_checked"`
Binary bool `json:"binary,omitempty"`
}
func (ScannedFile) AbsolutePath ¶
func (f ScannedFile) AbsolutePath() string
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func NewScanner ¶
func NewScanner(root string, opts ...ScannerOption) (*Scanner, error)
func (*Scanner) Explain ¶
func (s *Scanner) Explain(rel string) (PathExplanation, error)
Explain reports the winning selection rule for rel. It does not hash the file or apply binary / max-file-bytes checks.
func (*Scanner) ScanCached ¶
func (*Scanner) ScanCompact ¶
func (s *Scanner) ScanCompact(ctx context.Context) (*CompactScanReport, error)
func (*Scanner) ScanIncremental ¶
func (s *Scanner) ScanIncremental(ctx context.Context, previous *ScanReport) (*ScanReport, error)
func (*Scanner) ScanWatchPlan ¶
func (s *Scanner) ScanWatchPlan(ctx context.Context, previous *ScanReport, plan WatchPlan) (*ScanReport, error)
func (*Scanner) ScanWatchPlanDetailed ¶
func (s *Scanner) ScanWatchPlanDetailed(ctx context.Context, previous *ScanReport, plan WatchPlan) (*WatchUpdate, error)
func (*Scanner) VisitChangedContent ¶
func (s *Scanner) VisitChangedContent(ctx context.Context, plan WatchPlan, factory func(worker int) ContentVisitor) (ChangedContentVisitOutcome, error)
func (*Scanner) VisitContent ¶
func (s *Scanner) VisitContent(ctx context.Context, factory func(worker int) ContentVisitor) (*ContentVisitReport, error)
func (*Scanner) VisitContentManifest ¶
func (s *Scanner) VisitContentManifest(ctx context.Context, factory func(worker int) ContentVisitor) (*CompactScanReport, error)
func (*Scanner) VisitContentStreaming ¶
func (s *Scanner) VisitContentStreaming(ctx context.Context, factory func(worker int) ContentVisitor) (*ContentVisitReport, error)
type ScannerOption ¶
type ScannerOption func(*scannerConfig)
func WithContentWorkers ¶
func WithContentWorkers(n int) ScannerOption
func WithOptions ¶
func WithOptions(options Options) ScannerOption
func WithTraversalWorkers ¶
func WithTraversalWorkers(n int) ScannerOption
type SelectionDecision ¶
type SelectionDisposition ¶
type SelectionDisposition = selection.Disposition
type SelectionMatcher ¶
func NewSelectionMatcher ¶
func NewSelectionMatcher(root string, opts Options) (*SelectionMatcher, error)
type SkippedEntry ¶
type SnapshotContent ¶
type SnapshotContent struct {
Relative string
Bytes []byte
Evidence SnapshotEvidence
}
type SnapshotContentProvider ¶
type SnapshotContentProvider struct {
// contains filtered or unexported fields
}
func (*SnapshotContentProvider) Open ¶
func (p *SnapshotContentProvider) Open(relative string) (*SnapshotContent, error)
Open loads verified bytes for relative. It does not return an io.Reader.
func (*SnapshotContentProvider) Read ¶
func (p *SnapshotContentProvider) Read(relative string) (*SnapshotContent, error)
func (*SnapshotContentProvider) ReadBounded ¶
func (p *SnapshotContentProvider) ReadBounded(relative string, maxBytes uint64) (*SnapshotContent, error)
type SnapshotEvidence ¶
type SnapshotEvidence int
const ( SnapshotFileVersion SnapshotEvidence = iota SnapshotSHA256 )
type SnapshotReadError ¶
func (*SnapshotReadError) Error ¶
func (e *SnapshotReadError) Error() string
func (*SnapshotReadError) Unwrap ¶
func (e *SnapshotReadError) Unwrap() error
type StandardSkips ¶
type StandardSkips int
const ( StandardSkipsEnabled StandardSkips = iota StandardSkipsDisabled )
type TreeSnapshot ¶
TreeSnapshot is a persistent keyed Merkle index. It is not LegacyRevision.
func SnapshotFromFiles ¶
func SnapshotFromFiles(files []ScannedFile) *TreeSnapshot
func (*TreeSnapshot) Apply ¶
func (s *TreeSnapshot) Apply(upserts, deletes []ScannedFile) *TreeSnapshot
func (*TreeSnapshot) Len ¶
func (s *TreeSnapshot) Len() int
func (*TreeSnapshot) TreeRevision ¶
func (s *TreeSnapshot) TreeRevision() string
type WalkBuilder ¶
func NewWalkBuilder ¶
func NewWalkBuilder(root string) *WalkBuilder
type WalkControl ¶
type WalkControl = walk.WalkControl
type WalkDirFunc ¶
type WalkDirFunc = fs.WalkDirFunc
func IgnoreDuplicateDirs ¶
func IgnoreDuplicateDirs(fn WalkDirFunc) WalkDirFunc
func IgnoreDuplicateFiles ¶
func IgnoreDuplicateFiles(fn WalkDirFunc) WalkDirFunc
func IgnorePermissionErrors ¶ added in v0.1.5
func IgnorePermissionErrors(fn WalkDirFunc) WalkDirFunc
type WalkEntry ¶
func CollectParallel ¶
type WalkOperation ¶
type WalkOperation = walk.WalkOperation
type WalkOptions ¶
type WalkOptions = walk.WalkOptions
func DefaultWalkOptions ¶
func DefaultWalkOptions() WalkOptions
type WalkSkipReason ¶
type WalkSkipReason = walk.WalkSkipReason
type Walker ¶
func NewWalkerWithOptions ¶
func NewWalkerWithOptions(root string, options WalkOptions) (*Walker, error)
type WatchEvent ¶
type WatchEvent struct {
Path string
Kind WatchEventKind
}
func NewWatchEvent ¶
func NewWatchEvent(path string, kind WatchEventKind) WatchEvent
type WatchEventKind ¶
type WatchEventKind int
const ( WatchCreate WatchEventKind = iota WatchModify WatchRemove WatchRenameFrom WatchRenameTo WatchDirectory WatchRescan )
type WatchPlan ¶
func (WatchPlan) ExpandRemoved ¶
func (WatchPlan) Invalidated ¶
func (WatchPlan) InvalidatesPath ¶
type WatchUpdate ¶
type WatchUpdate struct {
Report *ScanReport
Reason WatchUpdateReason
}
type WatchUpdateReason ¶
type WatchUpdateReason int
const ( WatchReasonIncremental WatchUpdateReason = iota WatchReasonFullPolicy WatchReasonFullIgnore WatchReasonFullStructural WatchReasonFullIncomplete )
func (WatchUpdateReason) AsString ¶
func (r WatchUpdateReason) AsString() string
func (WatchUpdateReason) String ¶
func (r WatchUpdateReason) String() string
type WatcherEventAdapter ¶
type WatcherEventAdapter struct {
// contains filtered or unexported fields
}
func NewWatcherEventAdapter ¶
func NewWatcherEventAdapter(root string, ignoreFiles []string) (*WatcherEventAdapter, error)
func NewWatcherEventAdapterWithOptions ¶
func NewWatcherEventAdapterWithOptions(root string, opts Options) (*WatcherEventAdapter, error)
func (*WatcherEventAdapter) Plan ¶
func (a *WatcherEventAdapter) Plan(events []WatchEvent) WatchPlan
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
treestamp-driver
command
Command treestamp-driver speaks the Treestamp fixture protocol.
|
Command treestamp-driver speaks the Treestamp fixture protocol. |
|
treestamp
module
|
|
|
compat
|
|
|
fastwalk
Package fastwalk is a Treestamp-backed compatibility entry for charlievieth/fastwalk v1.0.14.
|
Package fastwalk is a Treestamp-backed compatibility entry for charlievieth/fastwalk v1.0.14. |
|
godirwalk
Package godirwalk is a Treestamp-backed compatibility entry for karrick/godirwalk v1.17.0.
|
Package godirwalk is a Treestamp-backed compatibility entry for karrick/godirwalk v1.17.0. |
|
examples
|
|
|
docquickstart
command
|
|
|
scan
command
|
|
|
walk
command
|
|
|
internal
|
|
|
dirread
Package dirread lists directory names and types without extra metadata.
|
Package dirread lists directory names and types without extra metadata. |
|
ignore
Package ignore holds nested ignore sources and precedence (P2).
|
Package ignore holds nested ignore sources and precedence (P2). |
|
listwalk
Package listwalk is the unsorted callback walk used by Walk / WalkDirs.
|
Package listwalk is the unsorted callback walk used by Walk / WalkDirs. |
|
merkle
Package merkle holds a persistent keyed snapshot tree.
|
Package merkle holds a persistent keyed snapshot tree. |
|
runtime
Package runtime holds executors, admission, and bounded queues (P4).
|
Package runtime holds executors, admission, and bounded queues (P4). |
|
selection
Package selection holds reusable matchers and named types (P2).
|
Package selection holds reusable matchers and named types (P2). |
|
walkfs
Package walkfs traverses arbitrary io/fs filesystems.
|
Package walkfs traverses arbitrary io/fs filesystems. |