]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/PrioritizedQueue: constify a few things
authorSage Weil <sage@inktank.com>
Tue, 18 Mar 2014 04:41:40 +0000 (21:41 -0700)
committerSage Weil <sage@inktank.com>
Tue, 18 Mar 2014 20:16:05 +0000 (13:16 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/common/PrioritizedQueue.h

index 28a9f7a4cd7fe509bbe914240125fe1019deb880..e5557e608fb0edf1ab281db559e8743ddbfbde6e 100644 (file)
@@ -230,15 +230,15 @@ public:
       min_cost(min_c)
   {}
 
-  unsigned length() {
+  unsigned length() const {
     unsigned total = 0;
-    for (typename map<unsigned, SubQueue>::iterator i = queue.begin();
+    for (typename map<unsigned, SubQueue>::const_iterator i = queue.begin();
         i != queue.end();
         ++i) {
       assert(i->second.length());
       total += i->second.length();
     }
-    for (typename map<unsigned, SubQueue>::iterator i = high_queue.begin();
+    for (typename map<unsigned, SubQueue>::const_iterator i = high_queue.begin();
         i != high_queue.end();
         ++i) {
       assert(i->second.length());
@@ -323,7 +323,7 @@ public:
     create_queue(priority)->enqueue_front(cl, cost, item);
   }
 
-  bool empty() {
+  bool empty() const {
     assert(total_priority >= 0);
     assert((total_priority == 0) || !(queue.empty()));
     return queue.empty() && high_queue.empty();