Re: [PATCH 14/16] reftable/table: introduce iterator for table blocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/03/31 10:41AM, Patrick Steinhardt wrote:
> 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@xxxxxx>
> ---
>  reftable/reftable-table.h       |  16 ++++++
>  reftable/table.c                |  47 +++++++++++++++++
>  t/unit-tests/t-reftable-table.c | 109 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 172 insertions(+)
> 
> diff --git a/reftable/reftable-table.h b/reftable/reftable-table.h
> index a78db9eea7e..f0f1784c664 100644
> --- a/reftable/reftable-table.h
> +++ b/reftable/reftable-table.h
> @@ -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_init_table_iterator(struct reftable_table *t,
> +				       struct reftable_table_iterator *it);

Any reason we don't call this `reftable_table_iterator_init`? Seems like
it would more closely match the other functions.

> +
> +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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux