Add optional max_state_group param

This commit is contained in:
Erik Johnston
2019-03-20 16:13:51 +00:00
parent b9be6c5ed1
commit d764082d31
2 changed files with 46 additions and 16 deletions

View File

@@ -124,6 +124,12 @@ fn main() {
.help("The room to process")
.takes_value(true)
.required(true),
).arg(
Arg::with_name("max_state_group")
.short("s")
.help("The maximum state group to process up to")
.takes_value(true)
.required(false),
).arg(
Arg::with_name("output_file")
.short("o")
@@ -161,17 +167,22 @@ fn main() {
let mut output_file = matches
.value_of("output_file")
.map(|path| File::create(path).unwrap());
let room_id = matches
.value_of("room_id")
.expect("room_id should be required since no file");
let max_state_group = matches
.value_of("max_state_group")
.map(|s| s.parse().expect("max_state_group must be an integer"));
let transactions = matches.is_present("transactions");
let level_sizes = value_t_or_exit!(matches, "level_sizes", LevelSizes);
// First we need to get the current state groups
println!("Fetching state from DB for room '{}'...", room_id);
let state_group_map = database::get_data_from_db(db_url, room_id);
let state_group_map = database::get_data_from_db(db_url, room_id, max_state_group);
println!("Number of state groups: {}", state_group_map.len());