Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - doc(Cache/Hashing): add docstring for HashMemo #21711

Closed
wants to merge 11 commits into from
16 changes: 16 additions & 0 deletions Cache/Hashing.lean
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,26 @@ namespace Cache.Hashing

open System IO

/--
The `HashMemo` contains all information `Cache` needs about the modules:
* the name
* its imports
* the file's hash (in `hashMap` and `cache`)

additionally, it contains the `rootHash` which reflects changes to Mathlib's
Lake project settings.
-/
structure HashMemo where
/-- Hash of mathlib's lake project settings. -/
rootHash : UInt64
/-- Stores the imports of a module, obtained from the `.lean` source files -/
depsMap : Std.HashMap FilePath (Array FilePath) := ∅
/--
For modules in Mathlib or upstream, this contains the same information
as `hashMap`. Contains `none` if a source file couldn't be found.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it none only for source files not in mathlib?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the docstring. Files downstream will fall into the latter category, but not necessarily exclusively.

E.g. if you'll write import Mathlib.Data in another mathlib file and try to get cache, this file will have none as Mathlib/Data.lean doesn't exist. (meaning no cache will be retrieved for the file with bad import)

-/
cache : Std.HashMap FilePath (Option UInt64) := ∅
/-- Stores the hash of the module's content for modules in Mathlib or upstream. -/
hashMap : ModuleHashMap := ∅
deriving Inhabited

Expand Down