file_hashes
file_hashes
#
The hash cache: leaf hashes remembered by path and stat, in their own SQLite file.
The cache lives beside the index rather than in it, so hashing a large tree never holds the index's write lock. It only saves re-reads: a file of another layout is emptied and recreated, and a write still locked out after the busy timeout is skipped.
BUSY_TIMEOUT_SECONDS = 5.0
module-attribute
#
How long a cache write waits on another writer before it is skipped.
FileHashes
#
A HashCache over the file_hashes table of its own file.
Source code in capturegraph-lib/capturegraph/scratch/index/file_hashes.py
__init__(path)
#
Open or create the cache file at path, emptying one of another layout.
Source code in capturegraph-lib/capturegraph/scratch/index/file_hashes.py
close()
#
forget(source)
#
Drop every remembered path under source.
lookup(path, stat)
#
The remembered hash of path at stat, if any.
Source code in capturegraph-lib/capturegraph/scratch/index/file_hashes.py
move(source, destination)
#
Re-key every remembered path under source to live under destination.
Source code in capturegraph-lib/capturegraph/scratch/index/file_hashes.py
store_all(learned)
#
Remember every (path, stat, hash) in one transaction.