diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-12-15 09:39:45 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-15 09:39:45 -0800 |
commit | a4bbd13be360d93f51a0cea6eef436db8622b592 (patch) | |
tree | 0eee1b6156935555fb141a478aeedfabb198f9f8 /reftable/writer.h | |
parent | The second batch (diff) | |
parent | Add "test-tool dump-reftable" command. (diff) | |
download | tgif-a4bbd13be360d93f51a0cea6eef436db8622b592.tar.xz |
Merge branch 'hn/reftable'
The "reftable" backend for the refs API, without integrating into
the refs subsystem, has been added.
* hn/reftable:
Add "test-tool dump-reftable" command.
reftable: add dump utility
reftable: implement stack, a mutable database of reftable files.
reftable: implement refname validation
reftable: add merged table view
reftable: add a heap-based priority queue for reftable records
reftable: reftable file level tests
reftable: read reftable files
reftable: generic interface to tables
reftable: write reftable files
reftable: a generic binary tree implementation
reftable: reading/writing blocks
Provide zlib's uncompress2 from compat/zlib-compat.c
reftable: (de)serialization for the polymorphic record type.
reftable: add blocksource, an abstraction for random access reads
reftable: utility functions
reftable: add error related functionality
reftable: add LICENSE
hash.h: provide constants for the hash IDs
Diffstat (limited to 'reftable/writer.h')
-rw-r--r-- | reftable/writer.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/reftable/writer.h b/reftable/writer.h new file mode 100644 index 0000000000..09b88673d9 --- /dev/null +++ b/reftable/writer.h @@ -0,0 +1,50 @@ +/* +Copyright 2020 Google LLC + +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file or at +https://developers.google.com/open-source/licenses/bsd +*/ + +#ifndef WRITER_H +#define WRITER_H + +#include "basics.h" +#include "block.h" +#include "tree.h" +#include "reftable-writer.h" + +struct reftable_writer { + ssize_t (*write)(void *, const void *, size_t); + void *write_arg; + int pending_padding; + struct strbuf last_key; + + /* offset of next block to write. */ + uint64_t next; + uint64_t min_update_index, max_update_index; + struct reftable_write_options opts; + + /* memory buffer for writing */ + uint8_t *block; + + /* writer for the current section. NULL or points to + * block_writer_data */ + struct block_writer *block_writer; + + struct block_writer block_writer_data; + + /* pending index records for the current section */ + struct reftable_index_record *index; + size_t index_len; + size_t index_cap; + + /* + * tree for use with tsearch; used to populate the 'o' inverse OID + * map */ + struct tree_node *obj_index_tree; + + struct reftable_stats stats; +}; + +#endif |