Skip to content

Commit e04bfaf

Browse files
authored
refactor: use designated initializers for RunTab (#662)
Use designated initializers (.function and .name) for all RunTab struct initializations across master, chunkserver, and metalogger modules. This improves code clarity and removes the clang-tidy warnings. Signed-off-by: guillex <[email protected]>
1 parent 1094009 commit e04bfaf

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

src/chunkserver/init.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ inline const std::vector<RunTab> earlyRunTabs = {};
3535

3636
/// Functions to call during normal startup
3737
inline const std::vector<RunTab> runTabs = {
38-
RunTab{rnd_init, "random generator"},
39-
RunTab{MemoryManager::init, "memory manager"},
40-
RunTab{initDiskManager, "disk manager"}, // Always before "plugin manager"
41-
RunTab{loadPlugins, "plugin manager"}, RunTab{hddInit, "hdd space manager"},
38+
RunTab{.function = rnd_init, .name = "random generator"},
39+
RunTab{.function = MemoryManager::init, .name = "memory manager"},
40+
RunTab{.function = initDiskManager, .name = "disk manager"}, // Always before "plugin manager"
41+
RunTab{.function = loadPlugins, .name = "plugin manager"},
42+
RunTab{.function = hddInit, .name = "hdd space manager"},
4243
// Has to be before "masterconn"
43-
RunTab{mainNetworkThreadInit, "main server module"},
44-
RunTab{masterconn_init_threads, "master connection module - threads"},
45-
RunTab{masterconn_init, "master connection module"},
46-
RunTab{chartsdata_init, "charts module"}};
44+
RunTab{.function = mainNetworkThreadInit, .name = "main server module"},
45+
RunTab{.function = masterconn_init_threads, .name = "master connection module - threads"},
46+
RunTab{.function = masterconn_init, .name = "master connection module"},
47+
RunTab{.function = chartsdata_init, .name = "charts module"}};
4748

4849
/// Functions to call delayed after the initialization is correct
4950
inline const std::vector<RunTab> lateRunTabs = {
50-
RunTab{hddLateInit, "hdd space manager - threads"},
51-
RunTab{mainNetworkThreadInitThreads, "main server module - threads"}};
51+
RunTab{.function = hddLateInit, .name = "hdd space manager - threads"},
52+
RunTab{.function = mainNetworkThreadInitThreads, .name = "main server module - threads"}};

src/master/init.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,31 +75,31 @@ inline int metadata_backend_init() {
7575

7676
/// Functions to call before normal startup
7777
inline const std::vector<RunTab> earlyRunTabs = {
78-
RunTab{metadataserver::personality_validate, "validate personality"}};
78+
RunTab{.function = metadataserver::personality_validate, .name = "validate personality"}};
7979

8080
/// Functions to call during normal startup
8181
inline const std::vector<RunTab> runTabs = {
82-
RunTab{prometheus_init, "prometheus module"},
82+
RunTab{.function = prometheus_init, .name = "prometheus module"},
8383
// has to be first
84-
RunTab{hstorage_init, "name storage"},
84+
RunTab{.function = hstorage_init, .name = "name storage"},
8585
// has to be second
86-
RunTab{metadataserver::personality_init, "personality"},
87-
RunTab{rnd_init, "random generator"},
86+
RunTab{.function = metadataserver::personality_init, .name = "personality"},
87+
RunTab{.function = rnd_init, .name = "random generator"},
8888
// has to be before 'fs_init' and 'matoclserv_networkinit'
89-
RunTab{dcm_init, "data cache manager"},
89+
RunTab{.function = dcm_init, .name = "data cache manager"},
9090
// has to be before 'fs_init'
91-
RunTab{matoclserv_sessions_init, "load stored sessions"},
92-
RunTab{exports_init, "exports manager"},
93-
RunTab{topology_init, "net topology module"},
94-
RunTab{metadata_backend_init, "metadata backend initialization"},
91+
RunTab{.function = matoclserv_sessions_init, .name = "load stored sessions"},
92+
RunTab{.function = exports_init, .name = "exports manager"},
93+
RunTab{.function = topology_init, .name = "net topology module"},
94+
RunTab{.function = metadata_backend_init, .name = "metadata backend initialization"},
9595
// the lambda is used to select the correct fs_init overload
96-
RunTab{[]() { return fs_init(); }, "file system manager"},
97-
RunTab{chartsdata_init, "charts module"},
98-
RunTab{masterconn_init, "communication with master server"},
99-
RunTab{matomlserv_init, "communication with metalogger"},
100-
RunTab{matocsserv_init, "communication with chunkserver"},
101-
RunTab{matontserv_init, "communication with notifier"},
102-
RunTab{matoclserv_network_init, "communication with clients"}};
96+
RunTab{.function = []() { return fs_init(); }, .name = "file system manager"},
97+
RunTab{.function = chartsdata_init, .name = "charts module"},
98+
RunTab{.function = masterconn_init, .name = "communication with master server"},
99+
RunTab{.function = matomlserv_init, .name = "communication with metalogger"},
100+
RunTab{.function = matocsserv_init, .name = "communication with chunkserver"},
101+
RunTab{.function = matontserv_init, .name = "communication with notifier"},
102+
RunTab{.function = matoclserv_network_init, .name = "communication with clients"}};
103103

104104
/// Functions to call delayed after the initialization is correct
105105
inline const std::vector<RunTab> lateRunTabs = {};

0 commit comments

Comments
 (0)