Re: [PATCH v2 00/16] reftable: overhaul the API to expose access to blocks
On 25/04/07 03:16PM, Patrick Steinhardt wrote:
Show 65 quoted lines
> Hi,
>
> this patch series is a bigger overhaul of the reftable API. This
> overhaul has two main motivations:
>
> - The reftable library is now standalone and can be used by code bases
> other than Git, like libgit2. This patch series thus renames a
> couple of subsystems to have more intuitive names before we gain any
> new users.
>
> - Some of the data of reftables isn't accessible at all via public
> interfaces. Most importantly, it is not possible to access
> individual blocks in a table. While users shouldn't need that access
> most of the time, an upcoming usecase that Git itself has is to
> implement consistency checks for the reftable backend. Here we'll
> want to read through blocks and their respective records one by one
> to ensure that they are sane and then iterate through records
> contained in these blocks.
>
> The patch series is structured as follows:
>
> - Patch 1 is a trivial global refactoring to fix formatting of the
> license headers. They have been annoying me for far too long.
>
> - Patches 2 to 8 consolidate and rename a couple of data structures:
>
> - `reftable_reader` becomes `reftable_table`, as it is used to
> access an individual table.
>
> - `reftable_block` becomes `reftable_block_data`, as it is only a
> simple container for the underlying bytes.
>
> - `reftable_block_reader` becomes `reftable_block`, as it is used
> to access an individual block.
>
> Overall, the data structures are now called after what they provide
> access to compared to the rather generic previous names. This is
> also in line with other data structures like `reftable_merged_table`
> and `reftable_stack`.
>
> - Patches 9 to 13 refactor the block interface so that it can expose a
> generic `reftable_iterator`, granting generic access to all of its
> contained records.
>
> - Patches 14 to 16 refactor the table interface to expose a new
> iterator over its contained blocks.
>
> - Patch 17 refactors `reftable_table_print_blocks` to be implemented
> on top of these new iterators. This allows us to move it out of the
> library codebase into the test helper.
>
> The series is built on Git v2.49.0 with ps/reftable-sans-compat-util at
> 8f6a2dbe340 (Makefile: skip reftable library for Coccinelle, 2025-02-18)
> merged into it.
>
> Changes in v2:
> - Rename `reftable_table_init_table_iterator()` to
> `reftable_table_iterator_init()`.
> - Rename `struct reftable_block_reader::block` to `block_data`.
> - Several improvements to commit messages.
> - Drop unneeded calls to `block_iter_seek_start()` after
> `block_iter_init()`.
> - Fix -Wcomma error.
> - Link to v1: https://lore.kernel.org/r/20250331-pks-reftable-polishing-v1-0-ebed5247434c@pks.im
>
Thanks Patrick! The changes in this version look good to me.
-Justin