So it can be used from a const dump method. Make the elist mutable
instead.
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* Calculate the length of the `requests` member list,
* because elist does not have a size() method.
*
- * O(N) runtime. This would be const, but elist doesn't
- * have const iterators.
+ * O(N) runtime.
*/
-size_t Session::get_request_count()
+size_t Session::get_request_count() const
{
size_t result = 0;
- elist<MDRequestImpl*>::iterator p = requests.begin(
- member_offset(MDRequestImpl, item_session_request));
- while (!p.end()) {
+ auto it = requests.begin(member_offset(MDRequestImpl, item_session_request));
+ while (!it.end()) {
++result;
- ++p;
+ ++it;
}
return result;
list<ref_t<Message>> preopen_out_queue; ///< messages for client, queued before they connect
- elist<MDRequestImpl*> requests;
- size_t get_request_count();
+ /* This is mutable to allow get_request_count to be const. elist does not
+ * support const iterators yet.
+ */
+ mutable elist<MDRequestImpl*> requests;
+ size_t get_request_count() const;
interval_set<inodeno_t> pending_prealloc_inos; // journaling prealloc, will be added to prealloc_inos