Skip to content

Commit 7ef802d

Browse files
committed
Add a comment declaring code refactoring plan
1 parent 24a7a08 commit 7ef802d

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

src/pg_probackup.c

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,29 @@
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;
3456
const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup";
3557
const 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. */
3962
char *backup_path = NULL;
@@ -48,10 +71,13 @@ char backup_instance_path[MAXPGPATH];
4871
*/
4972
char arclog_path[MAXPGPATH] = "";
5073

74+
/* ================ catalogState (END) =========== */
75+
76+
77+
5178
/* colon separated external directories list ("/path1:/path2") */
5279
char *externaldir = NULL;
5380
/* common options */
54-
static char *backup_id_string = NULL;
5581
int num_threads = 1;
5682
bool stream_wal = false;
5783
bool no_color = false;
@@ -114,8 +140,9 @@ static char *delete_status = NULL;
114140
/* compression options */
115141
static bool compress_shortcut = false;
116142

117-
/* other options */
143+
/* ================ instanceState =========== */
118144
char *instance_name;
145+
/* ================ instanceState (END) =========== */
119146

120147
/* archive push options */
121148
int batch_size = 1;
@@ -137,8 +164,10 @@ int64 ttl = -1;
137164
static char *expire_time_string = NULL;
138165
static pgSetBackupParams *set_backup_params = NULL;
139166

140-
/* current settings */
167+
/* ================ backupState =========== */
168+
static char *backup_id_string = NULL;
141169
pgBackup current;
170+
/* ================ backupState (END) =========== */
142171

143172
static bool help_opt = false;
144173

0 commit comments

Comments
 (0)