Files
git/reftable/stack.h
Patrick Steinhardt 992fccf050 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-25 13:19:58 -07:00

42 lines
807 B
C

/*
* 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 STACK_H
#define STACK_H
#include "system.h"
#include "reftable-writer.h"
#include "reftable-stack.h"
struct reftable_stack {
struct stat list_st;
char *list_file;
int list_fd;
char *reftable_dir;
struct reftable_stack_options opts;
struct reftable_table **tables;
size_t tables_len;
struct reftable_merged_table *merged;
struct reftable_compaction_stats stats;
};
int read_lines(const char *filename, char ***lines);
struct segment {
size_t start, end;
uint64_t bytes;
};
struct segment suggest_compaction_segment(uint64_t *sizes, size_t n,
uint8_t factor);
#endif