1 /*
2  * Copyright (C) 2021 Jakub Kruszona-Zawadzki, Core Technology Sp. z o.o.
3  *
4  * This file is part of MooseFS.
5  *
6  * MooseFS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, version 2 (only).
9  *
10  * MooseFS is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with MooseFS; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA
18  * or visit http://www.gnu.org/licenses/gpl-2.0.html
19  */
20 
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24 
25 #include <stdio.h>
26 
27 #include "topology.h"
28 #include "exports.h"
29 #include "datacachemgr.h"
30 #include "matomlserv.h"
31 #include "matocsserv.h"
32 #include "matoclserv.h"
33 #include "metadata.h"
34 #include "random.h"
35 #include "changelog.h"
36 #include "chartsdata.h"
37 #include "missinglog.h"
38 #include "bgsaver.h"
39 
40 #define MODULE_OPTIONS_GETOPT "iax"
41 #define MODULE_OPTIONS_SWITCH \
42 	case 'i': \
43 		meta_setignoreflag(); \
44 		break; \
45 	case 'a': \
46 		meta_allowautorestore(); \
47 		break; \
48 	case 'x': \
49 		meta_incverboselevel(); \
50 		break;
51 #define MODULE_OPTIONS_SYNOPIS "[-i] [-a] [-x [-x]] "
52 #define MODULE_OPTIONS_DESC "-i : ignore some metadata structure errors (attach orphans to root, ignore names without inode, etc.). DO NOT USE unless you are absoluttely sure that there are no other options to restore your metadata.\n-a : automatically restore metadata from change logs\n-x : produce more verbose output\n-xx : even more verbose output\n"
53 
54 /* Run Tab */
55 typedef int (*runfn)(void);
56 struct {
57 	runfn fn;
58 	char *name;
59 } RunTab[]={
60 	{bgsaver_init,"bgsaver"},
61 	{changelog_init,"change log"},
62 	{rnd_init,"random generator"},
63 	{missing_log_init,"missing chunks/files log"}, // has to be before 'fs_init'
64 	{dcm_init,"data cache manager"}, // has to be before 'fs_init' and 'matoclserv_init'
65 	{exports_init,"exports manager"},
66 	{topology_init,"net topology module"},
67 	{meta_init,"metadata manager"},
68 	{chartsdata_init,"charts module"},
69 	{matomlserv_init,"communication with metalogger"},
70 	{matocsserv_init,"communication with chunkserver"},
71 	{matoclserv_init,"communication with clients"},
72 	{(runfn)0,"****"}
73 },LateRunTab[]={
74 	{(runfn)0,"****"}
75 },RestoreRunTab[]={
76 	{dcm_init,"data cache manager"}, // has to be before 'fs_init' and 'matoclserv_init'
77 	{meta_restore,"metadata restore"},
78 	{(runfn)0,"****"}
79 };
80