trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject trafficserver git commit: TS-3287 Remove some more dead code, this should eventually die completely
Date Tue, 27 Jan 2015 16:01:06 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 4f5e3f0b0 -> e3c7e1aa5


TS-3287 Remove some more dead code, this should eventually die completely


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/e3c7e1aa
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e3c7e1aa
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e3c7e1aa

Branch: refs/heads/master
Commit: e3c7e1aa586c672fc014478b8c79b99528cc57ba
Parents: 4f5e3f0
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Mon Jan 26 09:56:08 2015 -0700
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Tue Jan 27 09:00:53 2015 -0700

----------------------------------------------------------------------
 mgmt/web2/WebOverview.cc | 173 +-----------------------------------------
 mgmt/web2/WebOverview.h  |  14 +---
 2 files changed, 5 insertions(+), 182 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e3c7e1aa/mgmt/web2/WebOverview.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebOverview.cc b/mgmt/web2/WebOverview.cc
index 95e6330..c66aeba 100644
--- a/mgmt/web2/WebOverview.cc
+++ b/mgmt/web2/WebOverview.cc
@@ -136,21 +136,7 @@ overviewRecord::updateStatus(time_t currentTime, ClusterPeerInfo * cpi)
   }
 }
 
-// bool overviewRecord::ipMatch(char* ipStr)
-//
-//   Returns true if the passed in string matches
-//     the ip address for this node
-bool
-overviewRecord::ipMatch(char *ipStr)
-{
-  if (inet_addr(ipStr) == inetAddr) {
-    return true;
-  } else {
-    return false;
-  }
-}
-
-//  overview::readCounter, overview::readInteger
+// overview::readInteger
 //
 //  Accessor functions for node records.  For remote node,
 //    we get the value in the node_data array we maintain
@@ -161,32 +147,6 @@ overviewRecord::ipMatch(char *ipStr)
 //  Locking should be done by overviewPage::accessLock.
 //  CALLEE is responsible for obtaining and releasing the lock
 //
-RecCounter
-overviewRecord::readCounter(const char *name, bool * found)
-{
-  RecCounter rec = 0;
-  int rec_status = REC_ERR_OKAY;
-  int order = -1;
-  if (localNode == false) {
-    rec_status = RecGetRecordOrderAndId(name, &order, NULL);
-    if (rec_status == REC_ERR_OKAY) {
-      order -= node_rec_first_ix; // Offset
-      ink_release_assert(order < node_rec_data.num_recs);
-      ink_assert(order < node_rec_data.num_recs);
-      rec = node_rec_data.recs[order].data.rec_counter;
-    } else {
-      mgmt_log(stderr, "node variables '%s' not found!\n");
-    }
-  }
-
-  if (found) {
-    *found = (rec_status == REC_ERR_OKAY);
-  } else {
-    mgmt_log(stderr, "node variables '%s' not found!\n");
-  }
-  return rec;
-}
-
 RecInt
 overviewRecord::readInteger(const char *name, bool * found)
 {
@@ -305,137 +265,6 @@ overviewRecord::readData(RecDataT varType, const char *name, bool *
found)
   return rec;
 }
 
