Merge branch 'ms/doc-push-fix' into maint-2.42
[alt-git.git] / reftable / reftable-generic.h
blobd239751a77833c31d982f4059fe58094f5b93445
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_GENERIC_H
10 #define REFTABLE_GENERIC_H
12 #include "reftable-iterator.h"
14 struct reftable_table_vtable;
17 * Provides a unified API for reading tables, either merged tables, or single
18 * readers. */
19 struct reftable_table {
20 struct reftable_table_vtable *ops;
21 void *table_arg;
24 int reftable_table_seek_log(struct reftable_table *tab,
25 struct reftable_iterator *it, const char *name);
27 int reftable_table_seek_ref(struct reftable_table *tab,
28 struct reftable_iterator *it, const char *name);
30 /* returns the hash ID from a generic reftable_table */
31 uint32_t reftable_table_hash_id(struct reftable_table *tab);
33 /* returns the max update_index covered by this table. */
34 uint64_t reftable_table_max_update_index(struct reftable_table *tab);
36 /* returns the min update_index covered by this table. */
37 uint64_t reftable_table_min_update_index(struct reftable_table *tab);
39 /* convenience function to read a single ref. Returns < 0 for error, 0
40 for success, and 1 if ref not found. */
41 int reftable_table_read_ref(struct reftable_table *tab, const char *name,
42 struct reftable_ref_record *ref);
44 /* dump table contents onto stdout for debugging */
45 int reftable_table_print(struct reftable_table *tab);
47 #endif