Browse Source

[2853] Split DataSourceStatus constructor into two

Mukund Sivaraman 12 years ago
parent
commit
c8050a3b7d
2 changed files with 16 additions and 4 deletions
  1. 1 1
      src/lib/datasrc/client_list.cc
  2. 15 3
      src/lib/datasrc/client_list.h

+ 1 - 1
src/lib/datasrc/client_list.cc

@@ -417,7 +417,7 @@ ConfigurableClientList::getStatus() const {
                  SEGMENT_INUSE : SEGMENT_WAITING),
                 info.ztable_segment_->getImplType()));
         } else {
-            result.push_back(DataSourceStatus(info.name_, SEGMENT_UNUSED));
+            result.push_back(DataSourceStatus(info.name_));
         }
     }
     return (result);

+ 15 - 3
src/lib/datasrc/client_list.h

@@ -81,13 +81,25 @@ class DataSourceStatus {
 public:
     /// \brief Constructor
     ///
-    /// Sets initial values. It doesn't matter what is provided for the type
-    /// if state is SEGMENT_UNUSED, the value is effectively ignored.
+    /// Sets initial values.
     DataSourceStatus(const std::string& name, MemorySegmentState state,
-                     const std::string& type = std::string()) :
+                     const std::string& type) :
         name_(name),
         type_(type),
         state_(state)
+    {
+        assert (state != SEGMENT_UNUSED);
+        assert (!type.empty());
+    }
+
+    /// \brief Constructor
+    ///
+    /// Sets initial values. The state is set as SEGMENT_UNUSED and the
+    /// type is effectively unspecified.
+    DataSourceStatus(const std::string& name) :
+        name_(name),
+        type_(""),
+        state_(SEGMENT_UNUSED)
     {}
 
     /// \brief Get the segment state