]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/table: move reading block into block reader
authorPatrick Steinhardt <ps@pks.im>
Mon, 7 Apr 2025 13:16:17 +0000 (15:16 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Apr 2025 21:53:10 +0000 (14:53 -0700)
commitfd888311fbc95b0cbb3c9e580dc6f7277bb7bf7f
treeb9a91396cb5f926f6360f3445b42986d6b4311f8
parentba620d296ab7bcd93fcedfe13b265f84df1ed1eb
reftable/table: move reading block into block reader

The logic to read blocks from a reftable is scattered across both the
table and the block subsystems. Besides causing somewhat fuzzy
responsibilities, it also means that we have to awkwardly pass around
the ownership of blocks between the subsystems.

Refactor the code so that we stop passing the block when initializing a
reader, but instead by passing in the block source plus the offset at
which we're supposed to read a block. Like this, the ownership of the
block itself doesn't need to get handed over as the block reader is the
one owning the block right from the start.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/block.c
reftable/block.h
reftable/table.c
t/unit-tests/t-reftable-block.c