292 {
293 std::ios::sync_with_stdio(false);
294 options_description
cli (
"sysio-blocklog command line options");
295 try {
298 variables_map vmap;
299 bpo::store(bpo::parse_command_line(argc,
argv,
cli), vmap);
300 bpo::notify(vmap);
302 cli.print(std::cerr);
303 return 0;
304 }
306 smoke_test(vmap.at(
"blocks-dir").as<bfs::path>());
307 return 0;
308 }
311 std::cerr << "trim-blocklog does nothing unless specify first and/or last block.";
312 return -1;
313 }
314 if (blog.
last_block != std::numeric_limits<uint32_t>::max()) {
316 return -1;
317 }
320 return -1;
321 }
322 return 0;
323 }
327 return 0;
328 }
330 const bfs::path blocks_dir = vmap.at("blocks-dir").as<bfs::path>();
331 bfs::path out_file = blocks_dir / "blocks.index";
332 const bfs::path block_file = blocks_dir / "blocks.log";
333
334 if (vmap.count("output-file") > 0)
335 out_file = vmap.at("output-file").as<bfs::path>();
336
340 block_log::construct_index(block_file.generic_string(), out_file.generic_string());
342 rt.report();
343 return 0;
344 }
345
350 return -1;
351 } catch( const boost::exception& e ) {
352 elog(
"${e}", (
"e",boost::diagnostic_information(e)));
353 return -1;
354 } catch( const std::exception& e ) {
355 elog(
"${e}", (
"e",e.what()));
356 return -1;
357 } catch( ... ) {
358 elog(
"unknown exception");
359 return -1;
360 }
361
362 return 0;
363}
Used to generate a useful error report when an exception is thrown.
std::string to_detail_string(log_level ll=log_level::all) const
logger & set_log_level(log_level e)
static logger get(const fc::string &name=DEFAULT_LOGGER)
log_level get_log_level() const
void smoke_test(bfs::path block_dir)
int trim_blocklog_end(bfs::path block_dir, uint32_t n)
bool trim_blocklog_front(bfs::path block_dir, uint32_t n)
void set_program_options(options_description &cli)
void initialize(const variables_map &options)