Raw
1 #ifndef REFTABLE_FSCK_H
2 #define REFTABLE_FSCK_H
3
4 #include "reftable-system.h"
5 #include "reftable-stack.h"
6
7 enum reftable_fsck_error {
8 /* Invalid table name */
9 REFTABLE_FSCK_ERROR_TABLE_NAME = 0,
10 /* Used for bounds checking, must be last */
11 REFTABLE_FSCK_MAX_VALUE,
12 };
13
14 /* Represents an individual error encountered during the FSCK checks. */
15 struct reftable_fsck_info {
16 enum reftable_fsck_error error;
17 const char *msg;
18 const char *path;
19 };
20
21 typedef int reftable_fsck_report_fn(struct reftable_fsck_info *info,
22 void *cb_data);
23 typedef void reftable_fsck_verbose_fn(const char *msg, void *cb_data);
24
25 /*
26 * Given a reftable stack, perform consistency checks on the stack.
27 *
28 * If an issue is encountered, the issue is reported to the callee via the
29 * provided 'report_fn'. If the issue is non-recoverable the flow will not
30 * continue. If it is recoverable, the flow will continue and further issues
31 * will be reported as identified.
32 *
33 * The 'verbose_fn' will be invoked to provide verbose information about
34 * the progress and state of the consistency checks.
35 */
36 int reftable_fsck_check(struct reftable_stack *stack,
37 reftable_fsck_report_fn report_fn,
38 reftable_fsck_verbose_fn verbose_fn,
39 void *cb_data);
40
41 #endif /* REFTABLE_FSCK_H */