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

Switch digest to cuckoo filters, to enable O(1) removal #413

Merged
merged 14 commits into from Mar 1, 2018
15 changes: 8 additions & 7 deletions draft-ietf-httpbis-cache-digest.md
Expand Up @@ -214,23 +214,24 @@ the ETag is available; otherwise, null);
3. Let `N` be the value of the second to fifth bytes of `digest-value` in big endian form.
4. Let `key` be the return value of {{key}} with `URL` and `ETag` as inputs.
5. Let `h1` be the return value of {{hash}} with `key` and `N` as inputs.
6. Let `fingerprint` be the return value of {{fingerprint}} with `key` and `f` as inputs.
7. Let `h2` be the return value of {{hash2}} with `h1`, `fingerprint` and `N` as inputs.
6. Let `dest_fingerprint` be the return value of {{fingerprint}} with `key` and `f` as inputs.
7. Let `h2` be the return value of {{hash2}} with `h1`, `dest_fingerprint` and `N` as inputs.
8. Let `h` be either `h1` or `h2`, picked in random.
9. While `maxcount` is larger than zero:
1. Let `position_start` be 40 + `h` * `f` \* `b`.
2. Let `position_end` be `position_start` + `f` \* `b`.
3. While `position_start` < `position_end`:
1. Let `bits` be `f` bits from `digest_value` starting at `position_start`.
2. If `bits` is all zeros, set `bits` to `fingerprint` and terminate these steps.
2. If `bits` is all zeros, set `bits` to `dest_fingerprint` and terminate these steps.
3. Add `f` to `position_start`.
4. Let `e` be a random number from 0 to `b`.
5. Substract `f` * (`b` - `e`) from `position_start`.
6. Let `bits` be `f` bits from `digest_value` starting at `position_start`.
7. Let `dest_fingerprint` be the value of bits, read as big endian.
8. Set `bits` to `fingerprint`.
9. Let `h` be {{hash2}} with `h`, `dest_fingerprint` and `N` as inputs.
10. Substract 1 from `maxcount`.
7. Let `fingerprint` be the value of bits, read as big endian.
8. Set `bits` to `dest_fingerprint`.
9. Set `dest_fingerprint` to `fingerprint`.
10. Let `h` be {{hash2}} with `h`, `dest_fingerprint` and `N` as inputs.
11. Substract 1 from `maxcount`.
13. Substract `f` from `position_start`.
14. Let `fingerprint` be the `f` bits starting at `position_start`.
15. Let `h1` be `h`
Expand Down