indexedlog_dump: make it support dumping meta files

Summary:
This make it easier to check the integrity and content of indexedlog metadata
files.

Reviewed By: xavierd

Differential Revision: D16077683

fbshipit-source-id: 7142856e6f0a73add832a71a416a58bb3580686f
This commit is contained in:
Jun Wu 2019-07-02 14:50:05 -07:00 committed by Facebook Github Bot
parent 02877bf4ce
commit f169d6cc42

View File

@ -17,7 +17,9 @@ use std::{env, path::Path};
fn main() {
for arg in env::args().skip(1) {
let path = Path::new(&arg);
if path.is_dir() {
if let Ok(meta) = indexedlog::log::LogMetadata::read_file(path) {
println!("Metadata File {:?}\n{:?}\n", path, meta);
} else if path.is_dir() {
// Treate it as Log.
let log = indexedlog::log::Log::open(path, Vec::new()).unwrap();
println!("Log Directory {:?}:\n{:#?}\n", path, log);