Skip to main content

Module cleanup

Module cleanup 

Source
Expand description

Cleaning up the cache: the entries kizz cache clean removes because the files they are about are gone, and the entries kizz cache reset wipes for the tasks under a path.

Both change cache entries only, never a project file, and both run under the cache lock, which the caller holds, so no build changes the cache meanwhile.

Every step record carries its owners, the tasks that produced or used it (see StepRecord::owners): the engine adds a task when the task runs the step or finds it cached. A task is under a path when its kizz.md is in the path or under it, compared by path components.

  • clean checks every recorded path concurrently, on the command’s worker pool, the kizz.md of every owner of a step record included. A step record that depends on a path that existed when kizz recorded it and no longer exists is removed as a whole; the step’s working directory counts as such a dependency. From each step record it keeps, it takes out the owners whose kizz.md no longer exists, and it removes no record for that alone, so a record may be left with no owner. Task records, step positions, and learned order for kizz.md files that no longer exist are removed, as are last-writer entries for paths that no longer exist. A dependency on a path that did not exist when it was recorded is still valid and is kept, and so are untracked /proc and /sys accesses, which are never dependencies.
  • plan_reset selects every entry for the tasks under a directory: their task records, step positions, and learned order, the last-writer entries for paths under it, and the step records they own. A step record is removed when it has an owner and every owner is a task under the directory; a step record that also has owners outside it is kept, and the reset only takes the tasks under the directory out of its owners; and a step record with no owner is no task’s entry, so no path reset removes or changes it. Neither a step position nor a record’s working directory decides which step records a reset removes. ResetPlan::apply then removes the entries and changes the owners in one transaction.

Structs§

Cleaned
What clean found and removed.
ResetPlan
Every entry for the tasks under one directory, which ResetPlan::apply removes, and the shared step records it takes those tasks out of.

Functions§

clean
Removes the cache entries about files and dependencies that existed when kizz recorded them but no longer exist, and takes the tasks whose kizz.md no longer exists out of the owners of the step records it keeps, after checking every recorded path concurrently on pool, in one transaction.
plan_reset
Selects every entry for the tasks under dir, an absolute path, without changing anything.