2 Copyright 2020 Google LLC
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file or at
6 https://developers.google.com/open-source/licenses/bsd
16 #include "reftable-iterator.h"
17 #include "reftable-generic.h"
19 /* Returns true for a zeroed out iterator, such as the one returned from
20 * iterator_destroy. */
21 int iterator_is_null(struct reftable_iterator
*it
);
23 /* iterator that produces only ref records that point to `oid` */
24 struct filtering_ref_iterator
{
26 struct reftable_table tab
;
28 struct reftable_iterator it
;
30 #define FILTERING_REF_ITERATOR_INIT \
35 void iterator_from_filtering_ref_iterator(struct reftable_iterator
*,
36 struct filtering_ref_iterator
*);
38 /* iterator that produces only ref records that point to `oid`,
39 * but using the object index.
41 struct indexed_table_ref_iter
{
42 struct reftable_reader
*r
;
48 /* Points to the next offset to read. */
51 struct block_reader block_reader
;
52 struct block_iter cur
;
56 #define INDEXED_TABLE_REF_ITER_INIT { \
57 .cur = BLOCK_ITER_INIT, \
61 void iterator_from_indexed_table_ref_iter(struct reftable_iterator
*it
,
62 struct indexed_table_ref_iter
*itr
);
64 /* Takes ownership of `offsets` */
65 int new_indexed_table_ref_iter(struct indexed_table_ref_iter
**dest
,
66 struct reftable_reader
*r
, uint8_t *oid
,
67 int oid_len
, uint64_t *offsets
, int offset_len
);