| 1 |
/*------------------------------------------------------------------------- |
| 2 |
* |
| 3 |
* Load data from a backup manifest into memory. |
| 4 |
* |
| 5 |
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group |
| 6 |
* Portions Copyright (c) 1994, Regents of the University of California |
| 7 |
* |
| 8 |
* src/bin/pg_combinebackup/load_manifest.h |
| 9 |
* |
| 10 |
*------------------------------------------------------------------------- |
| 11 |
*/ |
| 12 |
#ifndef LOAD_MANIFEST_H |
| 13 |
#define LOAD_MANIFEST_H |
| 14 |
|
| 15 |
#include "access/xlogdefs.h" |
| 16 |
#include "common/checksum_helper.h" |
| 17 |
|
| 18 |
/* |
| 19 |
* Each file described by the manifest file is parsed to produce an object |
| 20 |
* like this. |
| 21 |
*/ |
| 22 |
typedef struct manifest_file |
| 23 |
{ |
| 24 |
uint32 status; /* hash status */ |
| 25 |
const char *pathname; |
| 26 |
uint64 size; |
| 27 |
pg_checksum_type checksum_type; |
| 28 |
int checksum_length; |
| 29 |
uint8 *checksum_payload; |
| 30 |
} manifest_file; |
| 31 |
|
| 32 |
#define SH_PREFIX manifest_files |
| 33 |
#define SH_ELEMENT_TYPE manifest_file |
| 34 |
#define SH_KEY_TYPE const char * |
| 35 |
#define SH_SCOPE extern |
| 36 |
#define SH_RAW_ALLOCATOR pg_malloc0 |
| 37 |
#define SH_DECLARE |
| 38 |
#include "lib/simplehash.h" |
| 39 |
|
| 40 |
/* |
| 41 |
* Each WAL range described by the manifest file is parsed to produce an |
| 42 |
* object like this. |
| 43 |
*/ |
| 44 |
typedef struct manifest_wal_range |
| 45 |
{ |
| 46 |
TimeLineID tli; |
| 47 |
XLogRecPtr start_lsn; |
| 48 |
XLogRecPtr end_lsn; |
| 49 |
struct manifest_wal_range *next; |
| 50 |
struct manifest_wal_range *prev; |
| 51 |
} manifest_wal_range; |
| 52 |
|
| 53 |
/* |
| 54 |
* All the data parsed from a backup_manifest file. |
| 55 |
*/ |
| 56 |
typedef struct manifest_data |
| 57 |
{ |
| 58 |
uint64 system_identifier; |
| 59 |
manifest_files_hash *files; |
| 60 |
manifest_wal_range *first_wal_range; |
| 61 |
manifest_wal_range *last_wal_range; |
| 62 |
} manifest_data; |
| 63 |
|
| 64 |
extern manifest_data *load_backup_manifest(char *backup_directory); |
| 65 |
extern manifest_data **load_backup_manifests(int n_backups, |
| 66 |
char **backup_directories); |
| 67 |
|
| 68 |
#endif /* LOAD_MANIFEST_H */ |