Skip to content

Commit

Permalink
Adjust max element counts
Browse files Browse the repository at this point in the history
  • Loading branch information
brad-richardson committed Jul 6, 2024
1 parent 8728e5a commit 5509859
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ target/

# Test outputs
out/
test/*.osm
test/*.pbf
test/parquet/
*.osm.pbf
*.osm
*.parquet

# These are backup files generated by rustfmt
**/*.rs.bk
Expand Down
6 changes: 4 additions & 2 deletions src/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ pub struct ElementSink {
}

impl ElementSink {
const MAX_ELEMENTS_COUNT: u64 = 1_000_000;
const MAX_NODES_COUNT: u64 = 5_000_000;
const MAX_WAY_RELATION_COUNT: u64 = 500_000;

pub fn new(
filenum: Arc<Mutex<u64>>,
Expand Down Expand Up @@ -58,7 +59,8 @@ impl ElementSink {

fn increment_and_cycle(&mut self) -> Result<(), std::io::Error> {
self.num_elements += 1;
if self.num_elements >= Self::MAX_ELEMENTS_COUNT {
let max_elements = if self.osm_type == OSMType::Node { Self::MAX_NODES_COUNT } else { Self::MAX_WAY_RELATION_COUNT };
if self.num_elements >= max_elements {
self.finish_batch();
}
Ok(())
Expand Down

0 comments on commit 5509859

Please sign in to comment.