filetracker

package
v0.59.5 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TrackerFileName is the name of the file tracking data file
	TrackerFileName = "file_tracker.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	MtimeAtIndex time.Time `json:"mtime_at_index"`
	IndexedAt    time.Time `json:"indexed_at"`
}

FileInfo stores indexing metadata for a file

type Tracker

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

Tracker tracks file modification times to detect stale indexed files

func NewTracker

func NewTracker(storePath string, logger *logrus.Logger) (*Tracker, error)

NewTracker creates a new file tracker

func (*Tracker) Clear

func (t *Tracker) Clear()

Clear removes all tracked files

func (*Tracker) Count

func (t *Tracker) Count() int

Count returns the number of tracked files

func (*Tracker) GetLastIndexed added in v0.57.1

func (t *Tracker) GetLastIndexed() time.Time

GetLastIndexed returns when the index was last updated

func (*Tracker) GetStaleFiles

func (t *Tracker) GetStaleFiles(stalenessThreshold time.Duration) []string

GetStaleFiles returns files that have been modified since indexing and whose modifications are older than the staleness threshold. This prevents reindexing files that are actively being edited.

func (*Tracker) IsIndexed

func (t *Tracker) IsIndexed(path string) bool

IsIndexed checks if a file is tracked

func (*Tracker) MarkIndexed

func (t *Tracker) MarkIndexed(path string) error

MarkIndexed records that a file was indexed with its current mtime

func (*Tracker) MarkIndexedBatch

func (t *Tracker) MarkIndexedBatch(paths []string) error

MarkIndexedBatch records multiple files as indexed

func (*Tracker) RemoveFile

func (t *Tracker) RemoveFile(path string)

RemoveFile removes a file from tracking

func (*Tracker) RemoveFiles

func (t *Tracker) RemoveFiles(paths []string)

RemoveFiles removes multiple files from tracking

func (*Tracker) Save

func (t *Tracker) Save() error

Save persists the tracker data to disk

func (*Tracker) TrackedPaths

func (t *Tracker) TrackedPaths() []string

TrackedPaths returns all tracked file paths

Jump to

Keyboard shortcuts

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