@vzn/vx-reapi 0.0.644 → 0.0.645
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/package.json +2 -2
- package/src/cache.ts +10 -4
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vzn/vx-reapi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.645",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Bazel Remote Execution API plugin for vx — remote cache (ActionCache + CAS) against NativeLink, BuildBuddy, Buildbarn or bazel-remote.",
|
|
6
6
|
"keywords": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@vzn/vx": "^0.0.
|
|
42
|
+
"@vzn/vx": "^0.0.645"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|
package/src/cache.ts
CHANGED
|
@@ -96,12 +96,18 @@ export class ReapiRemoteCache {
|
|
|
96
96
|
* hit vs miss. Costs one extra round trip, and only for a PREDICTED HIT:
|
|
97
97
|
* a miss still answers in one call.
|
|
98
98
|
*/
|
|
99
|
-
async has(hash: string): Promise<
|
|
99
|
+
async has(hash: string): Promise<{ size: number; durationMs?: number } | null> {
|
|
100
100
|
const result = await this.client.getActionResult(actionDigestFor(hash))
|
|
101
|
-
if (result === null) return
|
|
101
|
+
if (result === null) return null
|
|
102
102
|
const file = result.output_files?.find((f) => f.path === ARTIFACT_PATH)
|
|
103
|
-
if (file === undefined) return
|
|
104
|
-
|
|
103
|
+
if (file === undefined) return null
|
|
104
|
+
if ((await this.client.findMissingBlobs([file.digest])).length > 0) return null
|
|
105
|
+
// The duration only when it rode inline: a CAS read for it is a round trip.
|
|
106
|
+
const durationMs = decodeDuration(result.stdout_raw)
|
|
107
|
+
return {
|
|
108
|
+
size: Number(file.digest.size_bytes),
|
|
109
|
+
...(durationMs === undefined ? {} : { durationMs }),
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
/**
|