Skip to content

Commit 314b7c2

Browse files
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

5 files changed

+844
-149
lines changed

cache/disk/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go_library(
44
name = "go_default_library",
55
srcs = [
66
"disk.go",
7+
"load.go",
78
"lru.go",
89
],
910
importpath = "github.com/buchgr/bazel-remote/cache/disk",
@@ -29,5 +30,6 @@ go_test(
2930
"//cache:go_default_library",
3031
"//cache/http:go_default_library",
3132
"//utils:go_default_library",
33+
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
3234
],
3335
)

0 commit comments

Comments
 (0)