2 * Written by James Harper, July 2010
5 #define NODE_TYPE_UNKNOWN 0
6 #define NODE_TYPE_ROOT 1
7 #define NODE_TYPE_SERVICE 2
8 #define NODE_TYPE_STORAGE_GROUP 3
9 #define NODE_TYPE_STORE 4
10 #define NODE_TYPE_DATABASE_INFO 5
11 #define NODE_TYPE_FILE 6
23 node_t(char *name, int type);
24 node_t(char *name, int type, node_t *parent_node);
27 char *make_full_path();
29 virtual bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) = 0;
30 virtual bRC endBackupFile(exchange_fd_context_t *context) = 0;
32 virtual bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp) = 0;
33 virtual bRC endRestoreFile(exchange_fd_context_t *context) = 0;
35 virtual bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
36 virtual bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
37 virtual bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
38 virtual bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
41 class file_node_t : public node_t {
45 VOID *backup_file_handle;
46 VOID *restore_file_handle;
47 uint64_t section_size;
48 bool restore_at_file_level;
50 file_node_t(char *name, node_t *parent_node);
51 virtual ~file_node_t();
52 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
53 bRC endBackupFile(exchange_fd_context_t *context);
55 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
56 bRC endRestoreFile(exchange_fd_context_t *context);
58 bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
59 bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
60 bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
61 bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
64 class dbi_node_t : public node_t {
66 DATABASE_BACKUP_INFO *dbi;
70 WCHAR *restore_display_name;
72 WCHAR *restore_input_streams;
73 WCHAR *restore_output_streams;
75 dbi_node_t(char *name, node_t *parent_node);
76 virtual ~dbi_node_t();
77 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
78 bRC endBackupFile(exchange_fd_context_t *context);
80 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
81 bRC endRestoreFile(exchange_fd_context_t *context);
83 bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
84 bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
85 bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
86 bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
89 class store_node_t : public node_t {
92 DATABASE_BACKUP_INFO *dbi;
94 file_node_t *file_node;
96 WCHAR *out_stream_ptr;
98 store_node_t(char *name, node_t *parent_node);
99 virtual ~store_node_t();
100 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
101 bRC endBackupFile(exchange_fd_context_t *context);
103 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
104 bRC endRestoreFile(exchange_fd_context_t *context);
107 class storage_group_node_t : public node_t {
110 INSTANCE_BACKUP_INFO *ibi;
111 store_node_t *store_node;
112 file_node_t *file_node;
113 uint32_t current_dbi;
116 RESTORE_ENVIRONMENT *restore_environment;
118 WCHAR *storage_group_name;
119 WCHAR *saved_log_path;
120 storage_group_node_t *next;
122 storage_group_node_t(char *name, node_t *parent_node);
123 virtual ~storage_group_node_t();
124 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
125 bRC endBackupFile(exchange_fd_context_t *context);
127 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
128 bRC endRestoreFile(exchange_fd_context_t *context);
131 class service_node_t : public node_t {
134 INSTANCE_BACKUP_INFO *ibi;
136 uint32_t current_ibi;
137 storage_group_node_t *first_storage_group_node;
139 service_node_t(char *name, node_t *parent_node);
140 virtual ~service_node_t();
141 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
142 bRC endBackupFile(exchange_fd_context_t *context);
144 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
145 bRC endRestoreFile(exchange_fd_context_t *context);
148 class root_node_t : public node_t {
150 service_node_t *service_node;
152 root_node_t(char *name);
153 virtual ~root_node_t();
154 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
155 bRC endBackupFile(exchange_fd_context_t *context);
157 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
158 bRC endRestoreFile(exchange_fd_context_t *context);