Skip to content

Commit 45d16e0

Browse files
committed
Look for nodes in cache in non-slim mode in two-stage processing
Another addition to the same issue as in the previews commit: In non-slim mode look for node locations in the (on disk and ram) caches and create a node from there is a node is requested for further processing in two-stage processing.
1 parent ce75b4c commit 45d16e0

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/middle-ram.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,32 @@ bool middle_ram_t::node_get(osmid_t id, osmium::memory::Buffer *buffer) const
283283
assert(buffer);
284284

285285
if (m_store_options.nodes) {
286-
return get_object(osmium::item_type::node, id, buffer);
286+
auto const got_it = get_object(osmium::item_type::node, id, buffer);
287+
if (got_it) {
288+
return true;
289+
}
287290
}
291+
292+
if (m_store_options.locations) {
293+
osmium::Location location{};
294+
if (m_persistent_cache) {
295+
location = m_persistent_cache->get(id);
296+
}
297+
if (!location.valid()) {
298+
location = m_node_locations.get(id);
299+
}
300+
if (location.valid()) {
301+
{
302+
osmium::builder::NodeBuilder builder{*buffer};
303+
builder.set_id(id);
304+
builder.set_location(location);
305+
}
306+
307+
buffer->commit();
308+
return true;
309+
}
310+
}
311+
288312
return false;
289313
}
290314

0 commit comments

Comments
 (0)