MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / process_manifest

Function process_manifest

tools/comdb2ar/deserialise.cpp:109–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107
108
109static void process_manifest(
110 const std::string& text,
111 std::map<std::string, FileInfo>& manifest_map,
112 bool& run_full_recovery,
113 std::string& origlrlname,
114 std::vector<std::string> &options
115 )
116// Decode the manifest into a map of files and their associated file info
117{
118 FileInfo tmp_file;
119
120 std::istringstream in(text);
121 std::string line;
122
123 int lineno = 0;
124 while(!in.eof()) {
125 std::getline(in, line);
126 lineno++;
127
128 size_t pos = line.find_first_of('#');
129 if(pos != std::string::npos) {
130 line.resize(pos);
131 }
132
133 std::istringstream ss(line);
134 std::string tok;
135
136 if(ss >> tok) {
137 if(tok == "File") {
138 if(read_FileInfo(line, tmp_file)) {
139 manifest_map[tmp_file.get_filename()] = tmp_file;
140 tmp_file.reset();
141 } else {
142 std::clog << "Bad File directive on line "
143 << lineno << " of MANIFEST" << std::endl;
144 }
145 } else if(tok == "SupportFilesOnly") {
146 // If serialisation contains sources only then no need to run
147 // full recovery.
148 run_full_recovery = false;
149 } else if(tok == "OrigLrlFile") {
150
151 // llmeta renames the lrl file
152 // metafile contains the original file name
153 // correct this here
154 ss >> origlrlname;
155 } else if (tok == "Option") {
156 while (ss >> tok) {
157 options.push_back(tok);
158 }
159 } else {
160 std::clog << "Unknown directive '" << tok << "' on line "
161 << lineno << " of MANIFEST" << std::endl;
162 }
163 }
164 }
165}
166

Callers 1

deserialise_databaseFunction · 0.85

Calls 2

read_FileInfoFunction · 0.85
resetMethod · 0.45

Tested by

no test coverage detected