Files
git/t/unit-tests/lib-reftable.h
Patrick Steinhardt 44f46f2be5 reftable: split up write options
When initializing the reftable stack the caller may optionally pass some
write options. These write options mix up two different concerns though:

  - Of course, they allow the caller to configure how new reftables are
    being written.

  - But they also allow the caller to configure the stack itself, like
    its hash ID and the `on_reload` callback.

This is somewhat awkward, as it doesn't easily give the caller the
flexibility to for example write multiple reftables with different
options. Furthermore, this requires us to eagerly parse relevant
configuration when initializing the reftable backend.

Refactor the code by splitting out those options that configure the
stack itself. Creating a new stack will thus only require this limited
set of options, whereas the caller is expected to pass write options to
all functions that end up writing tables.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26 08:27:19 -07:00

23 lines
682 B
C

#include "git-compat-util.h"
#include "clar/clar.h"
#include "clar-decls.h"
#include "git-compat-util.h"
#include "reftable/reftable-writer.h"
#include "strbuf.h"
struct reftable_buf;
void cl_reftable_set_hash(uint8_t *p, int i, enum reftable_hash id);
struct reftable_writer *cl_reftable_strbuf_writer(struct reftable_buf *buf,
enum reftable_hash hash_id,
struct reftable_write_options *opts);
void cl_reftable_write_to_buf(struct reftable_buf *buf,
struct reftable_ref_record *refs,
size_t nrecords,
struct reftable_log_record *logs,
size_t nlogs,
enum reftable_hash hash_id,
struct reftable_write_options *opts);