@@ -78,7 +78,10 @@ struct middle_query_t : std::enable_shared_from_this<middle_query_t>
7878inline middle_query_t ::~middle_query_t () = default ;
7979
8080/* *
81- * Interface for storing raw OSM data in an intermediate cache.
81+ * Interface for storing raw OSM data in an intermediate object store.
82+ *
83+ * This interface only allows for setting OSM data once, not changing it.
84+ * If you need updates and deletions, look at the derived class slim_middle_t.
8285 */
8386struct middle_t
8487{
@@ -89,11 +92,33 @@ struct middle_t
8992 virtual void analyze (void ) = 0;
9093 virtual void commit (void ) = 0;
9194
95+ /* *
96+ * Add a node to data storage. The node must not already be in the
97+ * data storage.
98+ */
9299 virtual void node_set (osmium::Node const &node) = 0;
100+
101+ /* *
102+ * Add a way to data storage. The way must not already be in the data
103+ * storage.
104+ */
93105 virtual void way_set (osmium::Way const &way) = 0;
106+
107+ /* *
108+ * Add a relation to data storage. The way must not already be in the
109+ * data storage.
110+ */
94111 virtual void relation_set (osmium::Relation const &rel) = 0;
95112
96- // / Write all pending data to permanent storage.
113+ /* *
114+ * Ensure all pending data is written to the storage.
115+ *
116+ * You can only query objects from the storage after they have been
117+ * flushed.
118+ *
119+ * The function is called after setting all the nodes, then after setting
120+ * all the ways, and again after setting all the relations.
121+ */
97122 virtual void flush () = 0;
98123
99124 struct pending_processor
@@ -116,20 +141,49 @@ struct middle_t
116141inline middle_t ::~middle_t () = default ;
117142
118143/* *
119- * Extended interface for permanent caching of raw OSM data.
120- * It also allows updates.
144+ * Extends the middle_t interface to allow updates and deletions of objects.
121145 */
122146struct slim_middle_t : public middle_t
123147{
124148 virtual ~slim_middle_t () = 0 ;
125149
150+ /* *
151+ * Delete a node from data storage. Either because you want it removed
152+ * entirely or before you can node_set() a new version of it.
153+ */
126154 virtual void node_delete (osmid_t id) = 0;
155+
156+ /* *
157+ * Mark a node as changed. This has to be called *after* node_delete()
158+ * and node_set() is called to trigger the propagation of this change
159+ * to ways and relations.
160+ */
127161 virtual void node_changed (osmid_t id) = 0;
128162
163+ /* *
164+ * Delete a way from data storage. Either because you want it removed
165+ * entirely or before you can way_set() a new version of it.
166+ */
129167 virtual void way_delete (osmid_t id) = 0;
168+
169+ /* *
170+ * Mark a way as changed. This has to be called *after* way_delete()
171+ * and way_set() is called to trigger the propagation of this change
172+ * to relations.
173+ */
130174 virtual void way_changed (osmid_t id) = 0;
131175
176+ /* *
177+ * Delete a relation from data storage. Either because you want it removed
178+ * entirely or before you can relation_set() a new version of it.
179+ */
132180 virtual void relation_delete (osmid_t id) = 0;
181+
182+ /* *
183+ * Mark a relation as changed. This has to be called *after*
184+ * relation_delete() and relation_set() is called to trigger the
185+ * propagation of this change to other relations.
186+ */
133187 virtual void relation_changed (osmid_t id) = 0;
134188};
135189
0 commit comments