The eighth batch
[alt-git.git] / reftable / reftable-iterator.h
blobd3eee7af3571bee217abb66da970b2f8b7e97dbd
1 /*
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
7 */
9 #ifndef REFTABLE_ITERATOR_H
10 #define REFTABLE_ITERATOR_H
12 #include "reftable-record.h"
14 struct reftable_iterator_vtable;
16 /* iterator is the generic interface for walking over data stored in a
17 * reftable.
19 struct reftable_iterator {
20 struct reftable_iterator_vtable *ops;
21 void *iter_arg;
24 /* reads the next reftable_ref_record. Returns < 0 for error, 0 for OK and > 0:
25 * end of iteration.
27 int reftable_iterator_next_ref(struct reftable_iterator *it,
28 struct reftable_ref_record *ref);
30 /* reads the next reftable_log_record. Returns < 0 for error, 0 for OK and > 0:
31 * end of iteration.
33 int reftable_iterator_next_log(struct reftable_iterator *it,
34 struct reftable_log_record *log);
36 /* releases resources associated with an iterator. */
37 void reftable_iterator_destroy(struct reftable_iterator *it);
39 #endif