1 /*-------------------------------------------------------------------------
2  *
3  * backup_manifest.h
4  *	  Routines for generating a backup manifest.
5  *
6  * Portions Copyright (c) 2010-2020, PostgreSQL Global Development Group
7  *
8  * src/include/replication/backup_manifest.h
9  *
10  *-------------------------------------------------------------------------
11  */
12 #ifndef BACKUP_MANIFEST_H
13 #define BACKUP_MANIFEST_H
14 
15 #include "access/xlogdefs.h"
16 #include "common/checksum_helper.h"
17 #include "pgtime.h"
18 #include "storage/buffile.h"
19 
20 typedef enum manifest_option
21 {
22 	MANIFEST_OPTION_YES,
23 	MANIFEST_OPTION_NO,
24 	MANIFEST_OPTION_FORCE_ENCODE
25 } backup_manifest_option;
26 
27 typedef struct backup_manifest_info
28 {
29 	BufFile    *buffile;
30 	pg_checksum_type checksum_type;
31 	pg_sha256_ctx manifest_ctx;
32 	uint64		manifest_size;
33 	bool		force_encode;
34 	bool		first_file;
35 	bool		still_checksumming;
36 } backup_manifest_info;
37 
38 extern void InitializeBackupManifest(backup_manifest_info *manifest,
39 									 backup_manifest_option want_manifest,
40 									 pg_checksum_type manifest_checksum_type);
41 extern void AddFileToBackupManifest(backup_manifest_info *manifest,
42 									const char *spcoid,
43 									const char *pathname, size_t size,
44 									pg_time_t mtime,
45 									pg_checksum_context *checksum_ctx);
46 extern void AddWALInfoToBackupManifest(backup_manifest_info *manifest,
47 									   XLogRecPtr startptr,
48 									   TimeLineID starttli, XLogRecPtr endptr,
49 									   TimeLineID endtli);
50 extern void SendBackupManifest(backup_manifest_info *manifest);
51 
52 #endif
53