Macaw.Data.Source.Detector.Files (macaw_data v0.21.1)

View Source

The file change detector (spec/01 §4.5.1): a source over files detected by each file's mtime and size, where no watcher runs.

Options: name: the source's name and glob: its files, both required; map: a function of a path answering what the file holds as a notice's what ({:range, from, to}, {:identities, ids} or :all), :all by default; sees:, :all by default. The file system is read through list: (Path.wildcard/1) and stat: (File.stat/2 with POSIX times), so a host may give its own.

Each poll lists and stats the files: a new, removed, or rewritten file (its mtime or size moved) is a notice of what map: says it holds, equal notices one; a file that can't be stated is removed. The first poll is Change.all/1: what was read before it may already have moved.