Skip to content

Commit 4a667fb

Browse files
committed
Add documentation to id_tracker
This is based on @zerebubuth's comments in osm2pgsql-dev@aa1ff6e#commitcomment-10961958
1 parent 4e62058 commit 4a667fb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

id-tracker.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,29 @@
55
#include <boost/noncopyable.hpp>
66
#include <memory>
77

8+
/**
9+
* Tracker for if an element needs to be revisited later in the process, also
10+
* known as "pending". This information used to be stored in the database, but
11+
* is ephemeral and lead to database churn, bloat, and was generally slow.
12+
* An initial re-implementation stored it as a std::set<osmid_t>, which worked
13+
* but was inefficient with memory overhead and pointer chasing.
14+
*
15+
* Instead, the size of the leaf nodes is increased. This was initially a
16+
* vector<bool>, but the cost of exposing the iterator was too high.
17+
* Instead, it's a uint32, with a function to find the next bit set in the block
18+
*
19+
* These details aren't exposed in the public interface, which just has
20+
* pop_mark.
21+
*/
822
struct id_tracker : public boost::noncopyable {
923
id_tracker();
1024
~id_tracker();
1125

1226
void mark(osmid_t id);
1327
bool is_marked(osmid_t id);
28+
/**
29+
* Finds an osmid_t that is marked
30+
*/
1431
osmid_t pop_mark();
1532
size_t size();
1633
osmid_t last_returned() const;

0 commit comments

Comments
 (0)