commit 3d7104b41793be9c1eb15b50016bc42f3f4bd356
parent 26f466c16a079ded8a59a73730b84f915cd90790
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Fri, 19 Jun 2026 09:20:26 -0700
Rename build trace fetch leaves to blobs
Diffstat:
11 files changed, 203 insertions(+), 203 deletions(-)
diff --git a/doc/BUILD_COORDINATOR.md b/doc/BUILD_COORDINATOR.md
@@ -58,12 +58,12 @@ the resolution algorithm that drives it.
| **Target dep** | A dependency of one target on the *output tree* of another. The graph's interior edges, created by `need`. |
| **Shallow trace** | A record of one build: its direct base inputs + its direct target deps (by output `tree-id`) → its output `tree-id`. |
| **Deep trace** | A record of one build: `(root config-id, argv)` + a pointer to the transitive input closure (a **deepset**) → its output `tree-id`. |
-| **Deepset** | One node of the transitive input-closure DAG (`deep-set-id` = `BLAKE2b(canonical body)`): a target's recipe-id + its direct source/glob/fetch leaves + its children's `deep-set-id`s. A self-verifying CAS blob; shared structurally across ancestors. |
+| **Deepset** | One node of the transitive input-closure DAG (`deep-set-id` = `BLAKE2b(canonical body)`): a target's recipe-id + its direct source/glob/blob leaves + its children's `deep-set-id`s. A self-verifying CAS blob; shared structurally across ancestors. |
| **Tree cache** | On-disk *materialized* output directories, keyed by `tree-id`, ready to hand back as a filesystem path. |
The base-input kinds are exactly the dynamically-requested leaves: a recipe asks
the coordinator for a config value, the bytes of a source file, the expansion of
-a glob, or a hash-pinned fetched blob, and each request is logged as a dependency
+a glob, or a hash-pinned blob dependency, and each request is logged as a dependency
so a later rebuild knows precisely what to re-check.
## Build definitions
@@ -232,7 +232,7 @@ opt
src/main.c <blob-id>
[glob] ; sorted by pattern
src/*.c <glob-result-hash>
-[fetch] ; sorted by blob id
+[blob] ; sorted by blob id
<blob-id>
[dep] ; sorted by (dep-name, dep-config-id, dep-argv-id) — each row replays one `need`
//lib:core <dep-config-id> <dep-argv-id> <dep-output-tree-id>
@@ -305,7 +305,7 @@ src/main.c <blob-id>
config.h - ; an ABSENT leaf: "-" = the path was absent when read
[glob] ; this node's DIRECT glob leaves, sorted by pattern
src/*.c <glob-result-hash>
-[fetch] ; this node's DIRECT fetched blobs, sorted by blob id
+[blob] ; this node's DIRECT blob dependencies, sorted by blob id
<blob-id>
[child] ; direct deps' deep-set-ids, sorted
<deep-set-id of //lib:core's node>
@@ -342,7 +342,7 @@ src/*.c <glob-result-hash>
pattern matched (sorted by path). It changes if any matched file is added,
removed, or edited — so one glob row covers the existence *and* content of its
whole match set, and files read through a glob need no separate `[source]` rows.
-- `[fetch]` rows record hash-pinned external blobs requested through the recipe
+- `[blob]` rows record hash-pinned external blobs requested through the recipe
protocol. Only the blob id is cache identity; URL hints are deliberately not
recorded because they are transport choices. A matching trace requires the
blob to be present in the local CAS, and trace bundles include these blobs so
@@ -353,13 +353,13 @@ src/*.c <glob-result-hash>
**Why the deep trace needs only `root-config` + the deepset closure.** If the
request's `config-id` equals `root-config`, its `argv-id` equals the recorded
-`argv`, *and* refreshing the deepset finds nothing moved — every source/glob/fetch leaf
+`argv`, *and* refreshing the deepset finds nothing moved — every source/glob/blob leaf
still matches the live workspace **and** every node's `recipe-id` still recomputes
the same through the live definition — then every recipe in the closure has
byte-identical inputs *and* identical code, so every `need` overlay it computes is
identical, every effective config downstream is identical, and by determinism the
output is identical. Any input that could perturb a downstream overlay (a source a
-recipe branches on, a config value) is itself either a recorded source/glob/fetch leaf,
+recipe branches on, a config value) is itself either a recorded source/glob/blob leaf,
a per-node `recipe-id`, or folded into `root-config`, so nothing escapes the
check. Using the whole `root-config` (rather than just
consumed keys) is a deliberate, conservative simplification: an *unconsumed*
@@ -499,14 +499,14 @@ resolve(T, cfg, argv, chain):
if S.argv != argv.id: continue # local config
M = config_by_id(S.config) # the built map (serialized blob)
if any consumed key in S.config-keys differs between cfg and M: continue
- if any direct source/glob/fetch leaf of S changed: continue
+ if any direct source/glob/blob leaf of S changed: continue
ok = true ; child_nodes = []
for (dep, dep_cfg_id, dep_argv_id, recorded_tree) in S.deps: # may run in parallel
r = resolve(dep, config_by_id(dep_cfg_id), argv_by_id(dep_argv_id), chain') # replay the need by id
if r.output != recorded_tree: ok = false; break
child_nodes.push(r.leafset)
if ok:
- node = union(direct{recipe_id, source/glob/fetch leaves} of S, child_nodes) # builds+stores the deepset
+ node = union(direct{recipe_id, source/glob/blob leaves} of S, child_nodes) # builds+stores the deepset
write_deep_trace(T, cfg.id, argv.id, node.id, S.output) # refresh the deep trace
p = materialize(S.output) # pure; ERR => fall through
if p ok: return done(S.output, p, node)
@@ -535,7 +535,7 @@ tree), and removes the resolve→runner edge.
This is the brief's flow, sharpened by config:
- *Phase 1* is the deep fast path: identical config-id **and argv-id** and an
- all-clear deepset refresh — every source/glob/fetch leaf unchanged **and** every
+ all-clear deepset refresh — every source/glob/blob leaf unchanged **and** every
node's `recipe-id` still recomputing the same — ⇒ reuse. `refresh` hits the
per-process memos and the deep-set-id validity cache, so a shared subtree is
checked once and an unchanged subtree is skipped by id equality.
@@ -611,7 +611,7 @@ run_recipe(T, cfg, argv, chain):
on success:
output = kit_cas_add_tree_from_dir(out)
put serialized cfg map (cfg.id) and argv vector (argv.id) into the CAS
- node = union(direct{recipe_id, source/glob/fetch/absent leaves}, child deepset nodes)
+ node = union(direct{recipe_id, source/glob/blob/absent leaves}, child deepset nodes)
# builds + stores the root deepset as a CAS blob, yields its deep-set-id
write_shallow_trace(T, recipe_id, argv.id, cfg.id, consumed key names,
direct leaves, dep edges with their config-ids and argv-ids, output)
@@ -837,7 +837,7 @@ machinery wholesale:
trace bodies and the CAS blobs they reference — the **serialized config-map and
argv blobs** (required, else an imported shallow trace cannot replay its
`need`s) and the **deepset closure blobs** a deep trace points at (required,
- else an imported deep trace cannot refresh), including any **fetched blob**
+ else an imported deep trace cannot refresh), including any **blob dependency**
leaves in shallow traces or deepsets — plus, optionally, the referenced output
trees/blobs.
- Trust is the DISTRIBUTE.md model unchanged: verify the minisign signature
diff --git a/src/build/bundle.c b/src/build/bundle.c
@@ -354,28 +354,28 @@ static int BUILD_MAYBE_UNUSED parse_trace_header(const KitContext* ctx,
_Alignof(BuildSourceLeaf));
t.globs = (BuildGlobLeaf*)heap_array(ctx, rows, sizeof *t.globs,
_Alignof(BuildGlobLeaf));
- t.fetches = (BuildFetchLeaf*)heap_array(ctx, rows, sizeof *t.fetches,
- _Alignof(BuildFetchLeaf));
+ t.blobs = (BuildBlobLeaf*)heap_array(ctx, rows, sizeof *t.blobs,
+ _Alignof(BuildBlobLeaf));
t.deps = (BuildDepEdge*)heap_array(ctx, rows, sizeof *t.deps,
_Alignof(BuildDepEdge));
- if (!t.configs || !t.sources || !t.globs || !t.fetches || !t.deps) {
+ if (!t.configs || !t.sources || !t.globs || !t.blobs || !t.deps) {
heap_free_array(ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(ctx, t.deps, rows, sizeof *t.deps);
return BUILD_ERR;
}
t.cap_configs = rows;
t.cap_sources = rows;
t.cap_globs = rows;
- t.cap_fetches = rows;
+ t.cap_blobs = rows;
t.cap_deps = rows;
if (build_shallow_parse(data, len, &t, err, sizeof err) != BUILD_OK) {
heap_free_array(ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(ctx, t.deps, rows, sizeof *t.deps);
return BUILD_ERR;
}
@@ -385,7 +385,7 @@ static int BUILD_MAYBE_UNUSED parse_trace_header(const KitContext* ctx,
heap_free_array(ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(ctx, t.deps, rows, sizeof *t.deps);
return BUILD_OK;
}
@@ -401,28 +401,28 @@ static int BUILD_MAYBE_UNUSED parse_trace_header(const KitContext* ctx,
_Alignof(BuildSourceLeaf));
t.globs = (BuildGlobLeaf*)heap_array(ctx, rows, sizeof *t.globs,
_Alignof(BuildGlobLeaf));
- t.fetches = (BuildFetchLeaf*)heap_array(ctx, rows, sizeof *t.fetches,
- _Alignof(BuildFetchLeaf));
+ t.blobs = (BuildBlobLeaf*)heap_array(ctx, rows, sizeof *t.blobs,
+ _Alignof(BuildBlobLeaf));
t.deps = (BuildDepEdge*)heap_array(ctx, rows, sizeof *t.deps,
_Alignof(BuildDepEdge));
- if (!t.configs || !t.sources || !t.globs || !t.fetches || !t.deps) {
+ if (!t.configs || !t.sources || !t.globs || !t.blobs || !t.deps) {
heap_free_array(ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(ctx, t.deps, rows, sizeof *t.deps);
return BUILD_ERR;
}
t.cap_configs = rows;
t.cap_sources = rows;
t.cap_globs = rows;
- t.cap_fetches = rows;
+ t.cap_blobs = rows;
t.cap_deps = rows;
if (build_test_shallow_parse(data, len, &t, err, sizeof err) != BUILD_OK) {
heap_free_array(ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(ctx, t.deps, rows, sizeof *t.deps);
return BUILD_ERR;
}
@@ -432,7 +432,7 @@ static int BUILD_MAYBE_UNUSED parse_trace_header(const KitContext* ctx,
heap_free_array(ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(ctx, t.deps, rows, sizeof *t.deps);
return BUILD_OK;
}
@@ -632,21 +632,21 @@ static int export_deepset_closure(KitBuildCoordinator* c,
_Alignof(BuildSourceLeaf));
ds.globs = (BuildGlobLeaf*)heap_array(c->ctx, rows, sizeof *ds.globs,
_Alignof(BuildGlobLeaf));
- ds.fetches = (BuildFetchLeaf*)heap_array(c->ctx, rows, sizeof *ds.fetches,
- _Alignof(BuildFetchLeaf));
+ ds.blobs = (BuildBlobLeaf*)heap_array(c->ctx, rows, sizeof *ds.blobs,
+ _Alignof(BuildBlobLeaf));
ds.children = (uint8_t(*)[BUILD_HASH_LEN])heap_array(
c->ctx, rows, sizeof *ds.children, _Alignof(uint8_t));
- if (!ds.configs || !ds.sources || !ds.globs || !ds.fetches || !ds.children)
+ if (!ds.configs || !ds.sources || !ds.globs || !ds.blobs || !ds.children)
goto out;
ds.cap_configs = rows;
ds.cap_sources = rows;
ds.cap_globs = rows;
- ds.cap_fetches = rows;
+ ds.cap_blobs = rows;
ds.cap_children = rows;
if (build_deepset_parse(fd.data, fd.size, &ds, err, sizeof err) != BUILD_OK)
goto out;
- for (i = 0u; i < ds.n_fetches; ++i)
- if (payload_write_blob_from_cas(c, ds.fetches[i].blob, root, seen) !=
+ for (i = 0u; i < ds.n_blobs; ++i)
+ if (payload_write_blob_from_cas(c, ds.blobs[i].blob, root, seen) !=
BUILD_OK)
goto out;
for (i = 0u; i < ds.n_children; ++i)
@@ -657,7 +657,7 @@ out:
heap_free_array(c->ctx, ds.configs, rows, sizeof *ds.configs);
heap_free_array(c->ctx, ds.sources, rows, sizeof *ds.sources);
heap_free_array(c->ctx, ds.globs, rows, sizeof *ds.globs);
- heap_free_array(c->ctx, ds.fetches, rows, sizeof *ds.fetches);
+ heap_free_array(c->ctx, ds.blobs, rows, sizeof *ds.blobs);
heap_free_array(c->ctx, ds.children, rows, sizeof *ds.children);
kit_cas_release(c->cas, &fd);
return ok;
@@ -685,23 +685,23 @@ static int import_deepset_closure(KitBuildCoordinator* c,
_Alignof(BuildSourceLeaf));
ds.globs = (BuildGlobLeaf*)heap_array(c->ctx, rows, sizeof *ds.globs,
_Alignof(BuildGlobLeaf));
- ds.fetches = (BuildFetchLeaf*)heap_array(c->ctx, rows, sizeof *ds.fetches,
- _Alignof(BuildFetchLeaf));
+ ds.blobs = (BuildBlobLeaf*)heap_array(c->ctx, rows, sizeof *ds.blobs,
+ _Alignof(BuildBlobLeaf));
ds.children = (uint8_t(*)[BUILD_HASH_LEN])heap_array(
c->ctx, rows, sizeof *ds.children, _Alignof(uint8_t));
- if (!ds.configs || !ds.sources || !ds.globs || !ds.fetches || !ds.children)
+ if (!ds.configs || !ds.sources || !ds.globs || !ds.blobs || !ds.children)
goto out;
ds.cap_configs = rows;
ds.cap_sources = rows;
ds.cap_globs = rows;
- ds.cap_fetches = rows;
+ ds.cap_blobs = rows;
ds.cap_children = rows;
if (build_deepset_parse(data, len, &ds, err, sizeof err) != BUILD_OK)
goto out;
- for (i = 0u; i < ds.n_fetches; ++i) {
+ for (i = 0u; i < ds.n_blobs; ++i) {
KitFileData dep_fd;
memset(&dep_fd, 0, sizeof dep_fd);
- if (payload_install_blob(c, ds.fetches[i].blob, root, seen, NULL, NULL,
+ if (payload_install_blob(c, ds.blobs[i].blob, root, seen, NULL, NULL,
&dep_fd) != BUILD_OK)
goto out;
release_file(c, &dep_fd);
@@ -714,7 +714,7 @@ out:
heap_free_array(c->ctx, ds.configs, rows, sizeof *ds.configs);
heap_free_array(c->ctx, ds.sources, rows, sizeof *ds.sources);
heap_free_array(c->ctx, ds.globs, rows, sizeof *ds.globs);
- heap_free_array(c->ctx, ds.fetches, rows, sizeof *ds.fetches);
+ heap_free_array(c->ctx, ds.blobs, rows, sizeof *ds.blobs);
heap_free_array(c->ctx, ds.children, rows, sizeof *ds.children);
release_file(c, &fd);
return ok;
@@ -759,16 +759,16 @@ static int BUILD_MAYBE_UNUSED export_trace_refs(KitBuildCoordinator* c,
_Alignof(BuildSourceLeaf));
t.globs = (BuildGlobLeaf*)heap_array(c->ctx, rows, sizeof *t.globs,
_Alignof(BuildGlobLeaf));
- t.fetches = (BuildFetchLeaf*)heap_array(c->ctx, rows, sizeof *t.fetches,
- _Alignof(BuildFetchLeaf));
+ t.blobs = (BuildBlobLeaf*)heap_array(c->ctx, rows, sizeof *t.blobs,
+ _Alignof(BuildBlobLeaf));
t.deps = (BuildDepEdge*)heap_array(c->ctx, rows, sizeof *t.deps,
_Alignof(BuildDepEdge));
- if (!t.configs || !t.sources || !t.globs || !t.fetches || !t.deps)
+ if (!t.configs || !t.sources || !t.globs || !t.blobs || !t.deps)
goto shallow_out;
t.cap_configs = rows;
t.cap_sources = rows;
t.cap_globs = rows;
- t.cap_fetches = rows;
+ t.cap_blobs = rows;
t.cap_deps = rows;
if (build_shallow_parse(data, len, &t, err, sizeof err) != BUILD_OK)
goto shallow_out;
@@ -784,8 +784,8 @@ static int BUILD_MAYBE_UNUSED export_trace_refs(KitBuildCoordinator* c,
BUILD_OK)
goto shallow_out;
}
- for (i = 0u; i < t.n_fetches; ++i)
- if (payload_write_blob_from_cas(c, t.fetches[i].blob, root, seen) !=
+ for (i = 0u; i < t.n_blobs; ++i)
+ if (payload_write_blob_from_cas(c, t.blobs[i].blob, root, seen) !=
BUILD_OK)
goto shallow_out;
ok = BUILD_OK;
@@ -793,7 +793,7 @@ shallow_out:
heap_free_array(c->ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(c->ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(c->ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(c->ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(c->ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(c->ctx, t.deps, rows, sizeof *t.deps);
return ok;
}
@@ -811,16 +811,16 @@ shallow_out:
_Alignof(BuildSourceLeaf));
t.globs = (BuildGlobLeaf*)heap_array(c->ctx, rows, sizeof *t.globs,
_Alignof(BuildGlobLeaf));
- t.fetches = (BuildFetchLeaf*)heap_array(c->ctx, rows, sizeof *t.fetches,
- _Alignof(BuildFetchLeaf));
+ t.blobs = (BuildBlobLeaf*)heap_array(c->ctx, rows, sizeof *t.blobs,
+ _Alignof(BuildBlobLeaf));
t.deps = (BuildDepEdge*)heap_array(c->ctx, rows, sizeof *t.deps,
_Alignof(BuildDepEdge));
- if (!t.configs || !t.sources || !t.globs || !t.fetches || !t.deps)
+ if (!t.configs || !t.sources || !t.globs || !t.blobs || !t.deps)
goto test_out;
t.cap_configs = rows;
t.cap_sources = rows;
t.cap_globs = rows;
- t.cap_fetches = rows;
+ t.cap_blobs = rows;
t.cap_deps = rows;
if (build_test_shallow_parse(data, len, &t, err, sizeof err) != BUILD_OK)
goto test_out;
@@ -836,8 +836,8 @@ shallow_out:
BUILD_OK)
goto test_out;
}
- for (i = 0u; i < t.n_fetches; ++i)
- if (payload_write_blob_from_cas(c, t.fetches[i].blob, root, seen) !=
+ for (i = 0u; i < t.n_blobs; ++i)
+ if (payload_write_blob_from_cas(c, t.blobs[i].blob, root, seen) !=
BUILD_OK)
goto test_out;
ok = BUILD_OK;
@@ -845,7 +845,7 @@ test_out:
heap_free_array(c->ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(c->ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(c->ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(c->ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(c->ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(c->ctx, t.deps, rows, sizeof *t.deps);
return ok;
}
@@ -897,16 +897,16 @@ static int BUILD_MAYBE_UNUSED import_trace_refs(KitBuildCoordinator* c,
_Alignof(BuildSourceLeaf));
t.globs = (BuildGlobLeaf*)heap_array(c->ctx, rows, sizeof *t.globs,
_Alignof(BuildGlobLeaf));
- t.fetches = (BuildFetchLeaf*)heap_array(c->ctx, rows, sizeof *t.fetches,
- _Alignof(BuildFetchLeaf));
+ t.blobs = (BuildBlobLeaf*)heap_array(c->ctx, rows, sizeof *t.blobs,
+ _Alignof(BuildBlobLeaf));
t.deps = (BuildDepEdge*)heap_array(c->ctx, rows, sizeof *t.deps,
_Alignof(BuildDepEdge));
- if (!t.configs || !t.sources || !t.globs || !t.fetches || !t.deps)
+ if (!t.configs || !t.sources || !t.globs || !t.blobs || !t.deps)
goto shallow_out;
t.cap_configs = rows;
t.cap_sources = rows;
t.cap_globs = rows;
- t.cap_fetches = rows;
+ t.cap_blobs = rows;
t.cap_deps = rows;
if (build_shallow_parse(data, len, &t, err, sizeof err) != BUILD_OK)
goto shallow_out;
@@ -932,8 +932,8 @@ static int BUILD_MAYBE_UNUSED import_trace_refs(KitBuildCoordinator* c,
goto shallow_out;
release_file(c, &fd);
}
- for (i = 0u; i < t.n_fetches; ++i) {
- if (payload_install_blob(c, t.fetches[i].blob, root, seen, NULL, NULL,
+ for (i = 0u; i < t.n_blobs; ++i) {
+ if (payload_install_blob(c, t.blobs[i].blob, root, seen, NULL, NULL,
&fd) != BUILD_OK)
goto shallow_out;
release_file(c, &fd);
@@ -944,7 +944,7 @@ shallow_out:
heap_free_array(c->ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(c->ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(c->ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(c->ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(c->ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(c->ctx, t.deps, rows, sizeof *t.deps);
return ok;
}
@@ -964,16 +964,16 @@ shallow_out:
_Alignof(BuildSourceLeaf));
t.globs = (BuildGlobLeaf*)heap_array(c->ctx, rows, sizeof *t.globs,
_Alignof(BuildGlobLeaf));
- t.fetches = (BuildFetchLeaf*)heap_array(c->ctx, rows, sizeof *t.fetches,
- _Alignof(BuildFetchLeaf));
+ t.blobs = (BuildBlobLeaf*)heap_array(c->ctx, rows, sizeof *t.blobs,
+ _Alignof(BuildBlobLeaf));
t.deps = (BuildDepEdge*)heap_array(c->ctx, rows, sizeof *t.deps,
_Alignof(BuildDepEdge));
- if (!t.configs || !t.sources || !t.globs || !t.fetches || !t.deps)
+ if (!t.configs || !t.sources || !t.globs || !t.blobs || !t.deps)
goto test_out;
t.cap_configs = rows;
t.cap_sources = rows;
t.cap_globs = rows;
- t.cap_fetches = rows;
+ t.cap_blobs = rows;
t.cap_deps = rows;
if (build_test_shallow_parse(data, len, &t, err, sizeof err) != BUILD_OK)
goto test_out;
@@ -999,8 +999,8 @@ shallow_out:
goto test_out;
release_file(c, &fd);
}
- for (i = 0u; i < t.n_fetches; ++i) {
- if (payload_install_blob(c, t.fetches[i].blob, root, seen, NULL, NULL,
+ for (i = 0u; i < t.n_blobs; ++i) {
+ if (payload_install_blob(c, t.blobs[i].blob, root, seen, NULL, NULL,
&fd) != BUILD_OK)
goto test_out;
release_file(c, &fd);
@@ -1011,7 +1011,7 @@ test_out:
heap_free_array(c->ctx, t.configs, rows, sizeof *t.configs);
heap_free_array(c->ctx, t.sources, rows, sizeof *t.sources);
heap_free_array(c->ctx, t.globs, rows, sizeof *t.globs);
- heap_free_array(c->ctx, t.fetches, rows, sizeof *t.fetches);
+ heap_free_array(c->ctx, t.blobs, rows, sizeof *t.blobs);
heap_free_array(c->ctx, t.deps, rows, sizeof *t.deps);
return ok;
}
diff --git a/src/build/coord.c b/src/build/coord.c
@@ -45,7 +45,7 @@ typedef struct BuildDeepSetMemo {
BuildConfigLeaf* configs;
BuildSourceLeaf* sources;
BuildGlobLeaf* globs;
- BuildFetchLeaf* fetches;
+ BuildBlobLeaf* blobs;
const BuildLeafSet** children;
int valid_known;
int valid;
@@ -260,9 +260,9 @@ static void free_deepsets(KitBuildCoordinator* c) {
if (n->globs)
c->ctx->heap->free(c->ctx->heap, n->globs,
n->leaf.n_globs * sizeof *n->globs);
- if (n->fetches)
- c->ctx->heap->free(c->ctx->heap, n->fetches,
- n->leaf.n_fetches * sizeof *n->fetches);
+ if (n->blobs)
+ c->ctx->heap->free(c->ctx->heap, n->blobs,
+ n->leaf.n_blobs * sizeof *n->blobs);
if (n->children)
c->ctx->heap->free(c->ctx->heap, n->children,
n->leaf.n_children * sizeof *n->children);
@@ -752,12 +752,12 @@ int build_coord_leafset_intern(KitBuildCoordinator* c, const BuildLeafSet* in,
if (!n->globs) goto oom;
memcpy(n->globs, in->globs, in->n_globs * sizeof *n->globs);
}
- if (in->n_fetches) {
- n->fetches = (BuildFetchLeaf*)c->ctx->heap->alloc(
- c->ctx->heap, in->n_fetches * sizeof *n->fetches,
- _Alignof(BuildFetchLeaf));
- if (!n->fetches) goto oom;
- memcpy(n->fetches, in->fetches, in->n_fetches * sizeof *n->fetches);
+ if (in->n_blobs) {
+ n->blobs = (BuildBlobLeaf*)c->ctx->heap->alloc(
+ c->ctx->heap, in->n_blobs * sizeof *n->blobs,
+ _Alignof(BuildBlobLeaf));
+ if (!n->blobs) goto oom;
+ memcpy(n->blobs, in->blobs, in->n_blobs * sizeof *n->blobs);
}
if (in->n_children) {
n->children = (const BuildLeafSet**)c->ctx->heap->alloc(
@@ -769,7 +769,7 @@ int build_coord_leafset_intern(KitBuildCoordinator* c, const BuildLeafSet* in,
n->leaf.configs = n->configs;
n->leaf.sources = n->sources;
n->leaf.globs = n->globs;
- n->leaf.fetches = n->fetches;
+ n->leaf.blobs = n->blobs;
n->leaf.children = n->children;
n->next = c->deepsets;
c->deepsets = n;
@@ -786,9 +786,9 @@ oom:
if (n->globs)
c->ctx->heap->free(c->ctx->heap, n->globs,
in->n_globs * sizeof *n->globs);
- if (n->fetches)
- c->ctx->heap->free(c->ctx->heap, n->fetches,
- in->n_fetches * sizeof *n->fetches);
+ if (n->blobs)
+ c->ctx->heap->free(c->ctx->heap, n->blobs,
+ in->n_blobs * sizeof *n->blobs);
if (n->children)
c->ctx->heap->free(c->ctx->heap, n->children,
in->n_children * sizeof *n->children);
@@ -824,8 +824,8 @@ static void count_deepset_rows(const uint8_t* data, size_t len, size_t* ncfg,
} else if (n == sizeof("[child]") - 1u &&
memcmp(data + start, "[child]", n) == 0) {
sec = 4;
- } else if (n == sizeof("[fetch]") - 1u &&
- memcmp(data + start, "[fetch]", n) == 0) {
+ } else if (n == sizeof("[blob]") - 1u &&
+ memcmp(data + start, "[blob]", n) == 0) {
sec = 5;
} else if (data[start] != '[' && data[start] != 'k') {
if (sec == 1) ++*ncfg;
@@ -849,7 +849,7 @@ int build_coord_deepset_load(KitBuildCoordinator* c,
BuildConfigLeaf* configs = NULL;
BuildSourceLeaf* sources = NULL;
BuildGlobLeaf* globs = NULL;
- BuildFetchLeaf* fetches = NULL;
+ BuildBlobLeaf* blobs = NULL;
uint8_t(*child_ids)[BUILD_HASH_LEN] = NULL;
const BuildLeafSet** children = NULL;
size_t ncfg, ns, ng, nf, nc, i;
@@ -882,9 +882,9 @@ int build_coord_deepset_load(KitBuildCoordinator* c,
if (!globs) goto out_release;
}
if (nf) {
- fetches = (BuildFetchLeaf*)c->ctx->heap->alloc(
- c->ctx->heap, nf * sizeof *fetches, _Alignof(BuildFetchLeaf));
- if (!fetches) goto out_release;
+ blobs = (BuildBlobLeaf*)c->ctx->heap->alloc(
+ c->ctx->heap, nf * sizeof *blobs, _Alignof(BuildBlobLeaf));
+ if (!blobs) goto out_release;
}
if (nc) {
child_ids = (uint8_t(*)[BUILD_HASH_LEN])c->ctx->heap->alloc(
@@ -900,8 +900,8 @@ int build_coord_deepset_load(KitBuildCoordinator* c,
ds.cap_sources = ns;
ds.globs = globs;
ds.cap_globs = ng;
- ds.fetches = fetches;
- ds.cap_fetches = nf;
+ ds.blobs = blobs;
+ ds.cap_blobs = nf;
ds.children = child_ids;
ds.cap_children = nc;
if (build_deepset_parse(fd.data, fd.size, &ds, NULL, 0) != BUILD_OK)
@@ -920,8 +920,8 @@ int build_coord_deepset_load(KitBuildCoordinator* c,
leaf.n_sources = ds.n_sources;
leaf.globs = globs;
leaf.n_globs = ds.n_globs;
- leaf.fetches = fetches;
- leaf.n_fetches = ds.n_fetches;
+ leaf.blobs = blobs;
+ leaf.n_blobs = ds.n_blobs;
leaf.children = children;
leaf.n_children = ds.n_children;
if (build_coord_leafset_intern(c, &leaf, out) != BUILD_OK) goto out_release;
@@ -934,8 +934,8 @@ out_release:
if (sources)
c->ctx->heap->free(c->ctx->heap, sources, ns * sizeof *sources);
if (globs) c->ctx->heap->free(c->ctx->heap, globs, ng * sizeof *globs);
- if (fetches)
- c->ctx->heap->free(c->ctx->heap, fetches, nf * sizeof *fetches);
+ if (blobs)
+ c->ctx->heap->free(c->ctx->heap, blobs, nf * sizeof *blobs);
if (child_ids)
c->ctx->heap->free(c->ctx->heap, child_ids, nc * sizeof *child_ids);
if (children)
diff --git a/src/build/coord.h b/src/build/coord.h
@@ -31,7 +31,7 @@
/* The in-memory deepset node: one node of the transitive input-closure DAG that
* a resolution returns and the targets memo caches (trace.h BuildDeepSet is its
- * on-disk/CAS-blob form). It carries this node's DIRECT source/glob/fetch leaves, its
+ * on-disk/CAS-blob form). It carries this node's DIRECT source/glob/blob leaves, its
* target + recipe-id, and pointers to its children's (interned) nodes. `id` is
* the deep-set-id — the CAS blob id of the emitted node — so an unchanged
* subtree is recognized by id equality without descending. Folded into a parent
@@ -48,8 +48,8 @@ typedef struct BuildLeafSet {
size_t n_sources;
BuildGlobLeaf* globs;
size_t n_globs;
- BuildFetchLeaf* fetches;
- size_t n_fetches;
+ BuildBlobLeaf* blobs;
+ size_t n_blobs;
const struct BuildLeafSet** children; /* direct deps' interned nodes */
size_t n_children;
} BuildLeafSet;
diff --git a/src/build/resolve.c b/src/build/resolve.c
@@ -94,8 +94,8 @@ static int shallow_direct_match(KitBuildCoordinator* c,
return 0;
if (!build_id_eq(hash, st->globs[i].result_hash)) return 0;
}
- for (i = 0; i < st->n_fetches; ++i) {
- if (kit_cas_has_blob(c->cas, st->fetches[i].blob) != KIT_OK) return 0;
+ for (i = 0; i < st->n_blobs; ++i) {
+ if (kit_cas_has_blob(c->cas, st->blobs[i].blob) != KIT_OK) return 0;
}
return 1;
}
@@ -150,8 +150,8 @@ static int try_shallow_trace(KitBuildCoordinator* c, KitSlice target,
log.n_sources = st->n_sources;
log.globs = st->globs;
log.n_globs = st->n_globs;
- log.fetches = st->fetches;
- log.n_fetches = st->n_fetches;
+ log.blobs = st->blobs;
+ log.n_blobs = st->n_blobs;
log.deps = deps_copy;
log.n_deps = st->n_deps;
log.child_leafsets = child_leafsets;
@@ -213,8 +213,8 @@ static int try_test_shallow_trace(KitBuildCoordinator* c, KitSlice target,
log.n_sources = st->n_sources;
log.globs = st->globs;
log.n_globs = st->n_globs;
- log.fetches = st->fetches;
- log.n_fetches = st->n_fetches;
+ log.blobs = st->blobs;
+ log.n_blobs = st->n_blobs;
log.deps = deps_copy;
log.n_deps = st->n_deps;
log.child_leafsets = child_leafsets;
@@ -446,7 +446,7 @@ scan_record:
BuildConfigLeaf configs[128];
BuildSourceLeaf sources[128];
BuildGlobLeaf globs[128];
- BuildFetchLeaf fetches[128];
+ BuildBlobLeaf blobs[128];
BuildDepEdge deps[128];
BuildShallowTrace st;
size_t rows;
@@ -465,8 +465,8 @@ scan_record:
st.cap_sources = sizeof sources / sizeof sources[0];
st.globs = globs;
st.cap_globs = sizeof globs / sizeof globs[0];
- st.fetches = fetches;
- st.cap_fetches = sizeof fetches / sizeof fetches[0];
+ st.blobs = blobs;
+ st.cap_blobs = sizeof blobs / sizeof blobs[0];
st.deps = deps;
st.cap_deps = sizeof deps / sizeof deps[0];
if (rows <= sizeof configs / sizeof configs[0] &&
@@ -568,7 +568,7 @@ scan_record:
BuildConfigLeaf configs[128];
BuildSourceLeaf sources[128];
BuildGlobLeaf globs[128];
- BuildFetchLeaf fetches[128];
+ BuildBlobLeaf blobs[128];
BuildDepEdge deps[128];
BuildShallowTrace st;
size_t nrows;
@@ -587,8 +587,8 @@ scan_record:
st.cap_sources = sizeof sources / sizeof sources[0];
st.globs = globs;
st.cap_globs = sizeof globs / sizeof globs[0];
- st.fetches = fetches;
- st.cap_fetches = sizeof fetches / sizeof fetches[0];
+ st.blobs = blobs;
+ st.cap_blobs = sizeof blobs / sizeof blobs[0];
st.deps = deps;
st.cap_deps = sizeof deps / sizeof deps[0];
if (nrows <= sizeof configs / sizeof configs[0] &&
@@ -682,8 +682,8 @@ int build_leafset_union(KitBuildCoordinator* c, const BuildLeafSet* direct,
ds.n_sources = direct->n_sources;
ds.globs = direct->globs;
ds.n_globs = direct->n_globs;
- ds.fetches = direct->fetches;
- ds.n_fetches = direct->n_fetches;
+ ds.blobs = direct->blobs;
+ ds.n_blobs = direct->n_blobs;
ds.children = child_ids;
ds.n_children = nchildren;
if (kit_writer_mem(c->ctx->heap, &w) != KIT_OK || !w) goto out;
@@ -705,8 +705,8 @@ int build_leafset_union(KitBuildCoordinator* c, const BuildLeafSet* direct,
leaf.n_sources = direct->n_sources;
leaf.globs = direct->globs;
leaf.n_globs = direct->n_globs;
- leaf.fetches = direct->fetches;
- leaf.n_fetches = direct->n_fetches;
+ leaf.blobs = direct->blobs;
+ leaf.n_blobs = direct->n_blobs;
leaf.children = child_ptrs;
leaf.n_children = nchildren;
if (build_coord_leafset_intern(c, &leaf, out) != BUILD_OK) goto out;
@@ -755,8 +755,8 @@ int build_leafset_refresh(KitBuildCoordinator* c, const BuildLeafSet* leafset,
return BUILD_ERR;
if (!build_id_eq(hash, leafset->globs[i].result_hash)) goto done;
}
- for (i = 0; i < leafset->n_fetches; ++i) {
- if (kit_cas_has_blob(c->cas, leafset->fetches[i].blob) != KIT_OK)
+ for (i = 0; i < leafset->n_blobs; ++i) {
+ if (kit_cas_has_blob(c->cas, leafset->blobs[i].blob) != KIT_OK)
goto done;
}
for (i = 0; i < leafset->n_children; ++i) {
diff --git a/src/build/resolve.h b/src/build/resolve.h
@@ -15,7 +15,7 @@
* §Resolution algorithm):
*
* Phase 1 deep fast path - same config-id AND argv-id, and an all-clear
- * refresh of the deepset closure (every source/glob/fetch
+ * refresh of the deepset closure (every source/glob/blob
* leaf unchanged AND every node's recipe-id still
* recomputes the same) => reuse, no graph walk.
* Phase 2 shallow path - config, argv, and/or sources moved: guard on the
@@ -133,7 +133,7 @@ int build_materialize(KitBuildCoordinator*,
size_t cap);
/* Build a parent's deepset node from its DIRECT leaves and its children's nodes.
- * `direct` carries this node's target, recipe-id, and direct source/glob/fetch leaves
+ * `direct` carries this node's target, recipe-id, and direct source/glob/blob leaves
* (its children fields empty); `children` are the deps' resolved nodes. Computes
* the deep-set-id, stores the canonical node as a CAS blob (kit_cas_add_blob —
* the children's blobs were stored when they were built, so this is incremental
diff --git a/src/build/runner.c b/src/build/runner.c
@@ -129,17 +129,17 @@ static int append_glob(BuildDepLog* log, KitSlice pattern,
return BUILD_OK;
}
-static int append_fetch(BuildDepLog* log,
+static int append_blob(BuildDepLog* log,
const uint8_t blob[BUILD_HASH_LEN]) {
- BuildFetchLeaf* row;
+ BuildBlobLeaf* row;
size_t i;
if (!log || !blob) return BUILD_ERR;
- for (i = 0; i < log->n_fetches; ++i) {
- row = &log->fetches[i];
+ for (i = 0; i < log->n_blobs; ++i) {
+ row = &log->blobs[i];
if (build_id_eq(row->blob, blob)) return BUILD_OK;
}
- if (log->n_fetches >= log->cap_fetches) return BUILD_ERR;
- row = &log->fetches[log->n_fetches++];
+ if (log->n_blobs >= log->cap_blobs) return BUILD_ERR;
+ row = &log->blobs[log->n_blobs++];
memcpy(row->blob, blob, BUILD_HASH_LEN);
return BUILD_OK;
}
@@ -383,7 +383,7 @@ static int build_run_recipe_impl(KitBuildCoordinator* c, KitSlice target,
BuildConfigLeaf configs[128];
BuildSourceLeaf sources[128];
BuildGlobLeaf globs[128];
- BuildFetchLeaf fetches[128];
+ BuildBlobLeaf blobs[128];
BuildDepEdge deps[128];
const BuildLeafSet* child_leafsets[128];
BuildPendingNeed pending[128];
@@ -418,8 +418,8 @@ static int build_run_recipe_impl(KitBuildCoordinator* c, KitSlice target,
log.cap_sources = sizeof sources / sizeof sources[0];
log.globs = globs;
log.cap_globs = sizeof globs / sizeof globs[0];
- log.fetches = fetches;
- log.cap_fetches = sizeof fetches / sizeof fetches[0];
+ log.blobs = blobs;
+ log.cap_blobs = sizeof blobs / sizeof blobs[0];
log.deps = deps;
log.cap_deps = sizeof deps / sizeof deps[0];
log.child_leafsets = child_leafsets;
@@ -514,7 +514,7 @@ static int build_run_test_recipe_impl(KitBuildCoordinator* c, KitSlice target,
BuildConfigLeaf configs[128];
BuildSourceLeaf sources[128];
BuildGlobLeaf globs[128];
- BuildFetchLeaf fetches[128];
+ BuildBlobLeaf blobs[128];
BuildDepEdge deps[128];
const BuildLeafSet* child_leafsets[128];
BuildPendingNeed pending[128];
@@ -557,8 +557,8 @@ static int build_run_test_recipe_impl(KitBuildCoordinator* c, KitSlice target,
log.cap_sources = sizeof sources / sizeof sources[0];
log.globs = globs;
log.cap_globs = sizeof globs / sizeof globs[0];
- log.fetches = fetches;
- log.cap_fetches = sizeof fetches / sizeof fetches[0];
+ log.blobs = blobs;
+ log.cap_blobs = sizeof blobs / sizeof blobs[0];
log.deps = deps;
log.cap_deps = sizeof deps / sizeof deps[0];
log.child_leafsets = child_leafsets;
@@ -723,7 +723,7 @@ int build_runner_service(KitBuildCoordinator* c, KitBuildConn* conn,
if (kit_hex_decode(blob, req.arg.s, BUILD_HASH_LEN) != KIT_OK ||
build_coord_fetch_blob(c, blob, req.argv, req.argc, path,
sizeof path) != BUILD_OK ||
- append_fetch(log, blob) != BUILD_OK) {
+ append_blob(log, blob) != BUILD_OK) {
resp_error(&resp, KIT_ERR, "fetch failed");
} else {
memcpy(resp.id, blob, BUILD_HASH_LEN);
@@ -874,8 +874,8 @@ int build_runner_record_traces(KitBuildCoordinator* c, KitSlice target,
direct.n_sources = log->n_sources;
direct.globs = log->globs;
direct.n_globs = log->n_globs;
- direct.fetches = log->fetches;
- direct.n_fetches = log->n_fetches;
+ direct.blobs = log->blobs;
+ direct.n_blobs = log->n_blobs;
direct.children = log->child_leafsets;
direct.n_children = log->n_children;
if (build_leafset_union(c, &direct, log->child_leafsets, log->n_children,
@@ -895,8 +895,8 @@ int build_runner_record_traces(KitBuildCoordinator* c, KitSlice target,
shallow.n_sources = log->n_sources;
shallow.globs = log->globs;
shallow.n_globs = log->n_globs;
- shallow.fetches = log->fetches;
- shallow.n_fetches = log->n_fetches;
+ shallow.blobs = log->blobs;
+ shallow.n_blobs = log->n_blobs;
shallow.deps = log->deps;
shallow.n_deps = log->n_deps;
@@ -965,8 +965,8 @@ int build_runner_record_test_traces(KitBuildCoordinator* c, KitSlice target,
direct.n_sources = log->n_sources;
direct.globs = log->globs;
direct.n_globs = log->n_globs;
- direct.fetches = log->fetches;
- direct.n_fetches = log->n_fetches;
+ direct.blobs = log->blobs;
+ direct.n_blobs = log->n_blobs;
direct.children = log->child_leafsets;
direct.n_children = log->n_children;
if (build_leafset_union(c, &direct, log->child_leafsets, log->n_children,
@@ -986,8 +986,8 @@ int build_runner_record_test_traces(KitBuildCoordinator* c, KitSlice target,
shallow.n_sources = log->n_sources;
shallow.globs = log->globs;
shallow.n_globs = log->n_globs;
- shallow.fetches = log->fetches;
- shallow.n_fetches = log->n_fetches;
+ shallow.blobs = log->blobs;
+ shallow.n_blobs = log->n_blobs;
shallow.deps = log->deps;
shallow.n_deps = log->n_deps;
diff --git a/src/build/runner.h b/src/build/runner.h
@@ -52,8 +52,8 @@ typedef struct BuildDepLog {
size_t n_sources, cap_sources;
BuildGlobLeaf* globs; /* direct globs */
size_t n_globs, cap_globs;
- BuildFetchLeaf* fetches; /* direct hash-pinned fetches */
- size_t n_fetches, cap_fetches;
+ BuildBlobLeaf* blobs; /* direct hash-pinned blobs */
+ size_t n_blobs, cap_blobs;
BuildDepEdge* deps; /* AWAITED `need` edges (recorded) */
size_t n_deps, cap_deps;
const BuildLeafSet** child_leafsets; /* one deepset node per awaited dep */
@@ -83,7 +83,7 @@ typedef struct BuildDepLog {
* dispatch them, appending each dependency to `log`. Drives the protocol.h
* codec over the transport. `chain` is this recipe's chain frame (its dispatched
* needs extend it). Commands:
- * config-get/source/glob/fetch — synchronous; log the dep, reply.
+ * config-get/source/glob/blob — synchronous; log the dep, reply.
* need (fused) — build_resolve inline on this thread; log the edge.
* need-submit — build_coord_dispatch(dep) (concurrent, no block),
* stash a BuildPendingNeed, reply a token. Cycles and
diff --git a/src/build/trace.c b/src/build/trace.c
@@ -107,7 +107,7 @@ static int glob_cmp(const BuildGlobLeaf* a, const BuildGlobLeaf* b) {
return strcmp(a->pattern, b->pattern);
}
-static int fetch_cmp(const BuildFetchLeaf* a, const BuildFetchLeaf* b) {
+static int blob_cmp(const BuildBlobLeaf* a, const BuildBlobLeaf* b) {
return id_cmp(a->blob, b->blob);
}
@@ -260,29 +260,29 @@ static int emit_sorted_globs(const BuildGlobLeaf* rows, size_t n, KitWriter* out
return BUILD_OK;
}
-static int emit_fetch_row(KitWriter* out, const BuildFetchLeaf* row) {
+static int emit_blob_row(KitWriter* out, const BuildBlobLeaf* row) {
char hex[BUILD_HEX_LEN];
hex_encode(hex, row->blob);
if (emit_bytes(out, hex) != BUILD_OK) return BUILD_ERR;
return emit_bytes(out, "\n");
}
-static int emit_sorted_fetches(const BuildFetchLeaf* rows, size_t n,
+static int emit_sorted_blobs(const BuildBlobLeaf* rows, size_t n,
KitWriter* out, char* err, size_t errcap) {
- const BuildFetchLeaf* prev = NULL;
+ const BuildBlobLeaf* prev = NULL;
size_t emitted = 0;
- if (n && !rows) return set_err(err, errcap, "missing fetch rows");
- if (emit_section(out, "fetch") != BUILD_OK) return BUILD_ERR;
+ if (n && !rows) return set_err(err, errcap, "missing blob rows");
+ if (emit_section(out, "blob") != BUILD_OK) return BUILD_ERR;
while (emitted < n) {
- const BuildFetchLeaf* best = NULL;
+ const BuildBlobLeaf* best = NULL;
size_t i;
for (i = 0; i < n; ++i) {
- const BuildFetchLeaf* cur = &rows[i];
- int after_prev = !prev || fetch_cmp(prev, cur) < 0;
- if (after_prev && (!best || fetch_cmp(cur, best) < 0)) best = cur;
+ const BuildBlobLeaf* cur = &rows[i];
+ int after_prev = !prev || blob_cmp(prev, cur) < 0;
+ if (after_prev && (!best || blob_cmp(cur, best) < 0)) best = cur;
}
- if (!best) return set_err(err, errcap, "duplicate fetch row");
- if (emit_fetch_row(out, best) != BUILD_OK) return BUILD_ERR;
+ if (!best) return set_err(err, errcap, "duplicate blob row");
+ if (emit_blob_row(out, best) != BUILD_OK) return BUILD_ERR;
prev = best;
++emitted;
}
@@ -431,7 +431,7 @@ static int shallow_emit_like(const BuildShallowTrace* t, KitWriter* out,
return BUILD_ERR;
if (emit_sorted_globs(t->globs, t->n_globs, out, err, errcap) != BUILD_OK)
return BUILD_ERR;
- if (emit_sorted_fetches(t->fetches, t->n_fetches, out, err, errcap) !=
+ if (emit_sorted_blobs(t->blobs, t->n_blobs, out, err, errcap) !=
BUILD_OK)
return BUILD_ERR;
if (emit_sorted_deps(t->deps, t->n_deps, out, err, errcap) != BUILD_OK)
@@ -490,7 +490,7 @@ int build_deepset_emit(const BuildDeepSet* t, KitWriter* out, char* err,
return BUILD_ERR;
if (emit_sorted_globs(t->globs, t->n_globs, out, err, errcap) != BUILD_OK)
return BUILD_ERR;
- if (emit_sorted_fetches(t->fetches, t->n_fetches, out, err, errcap) !=
+ if (emit_sorted_blobs(t->blobs, t->n_blobs, out, err, errcap) !=
BUILD_OK)
return BUILD_ERR;
if (emit_sorted_children(t->children, t->n_children, out, err, errcap) !=
@@ -515,7 +515,7 @@ typedef enum TraceSection {
TRACE_SEC_CONFIG,
TRACE_SEC_SOURCE,
TRACE_SEC_GLOB,
- TRACE_SEC_FETCH,
+ TRACE_SEC_BLOB,
TRACE_SEC_DEP,
TRACE_SEC_CHILD,
TRACE_SEC_RECORD_ROWS
@@ -755,39 +755,39 @@ static int append_deepset_glob(BuildDeepSet* out, char** fields, size_t n,
return BUILD_OK;
}
-static int parse_fetch_leaf(char** fields, size_t n, BuildFetchLeaf* row,
+static int parse_blob_leaf(char** fields, size_t n, BuildBlobLeaf* row,
char* err, size_t errcap) {
if (expect_field_count(n, 1u, err, errcap) != BUILD_OK) return BUILD_ERR;
if (hex_decode_strict(fields[0], row->blob) != BUILD_OK)
- return set_err(err, errcap, "bad fetch hash");
+ return set_err(err, errcap, "bad blob hash");
return BUILD_OK;
}
-static int append_shallow_fetch(BuildShallowTrace* out, char** fields, size_t n,
+static int append_shallow_blob(BuildShallowTrace* out, char** fields, size_t n,
char* err, size_t errcap) {
- BuildFetchLeaf* row;
- if (out->n_fetches >= out->cap_fetches)
- return set_err(err, errcap, "too many fetch rows");
- row = &out->fetches[out->n_fetches];
- if (parse_fetch_leaf(fields, n, row, err, errcap) != BUILD_OK)
+ BuildBlobLeaf* row;
+ if (out->n_blobs >= out->cap_blobs)
+ return set_err(err, errcap, "too many blob rows");
+ row = &out->blobs[out->n_blobs];
+ if (parse_blob_leaf(fields, n, row, err, errcap) != BUILD_OK)
return BUILD_ERR;
- if (out->n_fetches && fetch_cmp(&out->fetches[out->n_fetches - 1u], row) >= 0)
- return set_err(err, errcap, "non-canonical fetch rows");
- ++out->n_fetches;
+ if (out->n_blobs && blob_cmp(&out->blobs[out->n_blobs - 1u], row) >= 0)
+ return set_err(err, errcap, "non-canonical blob rows");
+ ++out->n_blobs;
return BUILD_OK;
}
-static int append_deepset_fetch(BuildDeepSet* out, char** fields, size_t n,
+static int append_deepset_blob(BuildDeepSet* out, char** fields, size_t n,
char* err, size_t errcap) {
- BuildFetchLeaf* row;
- if (out->n_fetches >= out->cap_fetches)
- return set_err(err, errcap, "too many fetch rows");
- row = &out->fetches[out->n_fetches];
- if (parse_fetch_leaf(fields, n, row, err, errcap) != BUILD_OK)
+ BuildBlobLeaf* row;
+ if (out->n_blobs >= out->cap_blobs)
+ return set_err(err, errcap, "too many blob rows");
+ row = &out->blobs[out->n_blobs];
+ if (parse_blob_leaf(fields, n, row, err, errcap) != BUILD_OK)
return BUILD_ERR;
- if (out->n_fetches && fetch_cmp(&out->fetches[out->n_fetches - 1u], row) >= 0)
- return set_err(err, errcap, "non-canonical fetch rows");
- ++out->n_fetches;
+ if (out->n_blobs && blob_cmp(&out->blobs[out->n_blobs - 1u], row) >= 0)
+ return set_err(err, errcap, "non-canonical blob rows");
+ ++out->n_blobs;
return BUILD_OK;
}
@@ -869,14 +869,14 @@ static int shallow_parse_like(const uint8_t* data, size_t len,
if (!data || !out) return set_err(err, errcap, "missing shallow trace");
if ((out->cap_configs && !out->configs) ||
(out->cap_sources && !out->sources) || (out->cap_globs && !out->globs) ||
- (out->cap_fetches && !out->fetches) ||
+ (out->cap_blobs && !out->blobs) ||
(out->cap_deps && !out->deps))
return set_err(err, errcap, "missing trace storage");
memset(out->target, 0, sizeof out->target);
out->n_configs = 0;
out->n_sources = 0;
out->n_globs = 0;
- out->n_fetches = 0;
+ out->n_blobs = 0;
out->n_deps = 0;
memset(&p, 0, sizeof p);
p.data = data;
@@ -904,10 +904,10 @@ static int shallow_parse_like(const uint8_t* data, size_t len,
sec = TRACE_SEC_SOURCE;
} else if (strcmp(line, "[glob]") == 0 && sec == TRACE_SEC_SOURCE) {
sec = TRACE_SEC_GLOB;
- } else if (strcmp(line, "[fetch]") == 0 && sec == TRACE_SEC_GLOB) {
- sec = TRACE_SEC_FETCH;
+ } else if (strcmp(line, "[blob]") == 0 && sec == TRACE_SEC_GLOB) {
+ sec = TRACE_SEC_BLOB;
} else if (strcmp(line, "[dep]") == 0 &&
- (sec == TRACE_SEC_GLOB || sec == TRACE_SEC_FETCH)) {
+ (sec == TRACE_SEC_GLOB || sec == TRACE_SEC_BLOB)) {
sec = TRACE_SEC_DEP;
} else {
return set_err(err, errcap, "bad shallow section");
@@ -950,8 +950,8 @@ static int shallow_parse_like(const uint8_t* data, size_t len,
} else if (sec == TRACE_SEC_GLOB) {
if (append_shallow_glob(out, fields, n, err, errcap) != BUILD_OK)
return BUILD_ERR;
- } else if (sec == TRACE_SEC_FETCH) {
- if (append_shallow_fetch(out, fields, n, err, errcap) != BUILD_OK)
+ } else if (sec == TRACE_SEC_BLOB) {
+ if (append_shallow_blob(out, fields, n, err, errcap) != BUILD_OK)
return BUILD_ERR;
} else if (sec == TRACE_SEC_DEP) {
if (append_dep(out, fields, n, err, errcap) != BUILD_OK) return BUILD_ERR;
@@ -1055,14 +1055,14 @@ int build_deepset_parse(const uint8_t* data, size_t len, BuildDeepSet* out,
if (!data || !out) return set_err(err, errcap, "missing deepset");
if ((out->cap_configs && !out->configs) ||
(out->cap_sources && !out->sources) || (out->cap_globs && !out->globs) ||
- (out->cap_fetches && !out->fetches) ||
+ (out->cap_blobs && !out->blobs) ||
(out->cap_children && !out->children))
return set_err(err, errcap, "missing deepset storage");
memset(out->target, 0, sizeof out->target);
out->n_configs = 0;
out->n_sources = 0;
out->n_globs = 0;
- out->n_fetches = 0;
+ out->n_blobs = 0;
out->n_children = 0;
memset(&p, 0, sizeof p);
p.data = data;
@@ -1090,10 +1090,10 @@ int build_deepset_parse(const uint8_t* data, size_t len, BuildDeepSet* out,
sec = TRACE_SEC_SOURCE;
} else if (strcmp(line, "[glob]") == 0 && sec == TRACE_SEC_SOURCE) {
sec = TRACE_SEC_GLOB;
- } else if (strcmp(line, "[fetch]") == 0 && sec == TRACE_SEC_GLOB) {
- sec = TRACE_SEC_FETCH;
+ } else if (strcmp(line, "[blob]") == 0 && sec == TRACE_SEC_GLOB) {
+ sec = TRACE_SEC_BLOB;
} else if (strcmp(line, "[child]") == 0 &&
- (sec == TRACE_SEC_GLOB || sec == TRACE_SEC_FETCH)) {
+ (sec == TRACE_SEC_GLOB || sec == TRACE_SEC_BLOB)) {
sec = TRACE_SEC_CHILD;
} else {
return set_err(err, errcap, "bad deepset section");
@@ -1124,8 +1124,8 @@ int build_deepset_parse(const uint8_t* data, size_t len, BuildDeepSet* out,
} else if (sec == TRACE_SEC_GLOB) {
if (append_deepset_glob(out, fields, n, err, errcap) != BUILD_OK)
return BUILD_ERR;
- } else if (sec == TRACE_SEC_FETCH) {
- if (append_deepset_fetch(out, fields, n, err, errcap) != BUILD_OK)
+ } else if (sec == TRACE_SEC_BLOB) {
+ if (append_deepset_blob(out, fields, n, err, errcap) != BUILD_OK)
return BUILD_ERR;
} else if (sec == TRACE_SEC_CHILD) {
if (append_child(out, fields, n, err, errcap) != BUILD_OK)
diff --git a/src/build/trace.h b/src/build/trace.h
@@ -42,12 +42,12 @@ typedef struct BuildGlobLeaf {
uint8_t result_hash[BUILD_HASH_LEN];
} BuildGlobLeaf;
-/* One fetched blob leaf: a hash-pinned external object requested through
+/* One blob dependency leaf: a hash-pinned external object requested through
* `fetch`. URLs are transport hints only and are not cache identity; the blob id
* is the dependency. Sorted by blob id. */
-typedef struct BuildFetchLeaf {
+typedef struct BuildBlobLeaf {
uint8_t blob[BUILD_HASH_LEN];
-} BuildFetchLeaf;
+} BuildBlobLeaf;
/* One target-dep edge (shallow only): replays one `need`. Carries the explicit
* need overlay-id, the dep's effective config-id and argv-id, and the output
@@ -94,9 +94,9 @@ typedef struct BuildShallowTrace {
BuildGlobLeaf* globs; /* [glob] section */
size_t n_globs;
size_t cap_globs;
- BuildFetchLeaf* fetches; /* [fetch] section */
- size_t n_fetches;
- size_t cap_fetches;
+ BuildBlobLeaf* blobs; /* [blob] section */
+ size_t n_blobs;
+ size_t cap_blobs;
BuildDepEdge* deps; /* [dep] section */
size_t n_deps;
size_t cap_deps;
@@ -106,7 +106,7 @@ typedef struct BuildShallowTrace {
* TRANSITIVE input closure, held structurally as a deepset DAG
* (below) rather than inlined. If the request's argv-id equals `argv`, and
* refreshing the `deepset` closure finds nothing moved (every config/source/
- * glob/fetch leaf still matches AND every node's recipe-id still recomputes the
+ * glob/blob leaf still matches AND every node's recipe-id still recomputes the
* same), determinism makes the output identical — no recipe runs.
* The deepset blob must be present to refresh; if absent (GC'd), the trace is
* treated as absent and resolution falls through (fail-safe). */
@@ -120,7 +120,7 @@ typedef struct BuildDeepTrace {
/* One node of the transitive input-closure DAG — the structural form of the old
* flat leafset ("compact deep traces"). One node per target build: its DIRECT
- * source/glob/fetch leaves, its recipe-id, and the deep-set-ids of its DIRECT deps.
+ * source/glob/blob leaves, its recipe-id, and the deep-set-ids of its DIRECT deps.
* The fully-flattened closure is the recursive union, NEVER materialized: a
* subtree reached through many parents is one node, stored once — a Merkle DAG
* that structurally shares like the CAS. Building a parent is "concat my direct
@@ -131,7 +131,7 @@ typedef struct BuildDeepTrace {
* recompute the node's recipe-id through the live definition — catching a dep
* repointed to a different-content recipe, while treating same-content as
* unchanged. Sorted: [config] by observation row, [source] by path, [glob] by
- * pattern, [fetch] by blob id, [child] by id. */
+ * pattern, [blob] by blob id, [child] by id. */
typedef struct BuildDeepSet {
char target[BUILD_TARGET_MAX];
uint8_t recipe[BUILD_HASH_LEN];
@@ -144,9 +144,9 @@ typedef struct BuildDeepSet {
BuildGlobLeaf* globs; /* this node's DIRECT glob leaves */
size_t n_globs;
size_t cap_globs;
- BuildFetchLeaf* fetches; /* this node's DIRECT fetched blobs */
- size_t n_fetches;
- size_t cap_fetches;
+ BuildBlobLeaf* blobs; /* this node's DIRECT blob dependencies */
+ size_t n_blobs;
+ size_t cap_blobs;
uint8_t (*children)[BUILD_HASH_LEN]; /* direct deps' deep-set-ids, sorted */
size_t n_children;
size_t cap_children;
diff --git a/test/build/build_pure_test.c b/test/build/build_pure_test.c
@@ -224,7 +224,7 @@ static void test_trace(void) {
"a unset - -\n"
"[source]\n"
"[glob]\n"
- "[fetch]\n"
+ "[blob]\n"
"[child]\n";
memset(&st, 0, sizeof st);