mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
reftable/table: introduce iterator for table blocks
Introduce a new iterator that allows the caller to iterate through all blocks contained in a table. This gives users more fine-grained control over how exactly those blocks are being read and exposes information to callers that was previously inaccessible. This iterator will be required by a future patch series that adds consistency checks for the reftable backend. In addition to that though we will also reimplement `reftable_table_print_blocks()` on top of this new iterator in a subsequent commit. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
c8cbe85a23
commit
da89659365
@@ -10,6 +10,7 @@
|
||||
#define REFTABLE_TABLE_H
|
||||
|
||||
#include "reftable-iterator.h"
|
||||
#include "reftable-block.h"
|
||||
#include "reftable-blocksource.h"
|
||||
|
||||
/*
|
||||
@@ -99,4 +100,19 @@ uint64_t reftable_table_min_update_index(struct reftable_table *t);
|
||||
/* print blocks onto stdout for debugging. */
|
||||
int reftable_table_print_blocks(const char *tablename);
|
||||
|
||||
/*
|
||||
* An iterator that iterates through the blocks contained in a given table.
|
||||
*/
|
||||
struct reftable_table_iterator {
|
||||
void *iter_arg;
|
||||
};
|
||||
|
||||
int reftable_table_iterator_init(struct reftable_table_iterator *it,
|
||||
struct reftable_table *t);
|
||||
|
||||
void reftable_table_iterator_release(struct reftable_table_iterator *it);
|
||||
|
||||
int reftable_table_iterator_next(struct reftable_table_iterator *it,
|
||||
const struct reftable_block **out);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user