77 * do_***() function that implements the command.
88 *
99 * Avoid using global variables in the code.
10- * Pass all needed information as funciton arguments.
10+ * Pass all needed information as funciton arguments:
11+ *
12+
13+ *
14+ * TODO:
15+ *
16+ * Functions that work with a backup catalog accept catalogState,
17+ * which currently only contains pathes to backup catalog subdirectories
18+ * + function specific options.
19+ *
20+ * Functions that work with an instance accept instanceState argument, which
21+ * includes catalogState, instance_name,
22+ * info about pgdata associated with the instance,
23+ * various instance config options, and list of backups belonging to the instance.
24+ * + function specific options.
25+ *
26+ * Functions that work with multiple backups in the catalog
27+ * accept instanceState and info needed to determine the range of backups to handle.
28+ * + function specific options.
29+ *
30+ * Functions that work with a single backup accept backupState argument,
31+ * which includes link to the instanceState, backup_id and backup-specific info.
32+ * + function specific options.
1133 *
1234 * Portions Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
1335 * Portions Copyright (c) 2015-2019, Postgres Professional
@@ -34,6 +56,7 @@ const char *PROGRAM_FULL_PATH = NULL;
3456const char * PROGRAM_URL = "https://github.com/postgrespro/pg_probackup" ;
3557const char * PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues" ;
3658
59+ /* ================ catalogState =========== */
3760/* directory options */
3861/* TODO make it local variable, pass as an argument to all commands that need it. */
3962char * backup_path = NULL ;
@@ -48,10 +71,13 @@ char backup_instance_path[MAXPGPATH];
4871 */
4972char arclog_path [MAXPGPATH ] = "" ;
5073
74+ /* ================ catalogState (END) =========== */
75+
76+
77+
5178/* colon separated external directories list ("/path1:/path2") */
5279char * externaldir = NULL ;
5380/* common options */
54- static char * backup_id_string = NULL ;
5581int num_threads = 1 ;
5682bool stream_wal = false;
5783bool no_color = false;
@@ -114,8 +140,9 @@ static char *delete_status = NULL;
114140/* compression options */
115141static bool compress_shortcut = false;
116142
117- /* other options */
143+ /* ================ instanceState =========== */
118144char * instance_name ;
145+ /* ================ instanceState (END) =========== */
119146
120147/* archive push options */
121148int batch_size = 1 ;
@@ -137,8 +164,10 @@ int64 ttl = -1;
137164static char * expire_time_string = NULL ;
138165static pgSetBackupParams * set_backup_params = NULL ;
139166
140- /* current settings */
167+ /* ================ backupState =========== */
168+ static char * backup_id_string = NULL ;
141169pgBackup current ;
170+ /* ================ backupState (END) =========== */
142171
143172static bool help_opt = false;
144173
0 commit comments