Commit 164552c
committed
Allow inlinedtree.Build() to spill large lists into separate objects
inlinedtree.Build() can currently only store messages in separate
objects. This is problematic, because we also have many cases in which
we want to store lists of objects separately.
To achieve this, let's add a Marshalable type to model_core. We can use
this to encode all the different strategies of how we marshal data.
Right now there are only implementations for plain messages and lists of
messages. Maybe later we also want to provide an implementation for
blobs, so that we can store large Starlark strings/bytes in separate
objects.
When storing lists externally, we need to emit parent nodes. For this we
already have btree.ParentNodeComputer. Let's reuse this here. Provide a
btree.MaybeMergeNodes() function that acts as a bridge between
inlinedtree and btree. Because inlinedtree.ParentAppender does not allow
returning errors, change btree.ParentNodeComputer to also not allow it.
I'm not entirely happy with how friendly the resulting API is to use.
Let's see if we can improve it at some point in the future. For example,
I don't like how we need to pass the capturer, encoder, and parent node
computer around separately, even though I don't think you ever want
those to differ. We should really address that at some point in the
nearby future.1 parent 5a60076 commit 164552c
28 files changed
Lines changed: 416 additions & 363 deletions
File tree
- cmd/bonanza_builder
- pkg
- bazelclient/commands/build
- model
- analysis
- command
- core
- btree
- inlinedtree
- filesystem
- starlark
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
377 | | - | |
| 377 | + | |
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
| 381 | + | |
| 382 | + | |
388 | 383 | | |
389 | 384 | | |
390 | 385 | | |
| |||
398 | 393 | | |
399 | 394 | | |
400 | 395 | | |
401 | | - | |
| 396 | + | |
402 | 397 | | |
403 | 398 | | |
404 | 399 | | |
| |||
446 | 441 | | |
447 | 442 | | |
448 | 443 | | |
449 | | - | |
| 444 | + | |
450 | 445 | | |
451 | 446 | | |
452 | 447 | | |
| |||
455 | 450 | | |
456 | 451 | | |
457 | 452 | | |
458 | | - | |
| 453 | + | |
459 | 454 | | |
460 | 455 | | |
461 | 456 | | |
| |||
533 | 528 | | |
534 | 529 | | |
535 | 530 | | |
536 | | - | |
537 | | - | |
| 531 | + | |
| 532 | + | |
538 | 533 | | |
539 | 534 | | |
540 | 535 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
353 | | - | |
354 | | - | |
| 353 | + | |
| 354 | + | |
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
396 | | - | |
| 395 | + | |
| 396 | + | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
113 | 122 | | |
114 | 123 | | |
115 | 124 | | |
116 | 125 | | |
117 | 126 | | |
118 | 127 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| |||
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
141 | | - | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | | - | |
| 145 | + | |
| 146 | + | |
145 | 147 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
| 151 | + | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
0 commit comments