| 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-writer.h" |
| 14 | #include "reftable-stack.h" |
| 15 | |
| 16 | struct reftable_stack { |
| 17 | struct stat list_st; |
| 18 | char *list_file; |
| 19 | int list_fd; |
| 20 | |
| 21 | char *reftable_dir; |
| 22 | |
| 23 | struct reftable_stack_options opts; |
| 24 | |
| 25 | struct reftable_table **tables; |
| 26 | size_t tables_len; |
| 27 | struct reftable_merged_table *merged; |
| 28 | struct reftable_compaction_stats stats; |
| 29 | }; |
| 30 | |
| 31 | int read_lines(const char *filename, char ***lines); |
| 32 | |
| 33 | struct segment { |
| 34 | size_t start, end; |
| 35 | uint64_t bytes; |
| 36 | }; |
| 37 | |
| 38 | struct segment suggest_compaction_segment(uint64_t *sizes, size_t n, |
| 39 | uint8_t factor); |
| 40 | |
| 41 | #endif |