-// bool overviewRecord::varStrFromName (char*, char*bufVal, char*, int)
-//
-//  Accessor function for node records.  Looks up varName for
-//    this node and if found, turns it value into a string
-//    and places it in bufVal
-//
-//  return true if bufVal was succefully set
-//    and false otherwise
-//
-//  EVIL ALERT: varStrFromName in WebMgmtUtils.cc is extremely
-//    similar to this function except in how it gets it's
-//    data.  Changes to this fuction must be propogated
-//    to its twin.  Cut and Paste sucks but there is not
-//    an easy way to merge the functions
-//
-bool
-overviewRecord::varStrFromName(const char *varNameConst, char *bufVal, int bufLen)
-{
-  char *varName;
-  RecDataT varDataType;
-  bool found = true;
-  int varNameLen;
-  char formatOption = '\0';
-
-  union
-  {
-    MgmtIntCounter counter_data;        /* Data */
-    MgmtInt int_data;
-    MgmtFloat float_data;
-    MgmtString string_data;
-  } data;
-
-  // Check to see if there is a \ option on the end of variable
-  //   \ options indicate that we need special formatting
-  //   of the results.  Supported \ options are
-  //
-  ///  b - bytes.  Ints and Counts only.  Amounts are
-  //       transformed into one of GB, MB, KB, or B
-  //
-  varName = ats_strdup(varNameConst);
-  varNameLen = strlen(varName);
-  if (varNameLen > 3 && varName[varNameLen - 2] == '\\') {
-    formatOption = varName[varNameLen - 1];
-
-    // Now that we know the format option, terminate the string
-    //   to make the option disappear
-    varName[varNameLen - 2] = '\0';
-
-    // Return not found for unknown format options
-    if (formatOption != 'b' && formatOption != 'm' && formatOption != 'c'
&& formatOption != 'p') {
-      ats_free(varName);
-      return false;
-    }
-  }
-  if (RecGetRecordDataType(varName, &varDataType) == REC_ERR_FAIL) {
-    ats_free(varName);
-    return false;
-  }
-
-  switch (varDataType) {
-  case RECD_INT:
-    data.int_data = this->readInteger(varName, &found);
-    if (formatOption == 'b') {
-      bytesFromInt(data.int_data, bufVal);
-    } else if (formatOption == 'm') {
-      MbytesFromInt(data.int_data, bufVal);
-    } else if (formatOption == 'c') {
-      commaStrFromInt(data.int_data, bufVal);
-    } else {
-      snprintf(bufVal, bufLen, "%" PRId64 "", data.int_data);
-    }
-    break;
-  case RECD_COUNTER:
-    data.counter_data = this->readCounter(varName, &found);
-    if (formatOption == 'b') {
-      bytesFromInt((MgmtInt) data.counter_data, bufVal);
-    } else if (formatOption == 'm') {
-      MbytesFromInt((MgmtInt) data.counter_data, bufVal);
-    } else if (formatOption == 'c') {
-      commaStrFromInt(data.counter_data, bufVal);
-    } else {
-      snprintf(bufVal, bufLen, "%" PRId64 "", data.counter_data);
-    }
-    break;
-  case RECD_FLOAT:
-    data.float_data = this->readFloat(varName, &found);
-    if (formatOption == 'p') {
-      percentStrFromFloat(data.float_data, bufVal);
-    } else {
-      snprintf(bufVal, bufLen, "%.2f", data.float_data);
-    }
-    break;
-  case RECD_STRING:
-    data.string_data = this->readString(varName, &found);
-    if (data.string_data == NULL) {
-      bufVal[0] = '\0';
-    } else {
-      ink_strlcpy(bufVal, data.string_data, bufLen);
-    }
-    ats_free(data.string_data);
-    break;
-  case RECD_NULL:
-  default:
-    found = false;
-    break;
-  }
-
-  ats_free(varName);
-  return found;
-}
-
-bool
-overviewRecord::varCounterFromName(const char *name, MgmtIntCounter * value)
-{
-  bool found = false;
-
-  if (value)
-    *value = readCounter((char *) name, &found);
-  return found;
-}
-
-bool
-overviewRecord::varIntFromName(const char *name, MgmtInt * value)
-{
-  bool found = false;
-
-  if (value)
-    *value = readInteger((char *) name, &found);
-  return found;
-}
-
 bool
 overviewRecord::varFloatFromName(const char *name, MgmtFloat * value)
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e3c7e1aa/mgmt/web2/WebOverview.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebOverview.h b/mgmt/web2/WebOverview.h
index 5992755..a51b7b8 100644
--- a/mgmt/web2/WebOverview.h
+++ b/mgmt/web2/WebOverview.h
@@ -70,31 +70,25 @@
 //    should be returned as a copy (or a const ptr)
 //    through an accessor function
 
-enum PowerLampState
-{ LAMP_ON, LAMP_OFF, LAMP_WARNING };
-
 // information about a specific node in the cluster
 class overviewRecord
 {
 public:
   overviewRecord(unsigned long inet_addr, bool local, ClusterPeerInfo * cpi = NULL);
-   ~overviewRecord();
+
+  ~overviewRecord();
+
   void updateStatus(time_t currentTime, ClusterPeerInfo * cpi);
-  void getStatus(char **hotsname, bool * up, bool * alarms, PowerLampState * proxyUp);
-  bool ipMatch(char *ipStr);    // is this the ip address of this node
+
   bool up;
   bool localNode;
   char *hostname;               // FQ hostname of the node
   unsigned long inetAddr;       // IP address of the node
-  bool varStrFromName(const char *varName, char *bufVal, int bufLen);
-  RecCounter readCounter(const char *name, bool * found);
   RecInt readInteger(const char *name, bool * found);
   RecFloat readFloat(const char *name, bool * found);
   RecString readString(const char *name, bool * found);
   RecData readData(RecDataT varType, const char *name, bool * found);
-  bool varIntFromName(const char *varName, RecInt * value);
   bool varFloatFromName(const char *varName, RecFloat * value);
-  bool varCounterFromName(const char *varName, RecCounter * value);
 
 private:
   RecRecords node_rec_data;   // a copy from ClusterPeerInfo


Mime
View raw message