Skip to content

Commit

Permalink
parallelize the reading again
Browse files Browse the repository at this point in the history
...it is not at all clear to me why this should work and the other
attempts would not. This makes me think this doesn't actually work,
but let's keep going and see what happens.
  • Loading branch information
cldellow committed Oct 5, 2024
1 parent 106a875 commit ad101f9
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/tilemaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int main(const int argc, const char* argv[]) {
//
// ...but why does this die, and our very similar use immediately
// below does not?
//boost::asio::post(pool, [&]() {
boost::asio::post(pool, [&]() {
// Determine which tiles exist in this mbtiles file.
//
// This lets us optimize the case where only a single mbtiles has
Expand All @@ -149,8 +149,16 @@ int main(const int argc, const char* argv[]) {
//MBTiles mbtiles;
//mbtiles.openForReading(input->filename);
//mbtiles.populateTiles(input->zooms, input->bbox);
input->mbtiles.populateTiles(input->zooms, input->bbox);
//});
if (tlsTiles.empty()) {
for (const auto& input : inputs) {
tlsTiles.push_back(std::make_shared<MBTiles>());
tlsTiles.back()->openForReading(input->filename);
}
}

//input->mbtiles.populateTiles(input->zooms, input->bbox);
tlsTiles[input->index]->populateTiles(input->zooms, input->bbox);
});
}

pool.join();
Expand Down Expand Up @@ -208,11 +216,18 @@ int main(const int argc, const char* argv[]) {
//std::vector<char> old = matching[0]->mbtiles.readTile(zoom, x, y);

std::string buffer(old.data(), old.size());
// TODO: is this valid? We have a lock, but we'll access
// from different threads. This might be problematic because
// we cache the prepared statement.
merged.saveTile(zoom, x, y, &buffer, false);
continue;
}

//std::cout << "z=" << std::to_string(zoom) << " x=" << std::to_string(x) << " y=" << std::to_string(y) << " has " << std::to_string(matching.size()) << " tiles" << std::endl;
// Multiple mbtiles want to contribute a tile at this zxy.
// They'll all have disjoint layers, so decompress each tile
// and concatenate their contents to form the new tile.

// TODO: do this
}
}
}
Expand Down

0 comments on commit ad101f9

Please sign in to comment.