at commit d7e8ff85

1 /*
2 * Copyright 2020 Google LLC
3 *
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 */
8
9 #ifndef STACK_H
10 #define STACK_H
11
12 #include "system.h"
13 #include "reftable-stack.h"
14
15 struct reftable_stack {
16 struct stat list_st;
17 char *list_file;
18 int list_fd;
19
20 /*
21 * Set while an addition holds the stack locked. Used by
22 * stack_uptodate() to skip reload checks while locked.
23 */
24 struct reftable_flock list_lock;
25
26 char *reftable_dir;
27
28 struct reftable_stack_options opts;
29
30 struct reftable_table **tables;
31 size_t tables_len;
32 struct reftable_merged_table *merged;
33 struct reftable_compaction_stats stats;
34 };
35
36 int read_lines(const char *filename, char ***lines);
37
38 struct segment {
39 size_t start, end;
40 uint64_t bytes;
41 };
42
43 struct segment suggest_compaction_segment(uint64_t *sizes, size_t n,
44 uint8_t factor);
45
46 #endif