Commit 156d79c
reftable/block: store block pointer in the block iterator
The block iterator requires access to a bunch of data from the
underlying `reftable_block` that it is iterating over. This data is
stored by copying over relevant data into a separate set of variables.
This has multiple downsides:
- We require more storage space than necessary. This is more of a
theoretical issue as we shouldn't ever have many blocks.
- We have to perform more bookkeeping, and the variable names are
inconsistent across the two data structures. This can lead to some
confusion.
- The lifetime of the block iterator is tied to the block anyway, but
we hide that a bit by only storing pointers pointing into the block.
There isn't really any good reason why we rip out parts of the block
instead of storing a pointer to the block itself.
Refactor the code to do so. Despite being simpler, it also allows us to
decouple the lifetime of the block iterator from seeking in a subsequent
commit.
Signed-off-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 655e18d commit 156d79c
2 files changed
+9
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
| 384 | + | |
385 | 385 | | |
386 | | - | |
387 | | - | |
388 | | - | |
| 386 | + | |
389 | 387 | | |
390 | | - | |
| 388 | + | |
391 | 389 | | |
392 | 390 | | |
393 | 391 | | |
| |||
435 | 433 | | |
436 | 434 | | |
437 | 435 | | |
438 | | - | |
439 | | - | |
| 436 | + | |
| 437 | + | |
440 | 438 | | |
441 | 439 | | |
442 | 440 | | |
443 | 441 | | |
444 | 442 | | |
445 | | - | |
| 443 | + | |
446 | 444 | | |
447 | 445 | | |
448 | 446 | | |
| |||
452 | 450 | | |
453 | 451 | | |
454 | 452 | | |
455 | | - | |
| 453 | + | |
456 | 454 | | |
457 | 455 | | |
458 | 456 | | |
| |||
467 | 465 | | |
468 | 466 | | |
469 | 467 | | |
470 | | - | |
471 | | - | |
472 | 468 | | |
473 | 469 | | |
474 | 470 | | |
| |||
528 | 524 | | |
529 | 525 | | |
530 | 526 | | |
531 | | - | |
532 | | - | |
533 | | - | |
| 527 | + | |
534 | 528 | | |
535 | 529 | | |
536 | 530 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 70 | + | |
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
| |||
0 commit comments