Merge branch 'rs/name-rev-fix-free-after-use' into maint
[alt-git.git] / reftable / writer.h
blob09b88673d9757536c3c0f5122f991703eb94a06e
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 WRITER_H
10 #define WRITER_H
12 #include "basics.h"
13 #include "block.h"
14 #include "tree.h"
15 #include "reftable-writer.h"
17 struct reftable_writer {
18 ssize_t (*write)(void *, const void *, size_t);
19 void *write_arg;
20 int pending_padding;
21 struct strbuf last_key;
23 /* offset of next block to write. */
24 uint64_t next;
25 uint64_t min_update_index, max_update_index;
26 struct reftable_write_options opts;
28 /* memory buffer for writing */
29 uint8_t *block;
31 /* writer for the current section. NULL or points to
32 * block_writer_data */
33 struct block_writer *block_writer;
35 struct block_writer block_writer_data;
37 /* pending index records for the current section */
38 struct reftable_index_record *index;
39 size_t index_len;
40 size_t index_cap;
43 * tree for use with tsearch; used to populate the 'o' inverse OID
44 * map */
45 struct tree_node *obj_index_tree;
47 struct reftable_stats stats;
50 #endif