Add support for dataset versionning.
This also updates to the latest mercator_db API which adds multi-dataset support.
This commit is contained in:
@@ -24,7 +24,6 @@ structopt = "^0.3"
|
||||
mercator_db = "^0.1"
|
||||
|
||||
# Logging macros API
|
||||
#log = { version = "^0.4", features = ["max_level_trace", "release_max_level_info"] }
|
||||
log = { version = "^0.4", features = ["max_level_trace", "release_max_level_trace"] }
|
||||
pretty_env_logger = "^0.3" # Logger implementation
|
||||
|
||||
|
||||
10
README.md
10
README.md
@@ -47,7 +47,7 @@ For 3 datasets, `setA`, `setB`, `setC`, the following files are expected to be i
|
||||
Run (and build if necessary) the indexer:
|
||||
|
||||
```sh
|
||||
cargo run --release -- setA, setB, setC
|
||||
cargo run --release -- setA setB setC
|
||||
```
|
||||
|
||||
This will produce the following files:
|
||||
@@ -64,6 +64,14 @@ This will produce the following files:
|
||||
- setC.spaces.bin
|
||||
- setC.index
|
||||
|
||||
By default, each dataset will have a version set to the empty string, if you want to specify the dataset version you can like this:
|
||||
|
||||
```sh
|
||||
cargo run --release -- setA:v0.1 setB setC:MyAwesomeVersion
|
||||
```
|
||||
|
||||
With the above, `setA` will have its version set to `v0.1`, `setB` to the empty string and `setC` to `MyAwesomeVersion`.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
This open source software code was developed in part or in whole in the
|
||||
|
||||
20
src/main.rs
20
src/main.rs
@@ -1,8 +1,6 @@
|
||||
#[macro_use]
|
||||
extern crate measure_time;
|
||||
|
||||
use std::process::exit;
|
||||
|
||||
use mercator_db::json::storage;
|
||||
use structopt::StructOpt;
|
||||
|
||||
@@ -23,19 +21,29 @@ fn main() {
|
||||
|
||||
for dataset in opt.datasets {
|
||||
println!();
|
||||
warn!("Indexing dataset: {}", dataset);
|
||||
warn_time!("Indexed dataset: {}", dataset);
|
||||
|
||||
let v = dataset.split(':').collect::<Vec<_>>();
|
||||
if v.len() > 2 {
|
||||
warn!("Invalid dataset definition, too many fields: '{:?}'", v);
|
||||
continue;
|
||||
}
|
||||
|
||||
let title = v[0];
|
||||
let version = if v.len() == 2 { v[1] } else { "" };
|
||||
|
||||
warn!("Indexing dataset: {}", title);
|
||||
warn_time!("Indexed dataset: {}", title);
|
||||
|
||||
// Convert to binary the JSON data:
|
||||
{
|
||||
info_time!("Converting to binary JSON data");
|
||||
storage::convert(&dataset);
|
||||
storage::convert(&title);
|
||||
}
|
||||
|
||||
// Build a Database Index:
|
||||
{
|
||||
info_time!("Building database index");
|
||||
storage::build(&dataset);
|
||||
storage::build(&title, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user