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
14 #include "reftable-iterator.h"
15 #include "reftable-reader.h"
17 uint64_t block_source_size(struct reftable_block_source
*source
);
19 int block_source_read_block(struct reftable_block_source
*source
,
20 struct reftable_block
*dest
, uint64_t off
,
22 void block_source_close(struct reftable_block_source
*source
);
24 /* metadata for a block type */
25 struct reftable_reader_offsets
{
28 uint64_t index_offset
;
31 /* The state for reading a reftable file. */
32 struct reftable_reader
{
33 /* for convenience, associate a name with the instance. */
35 struct reftable_block_source source
;
37 /* Size of the file, excluding the footer. */
40 /* 'sha1' for SHA1, 's256' for SHA-256 */
44 uint64_t min_update_index
;
45 uint64_t max_update_index
;
46 /* Length of the OID keys in the 'o' section */
50 struct reftable_reader_offsets ref_offsets
;
51 struct reftable_reader_offsets obj_offsets
;
52 struct reftable_reader_offsets log_offsets
;
57 const char *reader_name(struct reftable_reader
*r
);
59 int reader_init_iter(struct reftable_reader
*r
,
60 struct reftable_iterator
*it
,
63 /* initialize a block reader to read from `r` */
64 int reader_init_block_reader(struct reftable_reader
*r
, struct block_reader
*br
,
65 uint64_t next_off
, uint8_t want_typ
);