]> granicus.if.org Git - neomutt/commitdiff
Clarify hcache invalidation mechanism
authorPietro Cerutti <gahr@gahr.ch>
Tue, 20 Aug 2019 11:24:16 +0000 (11:24 +0000)
committerPietro Cerutti <gahr@gahr.ch>
Tue, 20 Aug 2019 11:32:57 +0000 (11:32 +0000)
hcache/README.md
hcache/hcachever.sh

index 668592edd4aa044ad18c8f07ea34b57499c5dda7..e007e773ce905bb96184865195c56b736e340180 100644 (file)
@@ -11,3 +11,16 @@ There are six different databases to choose from:
 
 Each backend implements the interface which is defined in `hcache.h`
 
+# Operation
+
+The header cache works by caching a number of fields from a number of structs.
+These are hardcoded in the `serial_*` functions in implemented in
+`hcache/serialize.c`. The header cache has a CRC checksum that gets invalidated
+whenever the definition of any of the structs defined in the `STRUCTURES`
+variable in `hcache/hcachever.sh` changes. So, changes to any structure
+definition, or addition / removal of a structure to / from the `STRUCTURES`
+variable trigger an invalidation of any stored header cache. However, the CRC
+is **not** invalidated whenever a new field from a structure is added or
+removed to the set of the serialized fields. If you add or remove any fields in
+any of the functions in `hcache/serialize.c`, please bump the `BASEVERSION`
+variable in `hcache/hcachever.sh`.
index 7b6bfe6f9aeb573997a58f69fa37980d640fc6a8..a9c849b3ba9a0525a4e7c533569141d5f477ca80 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 BASEVERSION=2
+STRUCTURES="Address Body Buffer Email Envelope ListNode Parameter"
 
 cleanstruct () {
   echo "$1" | sed -e 's/.* //'
@@ -45,12 +46,12 @@ getstruct () {
     esac
   done
 
-  case $STRUCT in
-    Address|Body|Buffer|Email|Envelope|ListNode|Parameter)
+  for s in ${STRUCTURES}; do
+    if [ ${STRUCT} = $s ]; then
       BODY=`cleanbody "$BODY"`
       echo "$STRUCT: $BODY"
-    ;;
-  esac
+    fi
+  done
   return
 }