summaryrefslogtreecommitdiff
path: root/src/include/common/parse_manifest.h
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2023-12-19 15:21:34 -0500
committerRobert Haas <rhaas@postgresql.org>2023-12-19 15:24:31 -0500
commitaafc07c7a191bc807c77fe2a044006a5db07faba (patch)
tree9e0d53113d5f9ac5064772e2a5473e8c61844669 /src/include/common/parse_manifest.h
parent47f01d727e3a271bbff7d2f9db838e81d27bd495 (diff)
Move src/bin/pg_verifybackup/parse_manifest.c into src/common.
This makes it possible for the code to be easily reused by other client-side tools, and/or by the server. Patch by me. Review of this patch in particular by at least Peter Eisentraut; reviewers for the patch series in general include Dilip Kumar, Andres Fruend, David Steele, Álvaro Herrera, and Jakub Wartak. Discussion: http://postgr.es/m/CA+TgmoZ6UGZVnSy5iak6s6+AXu_DewXovDjhLs3-su6nmU_x_g@mail.gmail.com
Diffstat (limited to 'src/include/common/parse_manifest.h')
-rw-r--r--src/include/common/parse_manifest.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/include/common/parse_manifest.h b/src/include/common/parse_manifest.h
new file mode 100644
index 00000000000..811c9149f43
--- /dev/null
+++ b/src/include/common/parse_manifest.h
@@ -0,0 +1,46 @@
+/*-------------------------------------------------------------------------
+ *
+ * parse_manifest.h
+ * Parse a backup manifest in JSON format.
+ *
+ * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/common/parse_manifest.h
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef PARSE_MANIFEST_H
+#define PARSE_MANIFEST_H
+
+#include "access/xlogdefs.h"
+#include "common/checksum_helper.h"
+#include "mb/pg_wchar.h"
+
+struct JsonManifestParseContext;
+typedef struct JsonManifestParseContext JsonManifestParseContext;
+
+typedef void (*json_manifest_per_file_callback) (JsonManifestParseContext *,
+ char *pathname,
+ size_t size, pg_checksum_type checksum_type,
+ int checksum_length, uint8 *checksum_payload);
+typedef void (*json_manifest_per_wal_range_callback) (JsonManifestParseContext *,
+ TimeLineID tli,
+ XLogRecPtr start_lsn, XLogRecPtr end_lsn);
+typedef void (*json_manifest_error_callback) (JsonManifestParseContext *,
+ const char *fmt,...) pg_attribute_printf(2, 3)
+ pg_attribute_noreturn();
+
+struct JsonManifestParseContext
+{
+ void *private_data;
+ json_manifest_per_file_callback per_file_cb;
+ json_manifest_per_wal_range_callback per_wal_range_cb;
+ json_manifest_error_callback error_cb;
+};
+
+extern void json_parse_manifest(JsonManifestParseContext *context,
+ char *buffer, size_t size);
+
+#endif