diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2020-06-18 21:46:22 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2020-06-18 21:46:22 +0200 |
commit | 88699012b77c4827b433883845d951e8ded8cb7c (patch) | |
tree | cca83c8e41ce6658a348add97967d6e27ee1cf6a /src/InodeCache.cpp | |
parent | f61dd2d582adb47fedbf4d397845ab7c0b1bc7e5 (diff) | |
download | ccache-88699012b77c4827b433883845d951e8ded8cb7c.tar.gz |
Improve comment of inode cache version and revert to version 1 again
As noted by Olle Liljenzin, changing the hash algorithm does not require
incrementing the version field, so let’s revert the change I made as
part of 2a0dd8ef.
Diffstat (limited to 'src/InodeCache.cpp')
-rw-r--r-- | src/InodeCache.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/InodeCache.cpp b/src/InodeCache.cpp index cc12fe53..acf0a1ee 100644 --- a/src/InodeCache.cpp +++ b/src/InodeCache.cpp @@ -43,11 +43,9 @@ # include <type_traits> # include <unistd.h> -namespace { - // The inode cache resides on a file that is mapped into shared memory by -// running processes. It is implemented as a two level structure, where the -// top level is a hash table consisting of buckets. Each bucket contains entries +// running processes. It is implemented as a two level structure, where the top +// level is a hash table consisting of buckets. Each bucket contains entries // that are sorted in LRU order. Entries map from keys representing files to // cached hash results. // @@ -56,9 +54,19 @@ namespace { // Current cache size is fixed and the given constants are considered large // enough for most projects. The size could be made configurable if there is a // demand for it. -const uint32_t k_version = 2; -// Increment version number if constants affecting storage size are changed. +namespace { + +// The version number corresponds to the format of the cache entries and to +// semantics of the key fields. +// +// Note: The key is hashed using the main hash algorithm, so the version number +// does not need to be incremented if said algorithm is changed (except if the +// digest size changes since that affects the entry format). +const uint32_t k_version = 1; + +// Note: Increment the version number if constants affecting storage size are +// changed. const uint32_t k_num_buckets = 32 * 1024; const uint32_t k_num_entries = 4; |