Commit 314b7c2
committed
disk cache: store a data integrity header for non-CAS blobs
The header is made up of three fields:
1) Little-endian int32 (4 bytes) representing the REAPIv2
DigestFunction.
2) Little-endian int64 (8 bytes) representing the number
of bytes in the blob.
3) The hash bytes from the digest, length determined by
the particular DigestFunction.
(32 for SHA256. 20 for SHA1, 16 for MD5).
Note that we currently only support SHA256, however.
This header is simple to parse, and does not require buffering the
entire blob in memory if you just want the data.
To distinguish blobs with and without this header, we use new
directories for the affected blobs: ac.v2/ instead of ac/ and
similarly for raw/.
We do not use this header to actually verify data yet, and we
still os.File.Sync() after file writes (#67).
This also includes a slightly refactored version of PR #123
(load the items from disk concurrently) by @bdittmer.1 parent a29b751 commit 314b7c2
File tree
5 files changed
+844
-149
lines changed- cache/disk
- server
5 files changed
+844
-149
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
0 commit comments