]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "common/*Formatters: Split Formatters"
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 15 Jan 2016 23:05:22 +0000 (15:05 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 15 Jan 2016 23:05:22 +0000 (15:05 -0800)
This reverts commit 2b21e3c595c23f409485b8c391d1bd579b13b8e7.

Conflicts:
src/common/Formatter.cc
src/common/JSONFormatter.h
src/common/Makefile.am
src/common/TableFormatter.h
src/common/XMLFormatter.cc
src/common/XMLFormatter.h
src/rgw/rgw_rest.cc
src/test/formatter.cc

50 files changed:
ceph-object-corpus
src/common/Formatter.cc
src/common/Formatter.h
src/common/JSONFormatter.cc [deleted file]
src/common/Makefile.am
src/common/TableFormatter.cc [deleted file]
src/common/admin_socket.cc
src/mds/MDSDaemon.cc
src/mds/MDSRank.cc
src/mon/ConfigKeyService.cc
src/mon/Monitor.cc
src/mon/Paxos.cc
src/mon/Paxos.h
src/os/FileJournal.cc
src/os/FileStore.cc
src/os/FileStore.h
src/os/KeyValueStore.cc
src/os/KeyValueStore.h
src/os/MemStore.cc
src/osd/OSD.cc
src/osd/OSDMap.cc
src/rbd.cc
src/rgw/rgw_admin.cc
src/rgw/rgw_cors_s3.h
src/rgw/rgw_jsonparser.cc
src/rgw/rgw_log.cc
src/rgw/rgw_rest.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_swift.cc
src/rgw/rgw_swift_auth.cc
src/rocksdb
src/test/bench/small_io_bench.cc
src/test/bench/small_io_bench_dumb.cc
src/test/bench/small_io_bench_fs.cc
src/test/bench/small_io_bench_rbd.cc
src/test/bench/tp_bench.cc
src/test/common/test_tableformatter.cc
src/test/crush/crush.cc
src/test/encoding/ceph_dencoder.cc
src/test/formatter.cc
src/test/kv_store_bench.h
src/test/mon/test_mon_workloadgen.cc
src/test/test_rgw_admin_meta.cc
src/tools/ceph-client-debug.cc
src/tools/ceph_monstore_tool.cc
src/tools/ceph_objectstore_tool.cc
src/tools/cephfs/EventOutput.cc
src/tools/cephfs/JournalTool.cc
src/tools/cephfs/TableTool.cc
src/tools/rados/rados.cc

index 67383cc060dd9f90d398eed5a00e31eb70845dd8..47fbf8c6ae1fb4fca171ac86e98821a67fd32031 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 67383cc060dd9f90d398eed5a00e31eb70845dd8
+Subproject commit 47fbf8c6ae1fb4fca171ac86e98821a67fd32031
index 8bbb25b6c4d896fb60c46068e84b3a3beff35870..345f95df66dca3c34c5b90523c928d22885e197a 100644 (file)
 
 #include "assert.h"
 #include "Formatter.h"
-#include "JSONFormatter.h"
-#include "TableFormatter.h"
-#include "XMLFormatter.h"
-#include "HTMLFormatter.h"
 #include "common/escape.h"
 
 #include <iostream>
@@ -122,4 +118,751 @@ void Formatter::dump_format_unquoted(const char *name, const char *fmt, ...)
   va_end(ap);
 }
 
-} // namespace ceph
+// -----------------------
+
+JSONFormatter::JSONFormatter(bool p)
+: m_pretty(p), m_is_pending_string(false)
+{
+  reset();
+}
+
+void JSONFormatter::flush(std::ostream& os)
+{
+  finish_pending_string();
+  os << m_ss.str();
+  if (m_pretty)
+    os << "\n";
+  m_ss.clear();
+  m_ss.str("");
+}
+
+void JSONFormatter::reset()
+{
+  m_stack.clear();
+  m_ss.clear();
+  m_ss.str("");
+  m_pending_string.clear();
+  m_pending_string.str("");
+}
+
+void JSONFormatter::print_comma(json_formatter_stack_entry_d& entry)
+{
+  if (entry.size) {
+    if (m_pretty) {
+      m_ss << ",\n";
+      for (unsigned i = 1; i < m_stack.size(); i++)
+        m_ss << "    ";
+    } else {
+      m_ss << ",";
+    }
+  } else if (m_pretty) {
+    m_ss << "\n";
+    for (unsigned i = 1; i < m_stack.size(); i++)
+      m_ss << "    ";
+  }
+  if (m_pretty && entry.is_array)
+    m_ss << "    ";
+}
+
+void JSONFormatter::print_quoted_string(const std::string& s)
+{
+  int len = escape_json_attr_len(s.c_str(), s.size());
+  char escaped[len];
+  escape_json_attr(s.c_str(), s.size(), escaped);
+  m_ss << '\"' << escaped << '\"';
+}
+
+void JSONFormatter::print_name(const char *name)
+{
+  finish_pending_string();
+  if (m_stack.empty())
+    return;
+  struct json_formatter_stack_entry_d& entry = m_stack.back();
+  print_comma(entry);
+  if (!entry.is_array) {
+    if (m_pretty) {
+      m_ss << "    ";
+    }
+    m_ss << "\"" << name << "\"";
+    if (m_pretty)
+      m_ss << ": ";
+    else
+      m_ss << ':';
+  }
+  ++entry.size;
+}
+
+void JSONFormatter::open_section(const char *name, bool is_array)
+{
+  print_name(name);
+  if (is_array)
+    m_ss << '[';
+  else
+    m_ss << '{';
+
+  json_formatter_stack_entry_d n;
+  n.is_array = is_array;
+  m_stack.push_back(n);
+}
+
+void JSONFormatter::open_array_section(const char *name)
+{
+  open_section(name, true);
+}
+
+void JSONFormatter::open_array_section_in_ns(const char *name, const char *ns)
+{
+  std::ostringstream oss;
+  oss << name << " " << ns;
+  open_section(oss.str().c_str(), true);
+}
+
+void JSONFormatter::open_object_section(const char *name)
+{
+  open_section(name, false);
+}
+
+void JSONFormatter::open_object_section_in_ns(const char *name, const char *ns)
+{
+  std::ostringstream oss;
+  oss << name << " " << ns;
+  open_section(oss.str().c_str(), false);
+}
+
+void JSONFormatter::close_section()
+{
+  assert(!m_stack.empty());
+  finish_pending_string();
+
+  struct json_formatter_stack_entry_d& entry = m_stack.back();
+  if (m_pretty && entry.size) {
+    m_ss << "\n";
+    for (unsigned i = 1; i < m_stack.size(); i++)
+      m_ss << "    ";
+  }
+  m_ss << (entry.is_array ? ']' : '}');
+  m_stack.pop_back();
+}
+
+void JSONFormatter::finish_pending_string()
+{
+  if (m_is_pending_string) {
+    print_quoted_string(m_pending_string.str());
+    m_pending_string.str(std::string());
+    m_is_pending_string = false;
+  }
+}
+
+void JSONFormatter::dump_unsigned(const char *name, uint64_t u)
+{
+  print_name(name);
+  m_ss << u;
+}
+
+void JSONFormatter::dump_int(const char *name, int64_t s)
+{
+  print_name(name);
+  m_ss << s;
+}
+
+void JSONFormatter::dump_float(const char *name, double d)
+{
+  print_name(name);
+  char foo[30];
+  snprintf(foo, sizeof(foo), "%lf", d);
+  m_ss << foo;
+}
+
+void JSONFormatter::dump_string(const char *name, const std::string& s)
+{
+  print_name(name);
+  print_quoted_string(s);
+}
+
+std::ostream& JSONFormatter::dump_stream(const char *name)
+{
+  print_name(name);
+  m_is_pending_string = true;
+  return m_pending_string;
+}
+
+void JSONFormatter::dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap)
+{
+  char buf[LARGE_SIZE];
+  vsnprintf(buf, LARGE_SIZE, fmt, ap);
+
+  print_name(name);
+  if (quoted) {
+    print_quoted_string(std::string(buf));
+  } else {
+    m_ss << std::string(buf);
+  }
+}
+
+int JSONFormatter::get_len() const
+{
+  return m_ss.str().size();
+}
+
+void JSONFormatter::write_raw_data(const char *data)
+{
+  m_ss << data;
+}
+
+const char *XMLFormatter::XML_1_DTD =
+  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+
+XMLFormatter::XMLFormatter(bool pretty)
+: m_pretty(pretty)
+{
+  reset();
+}
+
+void XMLFormatter::flush(std::ostream& os)
+{
+  finish_pending_string();
+  os << m_ss.str();
+  if (m_pretty)
+    os << "\n";
+  m_ss.clear();
+  m_ss.str("");
+}
+
+void XMLFormatter::reset()
+{
+  m_ss.clear();
+  m_ss.str("");
+  m_pending_string.clear();
+  m_pending_string.str("");
+  m_sections.clear();
+  m_pending_string_name.clear();
+}
+
+void XMLFormatter::open_object_section(const char *name)
+{
+  open_section_in_ns(name, NULL, NULL);
+}
+
+void XMLFormatter::open_object_section_with_attrs(const char *name, const FormatterAttrs& attrs)
+{
+  open_section_in_ns(name, NULL, &attrs);
+}
+
+void XMLFormatter::open_object_section_in_ns(const char *name, const char *ns)
+{
+  open_section_in_ns(name, ns, NULL);
+}
+
+void XMLFormatter::open_array_section(const char *name)
+{
+  open_section_in_ns(name, NULL, NULL);
+}
+
+void XMLFormatter::open_array_section_with_attrs(const char *name, const FormatterAttrs& attrs)
+{
+  open_section_in_ns(name, NULL, &attrs);
+}
+
+void XMLFormatter::open_array_section_in_ns(const char *name, const char *ns)
+{
+  open_section_in_ns(name, ns, NULL);
+}
+
+void XMLFormatter::close_section()
+{
+  assert(!m_sections.empty());
+  finish_pending_string();
+
+  std::string section = m_sections.back();
+  m_sections.pop_back();
+  print_spaces();
+  m_ss << "</" << section << ">";
+  if (m_pretty)
+    m_ss << "\n";
+}
+
+void XMLFormatter::dump_unsigned(const char *name, uint64_t u)
+{
+  std::string e(name);
+  print_spaces();
+  m_ss << "<" << e << ">" << u << "</" << e << ">";
+  if (m_pretty)
+    m_ss << "\n";
+}
+
+void XMLFormatter::dump_int(const char *name, int64_t u)
+{
+  std::string e(name);
+  print_spaces();
+  m_ss << "<" << e << ">" << u << "</" << e << ">";
+  if (m_pretty)
+    m_ss << "\n";
+}
+
+void XMLFormatter::dump_float(const char *name, double d)
+{
+  std::string e(name);
+  print_spaces();
+  m_ss << "<" << e << ">" << d << "</" << e << ">";
+  if (m_pretty)
+    m_ss << "\n";
+}
+
+void XMLFormatter::dump_string(const char *name, const std::string& s)
+{
+  std::string e(name);
+  print_spaces();
+  m_ss << "<" << e << ">" << escape_xml_str(s.c_str()) << "</" << e << ">";
+  if (m_pretty)
+    m_ss << "\n";
+}
+
+void XMLFormatter::dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs)
+{
+  std::string e(name);
+  std::string attrs_str;
+  get_attrs_str(&attrs, attrs_str);
+  print_spaces();
+  m_ss << "<" << e << attrs_str << ">" << escape_xml_str(s.c_str()) << "</" << e << ">";
+  if (m_pretty)
+    m_ss << "\n";
+}
+
+std::ostream& XMLFormatter::dump_stream(const char *name)
+{
+  print_spaces();
+  m_pending_string_name = name;
+  m_ss << "<" << m_pending_string_name << ">";
+  return m_pending_string;
+}
+
+void XMLFormatter::dump_format_va(const char* name, const char *ns, bool quoted, const char *fmt, va_list ap)
+{
+  char buf[LARGE_SIZE];
+  vsnprintf(buf, LARGE_SIZE, fmt, ap);
+
+  std::string e(name);
+  print_spaces();
+  if (ns) {
+    m_ss << "<" << e << " xmlns=\"" << ns << "\">" << buf << "</" << e << ">";
+  } else {
+    m_ss << "<" << e << ">" << escape_xml_str(buf) << "</" << e << ">";
+  }
+
+  if (m_pretty)
+    m_ss << "\n";
+}
+
+int XMLFormatter::get_len() const
+{
+  return m_ss.str().size();
+}
+
+void XMLFormatter::write_raw_data(const char *data)
+{
+  m_ss << data;
+}
+
+void XMLFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str)
+{
+  std::stringstream attrs_ss;
+
+  for (std::list<std::pair<std::string, std::string> >::const_iterator iter = attrs->attrs.begin();
+       iter != attrs->attrs.end(); ++iter) {
+    std::pair<std::string, std::string> p = *iter;
+    attrs_ss << " " << p.first << "=" << "\"" << p.second << "\"";
+  }
+
+  attrs_str = attrs_ss.str();
+}
+
+void XMLFormatter::open_section_in_ns(const char *name, const char *ns, const FormatterAttrs *attrs)
+{
+  print_spaces();
+  std::string attrs_str;
+
+  if (attrs) {
+    get_attrs_str(attrs, attrs_str);
+  }
+
+  if (ns) {
+    m_ss << "<" << name << attrs_str << " xmlns=\"" << ns << "\">";
+  } else {
+    m_ss << "<" << name << attrs_str << ">";
+  }
+  if (m_pretty)
+    m_ss << "\n";
+  m_sections.push_back(name);
+}
+
+void XMLFormatter::finish_pending_string()
+{
+  if (!m_pending_string_name.empty()) {
+    m_ss << escape_xml_str(m_pending_string.str().c_str())
+      << "</" << m_pending_string_name << ">";
+    m_pending_string_name.clear();
+    m_pending_string.str(std::string());
+    if (m_pretty) {
+      m_ss << "\n";
+    }
+  }
+}
+
+void XMLFormatter::print_spaces()
+{
+  finish_pending_string();
+  if (m_pretty) {
+    std::string spaces(m_sections.size(), ' ');
+    m_ss << spaces;
+  }
+}
+
+std::string XMLFormatter::escape_xml_str(const char *str)
+{
+  int len = escape_xml_attr_len(str);
+  std::vector<char> escaped(len, '\0');
+  escape_xml_attr(str, &escaped[0]);
+  return std::string(&escaped[0]);
+}
+
+TableFormatter::TableFormatter(bool keyval) : m_keyval(keyval)
+{
+  reset();
+}
+
+void TableFormatter::flush(std::ostream& os)
+{
+  finish_pending_string();
+  std::vector<size_t> column_size = m_column_size;
+  std::vector<std::string> column_name = m_column_name;
+
+  std::set<int> need_header_set;
+
+  // auto-sizing columns
+  for (size_t i = 0; i < m_vec.size(); i++) {
+    for (size_t j = 0; j < m_vec[i].size(); j++) {
+      column_size.resize(m_vec[i].size());
+      column_name.resize(m_vec[i].size());
+      if (i > 0) {
+        if (m_vec[i - 1][j] != m_vec[i][j]) {
+          // changing row labels require to show the header
+          need_header_set.insert(i);
+          column_name[i] = m_vec[i][j].first;
+        }
+      } else {
+        column_name[i] = m_vec[i][j].first;
+      }
+
+      if (m_vec[i][j].second.length() > column_size[j])
+        column_size[j] = m_vec[i][j].second.length();
+      if (m_vec[i][j].first.length() > column_size[j])
+        column_size[j] = m_vec[i][j].first.length();
+    }
+  }
+
+  bool need_header = false;
+  if ((column_size.size() == m_column_size.size())) {
+    for (size_t i = 0; i < column_size.size(); i++) {
+      if (column_size[i] != m_column_size[i]) {
+        need_header = true;
+        break;
+      }
+    }
+  } else {
+    need_header = true;
+  }
+
+  if (need_header) {
+    // first row always needs a header if there wasn't one before
+    need_header_set.insert(0);
+  }
+
+  m_column_size = column_size;
+  for (size_t i = 0; i < m_vec.size(); i++) {
+    if (i == 0) {
+      if (need_header_set.count(i)) {
+        // print the header
+        if (!m_keyval) {
+          os << "+";
+          for (size_t j = 0; j < m_vec[i].size(); j++) {
+            for (size_t v = 0; v < m_column_size[j] + 3; v++)
+              os << "-";
+            os << "+";
+          }
+          os << "\n";
+          os << "|";
+
+          for (size_t j = 0; j < m_vec[i].size(); j++) {
+            os << " ";
+            std::stringstream fs;
+            fs << boost::format("%%-%is") % (m_column_size[j] + 2);
+            os << boost::format(fs.str()) % m_vec[i][j].first;
+            os << "|";
+          }
+          os << "\n";
+          os << "+";
+          for (size_t j = 0; j < m_vec[i].size(); j++) {
+            for (size_t v = 0; v < m_column_size[j] + 3; v++)
+              os << "-";
+            os << "+";
+          }
+          os << "\n";
+        }
+      }
+    }
+    // print body
+    if (!m_keyval)
+      os << "|";
+    for (size_t j = 0; j < m_vec[i].size(); j++) {
+      if (!m_keyval)
+        os << " ";
+      std::stringstream fs;
+
+      if (m_keyval) {
+        os << "key::";
+        os << m_vec[i][j].first;
+        os << "=";
+        os << "\"";
+        os << m_vec[i][j].second;
+        os << "\" ";
+      } else {
+        fs << boost::format("%%-%is") % (m_column_size[j] + 2);
+        os << boost::format(fs.str()) % m_vec[i][j].second;
+        os << "|";
+      }
+    }
+
+    os << "\n";
+    if (!m_keyval) {
+      if (i == (m_vec.size() - 1)) {
+        // print trailer
+        os << "+";
+        for (size_t j = 0; j < m_vec[i].size(); j++) {
+          for (size_t v = 0; v < m_column_size[j] + 3; v++)
+            os << "-";
+          os << "+";
+        }
+        os << "\n";
+      }
+    }
+    m_vec[i].clear();
+  }
+  m_vec.clear();
+}
+
+void TableFormatter::reset()
+{
+  m_ss.clear();
+  m_ss.str("");
+  m_section_cnt.clear();
+  m_column_size.clear();
+  m_section_open = 0;
+}
+
+void TableFormatter::open_object_section(const char *name)
+{
+  open_section_in_ns(name, NULL, NULL);
+}
+
+void TableFormatter::open_object_section_with_attrs(const char *name, const FormatterAttrs& attrs)
+{
+  open_section_in_ns(name, NULL, NULL);
+}
+
+void TableFormatter::open_object_section_in_ns(const char *name, const char *ns)
+{
+  open_section_in_ns(name, NULL, NULL);
+}
+
+void TableFormatter::open_array_section(const char *name)
+{
+  open_section_in_ns(name, NULL, NULL);
+}
+
+void TableFormatter::open_array_section_with_attrs(const char *name, const FormatterAttrs& attrs)
+{
+  open_section_in_ns(name, NULL, NULL);
+}
+
+void TableFormatter::open_array_section_in_ns(const char *name, const char *ns)
+{
+  open_section_in_ns(name, NULL, NULL);
+}
+
+void TableFormatter::open_section_in_ns(const char *name, const char *ns, const FormatterAttrs *attrs)
+{
+  m_section.push_back(name);
+  m_section_open++;
+}
+
+void TableFormatter::close_section()
+{
+  //
+  m_section_open--;
+  if (m_section.size()) {
+    m_section_cnt[m_section.back()] = 0;
+    m_section.pop_back();
+  }
+}
+
+size_t TableFormatter::m_vec_index(const char *name)
+{
+  std::string key(name);
+
+  size_t i = m_vec.size();
+  if (i)
+    i--;
+
+  // make sure there are vectors to push back key/val pairs
+  if (!m_vec.size())
+    m_vec.resize(1);
+
+  if (m_vec.size()) {
+    if (m_vec[i].size()) {
+      if (m_vec[i][0].first == key) {
+        // start a new column if a key is repeated
+        m_vec.resize(m_vec.size() + 1);
+        i++;
+      }
+    }
+  }
+
+  return i;
+}
+
+std::string TableFormatter::get_section_name(const char* name)
+{
+  std::string t_name = name;
+  for (size_t i = 0; i < m_section.size(); i++) {
+    t_name.insert(0, ":");
+    t_name.insert(0, m_section[i]);
+  }
+  if (m_section_open) {
+    std::stringstream lss;
+    lss << t_name;
+    lss << "[";
+    lss << m_section_cnt[t_name]++;
+    lss << "]";
+    return lss.str();
+  } else {
+    return t_name;
+  }
+}
+
+void TableFormatter::dump_unsigned(const char *name, uint64_t u)
+{
+  finish_pending_string();
+  size_t i = m_vec_index(name);
+  m_ss << u;
+  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
+  m_ss.clear();
+  m_ss.str("");
+}
+
+void TableFormatter::dump_int(const char *name, int64_t u)
+{
+  finish_pending_string();
+  size_t i = m_vec_index(name);
+  m_ss << u;
+  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
+  m_ss.clear();
+  m_ss.str("");
+}
+
+void TableFormatter::dump_float(const char *name, double d)
+{
+  finish_pending_string();
+  size_t i = m_vec_index(name);
+  m_ss << d;
+
+  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
+  m_ss.clear();
+  m_ss.str("");
+}
+
+void TableFormatter::dump_string(const char *name, const std::string& s)
+{
+  finish_pending_string();
+  size_t i = m_vec_index(name);
+  m_ss << s;
+
+  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
+  m_ss.clear();
+  m_ss.str("");
+}
+
+void TableFormatter::dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs)
+{
+  finish_pending_string();
+  size_t i = m_vec_index(name);
+
+  std::string attrs_str;
+  get_attrs_str(&attrs, attrs_str);
+  m_ss << attrs_str << s;
+
+  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
+  m_ss.clear();
+  m_ss.str("");
+}
+
+void TableFormatter::dump_format_va(const char* name, const char *ns, bool quoted, const char *fmt, va_list ap)
+{
+  finish_pending_string();
+  char buf[LARGE_SIZE];
+  vsnprintf(buf, LARGE_SIZE, fmt, ap);
+
+  size_t i = m_vec_index(name);
+  if (ns) {
+    m_ss << ns << "." << buf;
+  } else
+    m_ss << buf;
+
+  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
+  m_ss.clear();
+  m_ss.str("");
+}
+
+std::ostream& TableFormatter::dump_stream(const char *name)
+{
+  finish_pending_string();
+  // we don't support this
+  m_pending_name = name;
+  return m_ss;
+}
+
+int TableFormatter::get_len() const
+{
+  // we don't know the size until flush is called
+  return 0;
+}
+
+void TableFormatter::write_raw_data(const char *data) {
+  // not supported
+}
+
+void TableFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str)
+{
+  std::stringstream attrs_ss;
+
+  for (std::list<std::pair<std::string, std::string> >::const_iterator iter = attrs->attrs.begin();
+       iter != attrs->attrs.end(); ++iter) {
+    std::pair<std::string, std::string> p = *iter;
+    attrs_ss << " " << p.first << "=" << "\"" << p.second << "\"";
+  }
+
+  attrs_str = attrs_ss.str();
+}
+
+void TableFormatter::finish_pending_string()
+{
+  if (m_pending_name.length()) {
+    std::string ss = m_ss.str();
+    m_ss.clear();
+    m_ss.str("");
+    std::string pending_name = m_pending_name;
+    m_pending_name = "";
+    dump_string(pending_name.c_str(), ss);
+  }
+}
+}
+
index 11aea283663ab169bb4fc044ad3f1a103f642fef..b251aa6f468491af0807e4ebaf2f681592446603 100644 (file)
@@ -94,5 +94,128 @@ namespace ceph {
     }
   };
 
+  class JSONFormatter : public Formatter {
+  public:
+    JSONFormatter(bool p = false);
+
+    void flush(std::ostream& os);
+    void reset();
+    virtual void open_array_section(const char *name);
+    void open_array_section_in_ns(const char *name, const char *ns);
+    void open_object_section(const char *name);
+    void open_object_section_in_ns(const char *name, const char *ns);
+    void close_section();
+    void dump_unsigned(const char *name, uint64_t u);
+    void dump_int(const char *name, int64_t u);
+    void dump_float(const char *name, double d);
+    void dump_string(const char *name, const std::string& s);
+    std::ostream& dump_stream(const char *name);
+    void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap);
+    int get_len() const;
+    void write_raw_data(const char *data);
+
+  private:
+
+    struct json_formatter_stack_entry_d {
+      int size;
+      bool is_array;
+      json_formatter_stack_entry_d() : size(0), is_array(false) { }
+    };
+
+    bool m_pretty;
+    void open_section(const char *name, bool is_array);
+    void print_quoted_string(const std::string& s);
+    void print_name(const char *name);
+    void print_comma(json_formatter_stack_entry_d& entry);
+    void finish_pending_string();
+
+    std::stringstream m_ss, m_pending_string;
+    std::list<json_formatter_stack_entry_d> m_stack;
+    bool m_is_pending_string;
+  };
+
+  class XMLFormatter : public Formatter {
+  public:
+    static const char *XML_1_DTD;
+    XMLFormatter(bool pretty = false);
+
+    void flush(std::ostream& os);
+    void reset();
+    void open_array_section(const char *name);
+    void open_array_section_in_ns(const char *name, const char *ns);
+    void open_object_section(const char *name);
+    void open_object_section_in_ns(const char *name, const char *ns);
+    void close_section();
+    void dump_unsigned(const char *name, uint64_t u);
+    void dump_int(const char *name, int64_t u);
+    void dump_float(const char *name, double d);
+    void dump_string(const char *name, const std::string& s);
+    std::ostream& dump_stream(const char *name);
+    void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap);
+    int get_len() const;
+    void write_raw_data(const char *data);
+
+    /* with attrs */
+    void open_array_section_with_attrs(const char *name, const FormatterAttrs& attrs);
+    void open_object_section_with_attrs(const char *name, const FormatterAttrs& attrs);
+    void dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs);
+  private:
+    void open_section_in_ns(const char *name, const char *ns, const FormatterAttrs *attrs);
+    void finish_pending_string();
+    void print_spaces();
+    static std::string escape_xml_str(const char *str);
+    void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str);
+
+    std::stringstream m_ss, m_pending_string;
+    std::deque<std::string> m_sections;
+    bool m_pretty;
+    std::string m_pending_string_name;
+  };
+
+  class TableFormatter : public Formatter {
+  public:
+    TableFormatter(bool keyval = false);
+
+    void flush(std::ostream& os);
+    void reset();
+    virtual void open_array_section(const char *name);
+    void open_array_section_in_ns(const char *name, const char *ns);
+    void open_object_section(const char *name);
+    void open_object_section_in_ns(const char *name, const char *ns);
+
+    void open_array_section_with_attrs(const char *name, const FormatterAttrs& attrs);
+    void open_object_section_with_attrs(const char *name, const FormatterAttrs& attrs);
+
+    void close_section();
+    void dump_unsigned(const char *name, uint64_t u);
+    void dump_int(const char *name, int64_t u);
+    void dump_float(const char *name, double d);
+    void dump_string(const char *name, const std::string& s);
+    void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap);
+    void dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs);
+    std::ostream& dump_stream(const char *name);
+
+    int get_len() const;
+    void write_raw_data(const char *data);
+    void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str);
+
+  private:
+    void open_section_in_ns(const char *name, const char *ns, const FormatterAttrs *attrs);
+    std::vector< std::vector<std::pair<std::string, std::string> > > m_vec;
+    std::stringstream m_ss;
+    size_t m_vec_index(const char* name);
+    std::string get_section_name(const char* name);
+    void finish_pending_string();
+    std::string m_pending_name;
+    bool m_keyval;
+
+    int m_section_open;
+    std::vector< std::string > m_section;
+    std::map<std::string, int> m_section_cnt;
+    std::vector<size_t> m_column_size;
+    std::vector< std::string > m_column_name;
+  };
+
+
 }
 #endif
diff --git a/src/common/JSONFormatter.cc b/src/common/JSONFormatter.cc
deleted file mode 100644 (file)
index 8bf5007..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2011 New Dream Network
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-
-#define LARGE_SIZE 1024
-
-#include "include/int_types.h"
-
-#include "assert.h"
-#include "Formatter.h"
-#include "JSONFormatter.h"
-#include "common/escape.h"
-
-#include <iostream>
-#include <sstream>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <vector>
-#include <string>
-#include <set>
-#include <boost/format.hpp>
-
-// -----------------------
-namespace ceph {
-
-JSONFormatter::JSONFormatter(bool p)
-: m_pretty(p), m_is_pending_string(false)
-{
-  reset();
-}
-
-void JSONFormatter::flush(std::ostream& os)
-{
-  finish_pending_string();
-  os << m_ss.str();
-  if (m_pretty)
-    os << "\n";
-  m_ss.clear();
-  m_ss.str("");
-}
-
-void JSONFormatter::reset()
-{
-  m_stack.clear();
-  m_ss.clear();
-  m_ss.str("");
-  m_pending_string.clear();
-  m_pending_string.str("");
-}
-
-void JSONFormatter::print_comma(json_formatter_stack_entry_d& entry)
-{
-  if (entry.size) {
-    if (m_pretty) {
-      m_ss << ",\n";
-      for (unsigned i = 1; i < m_stack.size(); i++)
-        m_ss << "    ";
-    } else {
-      m_ss << ",";
-    }
-  } else if (m_pretty) {
-    m_ss << "\n";
-    for (unsigned i = 1; i < m_stack.size(); i++)
-      m_ss << "    ";
-  }
-  if (m_pretty && entry.is_array)
-    m_ss << "    ";
-}
-
-void JSONFormatter::print_quoted_string(const std::string& s)
-{
-  int len = escape_json_attr_len(s.c_str(), s.size());
-  char escaped[len];
-  escape_json_attr(s.c_str(), s.size(), escaped);
-  m_ss << '\"' << escaped << '\"';
-}
-
-void JSONFormatter::print_name(const char *name)
-{
-  finish_pending_string();
-  if (m_stack.empty())
-    return;
-  struct json_formatter_stack_entry_d& entry = m_stack.back();
-  print_comma(entry);
-  if (!entry.is_array) {
-    if (m_pretty) {
-      m_ss << "    ";
-    }
-    m_ss << "\"" << name << "\"";
-    if (m_pretty)
-      m_ss << ": ";
-    else
-      m_ss << ':';
-  }
-  ++entry.size;
-}
-
-void JSONFormatter::open_section(const char *name, bool is_array)
-{
-  print_name(name);
-  if (is_array)
-    m_ss << '[';
-  else
-    m_ss << '{';
-
-  json_formatter_stack_entry_d n;
-  n.is_array = is_array;
-  m_stack.push_back(n);
-}
-
-void JSONFormatter::open_array_section(const char *name)
-{
-  open_section(name, true);
-}
-
-void JSONFormatter::open_array_section_in_ns(const char *name, const char *ns)
-{
-  std::ostringstream oss;
-  oss << name << " " << ns;
-  open_section(oss.str().c_str(), true);
-}
-
-void JSONFormatter::open_object_section(const char *name)
-{
-  open_section(name, false);
-}
-
-void JSONFormatter::open_object_section_in_ns(const char *name, const char *ns)
-{
-  std::ostringstream oss;
-  oss << name << " " << ns;
-  open_section(oss.str().c_str(), false);
-}
-
-void JSONFormatter::close_section()
-{
-  assert(!m_stack.empty());
-  finish_pending_string();
-
-  struct json_formatter_stack_entry_d& entry = m_stack.back();
-  if (m_pretty && entry.size) {
-    m_ss << "\n";
-    for (unsigned i = 1; i < m_stack.size(); i++)
-      m_ss << "    ";
-  }
-  m_ss << (entry.is_array ? ']' : '}');
-  m_stack.pop_back();
-}
-
-void JSONFormatter::finish_pending_string()
-{
-  if (m_is_pending_string) {
-    print_quoted_string(m_pending_string.str());
-    m_pending_string.str(std::string());
-    m_is_pending_string = false;
-  }
-}
-
-void JSONFormatter::dump_unsigned(const char *name, uint64_t u)
-{
-  print_name(name);
-  m_ss << u;
-}
-
-void JSONFormatter::dump_int(const char *name, int64_t s)
-{
-  print_name(name);
-  m_ss << s;
-}
-
-void JSONFormatter::dump_float(const char *name, double d)
-{
-  print_name(name);
-  char foo[30];
-  snprintf(foo, sizeof(foo), "%lf", d);
-  m_ss << foo;
-}
-
-void JSONFormatter::dump_string(const char *name, const std::string& s)
-{
-  print_name(name);
-  print_quoted_string(s);
-}
-
-std::ostream& JSONFormatter::dump_stream(const char *name)
-{
-  print_name(name);
-  m_is_pending_string = true;
-  return m_pending_string;
-}
-
-void JSONFormatter::dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap)
-{
-  char buf[LARGE_SIZE];
-  vsnprintf(buf, LARGE_SIZE, fmt, ap);
-
-  print_name(name);
-  if (quoted) {
-    print_quoted_string(std::string(buf));
-  } else {
-    m_ss << std::string(buf);
-  }
-}
-
-int JSONFormatter::get_len() const
-{
-  return m_ss.str().size();
-}
-
-void JSONFormatter::write_raw_data(const char *data)
-{
-  m_ss << data;
-}
-
-} // namespace ceph
index 5f3c6e1f058623bb7981505b156a30f0f3e18be3..6b93ecbd9e8ad29c8d3afd26c52b68f5e10a75a4 100644 (file)
@@ -45,10 +45,7 @@ libcommon_internal_la_SOURCES = \
        common/simple_spin.cc \
        common/Thread.cc \
        common/Formatter.cc \
-       common/XMLFormatter.cc \
        common/HTMLFormatter.cc \
-       common/JSONFormatter.cc \
-       common/TableFormatter.cc \
        common/HeartbeatMap.cc \
        common/config.cc \
        common/utf8.c \
@@ -182,9 +179,6 @@ noinst_HEADERS += \
        common/DecayCounter.h \
        common/Finisher.h \
        common/Formatter.h \
-       common/JSONFormatter.h \
-       common/TableFormatter.h \
-       common/XMLFormatter.h \
        common/HTMLFormatter.h \
        common/perf_counters.h \
        common/OutputDataSocket.h \
diff --git a/src/common/TableFormatter.cc b/src/common/TableFormatter.cc
deleted file mode 100644 (file)
index 4be4e39..0000000
+++ /dev/null
@@ -1,376 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2011 New Dream Network
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-
-#define LARGE_SIZE 1024
-
-#include "include/int_types.h"
-
-#include "assert.h"
-#include "Formatter.h"
-#include "TableFormatter.h"
-#include "common/escape.h"
-
-#include <iostream>
-#include <sstream>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <vector>
-#include <string>
-#include <set>
-#include <boost/format.hpp>
-
-// -----------------------
-namespace ceph {
-TableFormatter::TableFormatter(bool keyval) : m_keyval(keyval)
-{
-  reset();
-}
-
-void TableFormatter::flush(std::ostream& os)
-{
-  finish_pending_string();
-  std::vector<size_t> column_size = m_column_size;
-  std::vector<std::string> column_name = m_column_name;
-
-  std::set<int> need_header_set;
-
-  // auto-sizing columns
-  for (size_t i = 0; i < m_vec.size(); i++) {
-    for (size_t j = 0; j < m_vec[i].size(); j++) {
-      column_size.resize(m_vec[i].size());
-      column_name.resize(m_vec[i].size());
-      if (i > 0) {
-        if (m_vec[i - 1][j] != m_vec[i][j]) {
-          // changing row labels require to show the header
-          need_header_set.insert(i);
-          column_name[i] = m_vec[i][j].first;
-        }
-      } else {
-        column_name[i] = m_vec[i][j].first;
-      }
-
-      if (m_vec[i][j].second.length() > column_size[j])
-        column_size[j] = m_vec[i][j].second.length();
-      if (m_vec[i][j].first.length() > column_size[j])
-        column_size[j] = m_vec[i][j].first.length();
-    }
-  }
-
-  bool need_header = false;
-  if ((column_size.size() == m_column_size.size())) {
-    for (size_t i = 0; i < column_size.size(); i++) {
-      if (column_size[i] != m_column_size[i]) {
-        need_header = true;
-        break;
-      }
-    }
-  } else {
-    need_header = true;
-  }
-
-  if (need_header) {
-    // first row always needs a header if there wasn't one before
-    need_header_set.insert(0);
-  }
-
-  m_column_size = column_size;
-  for (size_t i = 0; i < m_vec.size(); i++) {
-    if (i == 0) {
-      if (need_header_set.count(i)) {
-        // print the header
-        if (!m_keyval) {
-          os << "+";
-          for (size_t j = 0; j < m_vec[i].size(); j++) {
-            for (size_t v = 0; v < m_column_size[j] + 3; v++)
-              os << "-";
-            os << "+";
-          }
-          os << "\n";
-          os << "|";
-
-          for (size_t j = 0; j < m_vec[i].size(); j++) {
-            os << " ";
-            std::stringstream fs;
-            fs << boost::format("%%-%is") % (m_column_size[j] + 2);
-            os << boost::format(fs.str()) % m_vec[i][j].first;
-            os << "|";
-          }
-          os << "\n";
-          os << "+";
-          for (size_t j = 0; j < m_vec[i].size(); j++) {
-            for (size_t v = 0; v < m_column_size[j] + 3; v++)
-              os << "-";
-            os << "+";
-          }
-          os << "\n";
-        }
-      }
-    }
-    // print body
-    if (!m_keyval)
-      os << "|";
-    for (size_t j = 0; j < m_vec[i].size(); j++) {
-      if (!m_keyval)
-        os << " ";
-      std::stringstream fs;
-
-      if (m_keyval) {
-        os << "key::";
-        os << m_vec[i][j].first;
-        os << "=";
-        os << "\"";
-        os << m_vec[i][j].second;
-        os << "\" ";
-      } else {
-        fs << boost::format("%%-%is") % (m_column_size[j] + 2);
-        os << boost::format(fs.str()) % m_vec[i][j].second;
-        os << "|";
-      }
-    }
-
-    os << "\n";
-    if (!m_keyval) {
-      if (i == (m_vec.size() - 1)) {
-        // print trailer
-        os << "+";
-        for (size_t j = 0; j < m_vec[i].size(); j++) {
-          for (size_t v = 0; v < m_column_size[j] + 3; v++)
-            os << "-";
-          os << "+";
-        }
-        os << "\n";
-      }
-    }
-    m_vec[i].clear();
-  }
-  m_vec.clear();
-}
-
-void TableFormatter::reset()
-{
-  m_ss.clear();
-  m_ss.str("");
-  m_section_cnt.clear();
-  m_column_size.clear();
-  m_section_open = 0;
-}
-
-void TableFormatter::open_object_section(const char *name)
-{
-  open_section_in_ns(name, NULL, NULL);
-}
-
-void TableFormatter::open_object_section_with_attrs(const char *name, const FormatterAttrs& attrs)
-{
-  open_section_in_ns(name, NULL, NULL);
-}
-
-void TableFormatter::open_object_section_in_ns(const char *name, const char *ns)
-{
-  open_section_in_ns(name, NULL, NULL);
-}
-
-void TableFormatter::open_array_section(const char *name)
-{
-  open_section_in_ns(name, NULL, NULL);
-}
-
-void TableFormatter::open_array_section_with_attrs(const char *name, const FormatterAttrs& attrs)
-{
-  open_section_in_ns(name, NULL, NULL);
-}
-
-void TableFormatter::open_array_section_in_ns(const char *name, const char *ns)
-{
-  open_section_in_ns(name, NULL, NULL);
-}
-
-void TableFormatter::open_section_in_ns(const char *name, const char *ns, const FormatterAttrs *attrs)
-{
-  m_section.push_back(name);
-  m_section_open++;
-}
-
-void TableFormatter::close_section()
-{
-  //
-  m_section_open--;
-  if (m_section.size()) {
-    m_section_cnt[m_section.back()] = 0;
-    m_section.pop_back();
-  }
-}
-
-size_t TableFormatter::m_vec_index(const char *name)
-{
-  std::string key(name);
-
-  size_t i = m_vec.size();
-  if (i)
-    i--;
-
-  // make sure there are vectors to push back key/val pairs
-  if (!m_vec.size())
-    m_vec.resize(1);
-
-  if (m_vec.size()) {
-    if (m_vec[i].size()) {
-      if (m_vec[i][0].first == key) {
-        // start a new column if a key is repeated
-        m_vec.resize(m_vec.size() + 1);
-        i++;
-      }
-    }
-  }
-
-  return i;
-}
-
-std::string TableFormatter::get_section_name(const char* name)
-{
-  std::string t_name = name;
-  for (size_t i = 0; i < m_section.size(); i++) {
-    t_name.insert(0, ":");
-    t_name.insert(0, m_section[i]);
-  }
-  if (m_section_open) {
-    std::stringstream lss;
-    lss << t_name;
-    lss << "[";
-    lss << m_section_cnt[t_name]++;
-    lss << "]";
-    return lss.str();
-  } else {
-    return t_name;
-  }
-}
-
-void TableFormatter::dump_unsigned(const char *name, uint64_t u)
-{
-  finish_pending_string();
-  size_t i = m_vec_index(name);
-  m_ss << u;
-  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
-  m_ss.clear();
-  m_ss.str("");
-}
-
-void TableFormatter::dump_int(const char *name, int64_t u)
-{
-  finish_pending_string();
-  size_t i = m_vec_index(name);
-  m_ss << u;
-  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
-  m_ss.clear();
-  m_ss.str("");
-}
-
-void TableFormatter::dump_float(const char *name, double d)
-{
-  finish_pending_string();
-  size_t i = m_vec_index(name);
-  m_ss << d;
-
-  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
-  m_ss.clear();
-  m_ss.str("");
-}
-
-void TableFormatter::dump_string(const char *name, const std::string& s)
-{
-  finish_pending_string();
-  size_t i = m_vec_index(name);
-  m_ss << s;
-
-  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
-  m_ss.clear();
-  m_ss.str("");
-}
-
-void TableFormatter::dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs)
-{
-  finish_pending_string();
-  size_t i = m_vec_index(name);
-
-  std::string attrs_str;
-  get_attrs_str(&attrs, attrs_str);
-  m_ss << attrs_str << s;
-
-  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
-  m_ss.clear();
-  m_ss.str("");
-}
-
-void TableFormatter::dump_format_va(const char* name, const char *ns, bool quoted, const char *fmt, va_list ap)
-{
-  finish_pending_string();
-  char buf[LARGE_SIZE];
-  vsnprintf(buf, LARGE_SIZE, fmt, ap);
-
-  size_t i = m_vec_index(name);
-  if (ns) {
-    m_ss << ns << "." << buf;
-  } else
-    m_ss << buf;
-
-  m_vec[i].push_back(std::make_pair(get_section_name(name), m_ss.str()));
-  m_ss.clear();
-  m_ss.str("");
-}
-
-std::ostream& TableFormatter::dump_stream(const char *name)
-{
-  finish_pending_string();
-  // we don't support this
-  m_pending_name = name;
-  return m_ss;
-}
-
-int TableFormatter::get_len() const
-{
-  // we don't know the size until flush is called
-  return 0;
-}
-
-void TableFormatter::write_raw_data(const char *data) {
-  // not supported
-}
-
-void TableFormatter::get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str)
-{
-  std::stringstream attrs_ss;
-
-  for (std::list<std::pair<std::string, std::string> >::const_iterator iter = attrs->attrs.begin();
-       iter != attrs->attrs.end(); ++iter) {
-    std::pair<std::string, std::string> p = *iter;
-    attrs_ss << " " << p.first << "=" << "\"" << p.second << "\"";
-  }
-
-  attrs_str = attrs_ss.str();
-}
-
-void TableFormatter::finish_pending_string()
-{
-  if (m_pending_name.length()) {
-    std::string ss = m_ss.str();
-    m_ss.clear();
-    m_ss.str("");
-    std::string pending_name = m_pending_name;
-    m_pending_name = "";
-    dump_string(pending_name.c_str(), ss);
-  }
-}
-
-} // namespace ceph
index 17c8664ce7a98fc9641c96dcc1a346081f202c16..07a2246e9e552479eafe60e69b0ca214fee052de 100644 (file)
@@ -26,7 +26,6 @@
 #include "common/safe_io.h"
 #include "common/version.h"
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include <errno.h>
 #include <fcntl.h>
index 53121811d411758c3d935b732965533dbe97490d..1893dd4da5b178bbb58cb73e78f1399ab5463756 100644 (file)
@@ -23,7 +23,6 @@
 #include "common/signal.h"
 #include "common/ceph_argparse.h"
 #include "common/errno.h"
-#include "common/JSONFormatter.h"
 
 #include "msg/Messenger.h"
 #include "mon/MonClient.h"
index 3889caccd822ed013a603b3b4d7fb291c83da8f5..ae9aef3c0f932bc86373df30541a753648eb57ef 100644 (file)
@@ -14,8 +14,6 @@
 
 #include "common/debug.h"
 #include "common/errno.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "messages/MClientRequestForward.h"
 #include "messages/MMDSMap.h"
index 16fe7dae8e3a0592e3aff0c016eb798129068a66..64ed42ffc883fc5f4f310ad2b7d29c1d2a0997ba 100644 (file)
@@ -24,7 +24,6 @@
 #include "common/config.h"
 #include "common/cmdparse.h"
 #include "common/errno.h"
-#include "common/JSONFormatter.h"
 
 #define dout_subsys ceph_subsys_mon
 #undef dout_prefix
index bbe11265b56e5ce62cab24e346d9d91be7c5f6e5..dcfd5121e85debe1b6b7795f54799669734b9148 100644 (file)
@@ -61,8 +61,6 @@
 #include "common/errno.h"
 #include "common/perf_counters.h"
 #include "common/admin_socket.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "include/color.h"
 #include "include/ceph_fs.h"
index 16484d724cec9def88b6c1457b386fa61c2181ae..e0c8039257f5777f5a5542ecf95e567687b6b919 100644 (file)
@@ -23,7 +23,6 @@
 #include "include/assert.h"
 #include "include/stringify.h"
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #define dout_subsys ceph_subsys_paxos
 #undef dout_prefix
index 0302ccec24850319cf4395717812e404a7f4529f..9b9a732dbbcb9fe50dcec9c3d9b300aee397ffbc 100644 (file)
@@ -121,9 +121,6 @@ e 12v
 #include "common/perf_counters.h"
 #include <errno.h>
 
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
-
 #include "MonitorDBStore.h"
 #include "mon/MonOpRequest.h"
 
index 5345a6c728a8b04b3b2c5743dae22d52ebf21b7f..fb05152e8a418153c97c50b7f67dd1858d193031 100644 (file)
@@ -34,8 +34,6 @@
 
 #include "common/blkdev.h"
 #include "common/linux_version.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #if defined(__FreeBSD__)
 #define O_DSYNC O_SYNC
index 7675c106892cc1fd3ebc01bd6368781c1fc292f7..2483bd93a656503d89139c1b901a07ae6b9b9a5c 100644 (file)
@@ -67,8 +67,6 @@
 #include "common/perf_counters.h"
 #include "common/sync_filesystem.h"
 #include "common/fd.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 #include "HashIndex.h"
 #include "DBObjectMap.h"
 #include "KeyValueDB.h"
index 30186aeae4a5a89321b0544ffc61616d9ac688a9..2de2440d6fae1bb74c92d0b9a20a5a31f07ce183 100644 (file)
@@ -33,8 +33,6 @@ using namespace std;
 
 #include "common/Timer.h"
 #include "common/WorkQueue.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "common/Mutex.h"
 #include "HashIndex.h"
index f34f8ebb63aa5659485a5ae90c5f6ebb1f49bf72..1a633c6af777aa2bf13d235a25e1717eadb8aa01 100644 (file)
@@ -48,8 +48,6 @@
 #include "common/safe_io.h"
 #include "common/perf_counters.h"
 #include "common/sync_filesystem.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #ifdef HAVE_KINETIC
 #include "KineticStore.h"
index 52f63bbebe0ee682cc91b8e57e5d4a454ec0f97c..90e41ee85a171dd98a127799bfca737f55ed3a13 100644 (file)
@@ -33,7 +33,6 @@ using namespace std;
 #include "common/WorkQueue.h"
 #include "common/Finisher.h"
 #include "common/fd.h"
-#include "common/JSONFormatter.h"
 
 #include "common/Mutex.h"
 #include "GenericObjectMap.h"
index 8f59f30d5c505f6130cd57210816606bbe4e0019..b0aa2069d32bfb0bb60adc61c9ad19428e19592d 100644 (file)
@@ -26,8 +26,6 @@
 #include "include/unordered_map.h"
 #include "include/memory.h"
 #include "common/errno.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 #include "MemStore.h"
 #include "include/compat.h"
 
index c0b3b254cec1409bb615073761feece231ed644d..e2ab4a40152beb1fd8f96f129fc8c8f593183ba9 100644 (file)
@@ -42,8 +42,6 @@
 #include "common/ceph_argparse.h"
 #include "common/version.h"
 #include "common/io_priority.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "os/ObjectStore.h"
 
index 0d031d4873e7b17debcc408f42a30a2a412978b5..d308186871ded53e34c1dc33251c4df50d284d96 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "common/config.h"
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 #include "common/TextTable.h"
 #include "include/ceph_features.h"
 #include "include/str_map.h"
index bdf184cf19e644bcaf00460cadbcc60e96be9a24..ff9cf40064537554266130665c31250608cf8158 100755 (executable)
@@ -52,8 +52,6 @@
 #include "include/util.h"
 
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
-#include "common/XMLFormatter.h"
 #include "common/Throttle.h"
 
 #if defined(__linux__)
index 190e7041902a9a94e9cffa07625cbfcd69f2d44f..af82ecbbf770e4e50d06303975d56aceb0d1fb0d 100644 (file)
@@ -15,8 +15,6 @@ using namespace std;
 #include "common/config.h"
 #include "common/ceph_argparse.h"
 #include "common/Formatter.h"
-#include "common/XMLFormatter.h"
-#include "common/JSONFormatter.h"
 #include "common/errno.h"
 
 #include "global/global_init.h"
index 406e0b26b3da832732c8f753f85332a2c8561e02..3a9616006959e7d58c7c375850eb507096fca652 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <include/types.h>
 #include <common/Formatter.h>
-#include <common/XMLFormatter.h>
 #include "rgw_xml.h"
 #include "rgw_cors.h"
 
index 8531d866e7911d169f913b7504db780649775dd7..b4b709ce8c71ff325f8dce513f29d1e279f84c23 100644 (file)
@@ -10,7 +10,6 @@
 #include "include/types.h"
 
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 #include "common/ceph_json.h"
 
 #include "rgw_common.h"
index 4d362e26d5052945671b807a5968aaa92ad28cb2..795d78787327e984d00ef31835d09c355348d7a7 100644 (file)
@@ -6,7 +6,6 @@
 #include "common/utf8.h"
 #include "common/OutputDataSocket.h"
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "rgw_log.h"
 #include "rgw_acl.h"
index 31b8ca7531ea573f10d7198908740c84da14b543..d5ccb155fbf0f8edf622653a4f3d4528a0045ec9 100644 (file)
@@ -5,8 +5,6 @@
 #include <limits.h>
 
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
-#include "common/XMLFormatter.h"
 #include "common/HTMLFormatter.h"
 #include "common/utf8.h"
 #include "include/str_list.h"
index fc2538d73dd3c180d2f1f8a2b679a58c240e7cd5..e58122efe15ece9289e6de545c3ecff6d2e7f12f 100644 (file)
@@ -6,7 +6,6 @@
 
 #include "common/ceph_crypto.h"
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 #include "common/utf8.h"
 #include "common/ceph_json.h"
 
index ec4ae4b80e1f5918df44be022bb59e8467bde61a..0a8d373ca9d5e87ef857b06c507b0c0632002339 100644 (file)
@@ -6,7 +6,6 @@
 #include <unistd.h>
 
 #include "common/ceph_json.h"
-#include "common/JSONFormatter.h"
 #include "rgw_common.h"
 #include "rgw_swift.h"
 #include "rgw_swift_auth.h"
index 5311002ff858bf979f3c26e3e032142a7c63dec7..3e94e63a162baa7c0fca3efdda123c8b6d922565 100644 (file)
@@ -6,7 +6,6 @@
 
 #include "common/ceph_crypto.h"
 #include "common/Clock.h"
-#include "common/JSONFormatter.h"
 
 #include "auth/Crypto.h"
 
index dcdb0dd29232ece43f093c99220b0eea7ead51ff..fa98456ccbd860120127ac2e91a2088fb222606e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit dcdb0dd29232ece43f093c99220b0eea7ead51ff
+Subproject commit fa98456ccbd860120127ac2e91a2088fb222606e
index 657d6d0624a1d55abbfa688f3d40ea8ca15aca4d..2b200279c7a4bf2b9d183f84bbfa25346f4728bd 100644 (file)
@@ -14,7 +14,6 @@
 #include <fstream>
 
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "bencher.h"
 #include "rados_backend.h"
index 913e8c0a1a333fd9160e623c947546abf869b775..c9d9f51a9db57343ca6b2aa60e3c2749da78dda8 100644 (file)
@@ -16,7 +16,6 @@
 #include <fstream>
 
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "bencher.h"
 #include "rados_backend.h"
index bbc5e1e859613d3815caad52fe5841e704319955..4b273e410a8957df21a73014503a34fbeab4be1e 100644 (file)
@@ -14,7 +14,6 @@
 #include <fstream>
 
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "bencher.h"
 #include "rados_backend.h"
index 95193adf9b610b7c85ed11713ada7d20aad3bf6b..ba7071ed3833a040ceb4a9be63c44b63ee848473 100644 (file)
@@ -13,7 +13,6 @@
 #include <fstream>
 
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "bencher.h"
 #include "rbd_backend.h"
index 55ffdb8e048b104c1bd799ffc1ed7a8e8aa32934..23185a769777c527c19e4b891ba74a59450bc596 100644 (file)
@@ -14,7 +14,6 @@
 #include <fstream>
 
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "bencher.h"
 #include "rados_backend.h"
index c53b69f53652d13478d08db270996cac076f216b..88648f01d73b5e29992515d465aa171ae8e6b0fe 100644 (file)
@@ -1,6 +1,6 @@
 #include "gtest/gtest.h"
 
-#include "common/TableFormatter.h"
+#include "common/Formatter.h"
 #include <iostream>
 #include <sstream>
 #include <string>
index 1fafbd337072e04a53cfbebcaac021dcd6bc4d89..c46fa87ab5409b8c693053e6fcc2f8d012faa67e 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "include/stringify.h"
 #include "common/ceph_argparse.h"
-#include "common/JSONFormatter.h"
 #include "global/global_init.h"
 #include "global/global_context.h"
 
index b4ea5ceb566f01ddcdf0dd10b15adc54a576239f..7a30ebdb15aa97a287415663df719c5fe94a6e14 100644 (file)
@@ -20,7 +20,6 @@
 #include "include/ceph_features.h"
 #include "common/ceph_argparse.h"
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 #include "common/errno.h"
 #include "msg/Message.h"
 #include "include/assert.h"
index cf1e412758a2b2757de96348f35e1ad73226cc11..3913cc6f154208bfa0799113543a719957b0fd70 100644 (file)
@@ -13,8 +13,7 @@
  */
 
 #include "test/unit.h"
-#include "common/JSONFormatter.h"
-#include "common/XMLFormatter.h"
+#include "common/Formatter.h"
 #include "common/HTMLFormatter.h"
 
 #include <sstream>
index 9be1e31386b9c4047481b8ca4eced72f57b414c3..d12c5e850c0b159823f340b59ddc7d1f45e6c131 100644 (file)
@@ -20,7 +20,6 @@
 #include "global/global_context.h"
 #include "common/Mutex.h"
 #include "common/Cond.h"
-#include "common/JSONFormatter.h"
 
 #include <string>
 #include <climits>
index 36e36ba6c95da0ed92bae7819c308dd00b95212e..e18906d19314892b316e127171e004a5c42fe341 100644 (file)
@@ -51,7 +51,6 @@
 #include "auth/AuthAuthorizeHandler.h"
 #include "include/uuid.h"
 #include "include/assert.h"
-#include "common/JSONFormatter.h"
 
 #include "messages/MOSDBoot.h"
 #include "messages/MOSDAlive.h"
index a18f1d689ba2da96e2948b86bdfdac67b0b25933..5b0d6a66bdfb82fce7fa9099c95f423f219ad4b9 100644 (file)
@@ -30,8 +30,6 @@ extern "C"{
 #include "common/code_environment.h"
 #include "common/ceph_argparse.h"
 #include "common/Finisher.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 #include "global/global_init.h"
 #include "rgw/rgw_common.h"
 #include "rgw/rgw_rados.h"
index e03888ac256a5ab88d8d6deda2b174f63ada4cf6..a84cadcf69db70897937cfb8fd7fe3dfeee1fd6a 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "common/ceph_argparse.h"
 #include "global/global_init.h"
-#include "common/JSONFormatter.h"
+#include "common/Formatter.h"
 #include "common/debug.h"
 #include "common/errno.h"
 #include "client/Inode.h"
index f74f72c757012fb59c03bf72866ad2bbace69669..c979bcdabe38ed98bb9dfe8a4b5808e67966280b 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include <string>
 
-#include "common/JSONFormatter.h"
+#include "common/Formatter.h"
 #include "common/errno.h"
 
 #include "global/global_init.h"
index a827a42545d2e6197de62f3986c8ff5baf9b64d4..11de3bc32b4816ca7eb9b16c67958d6a4d03baf6 100644 (file)
@@ -19,7 +19,6 @@
 #include <stdlib.h>
 
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 #include "common/errno.h"
 #include "common/ceph_argparse.h"
 
index a273c511b5506f1e8d8534a46bbed163ac24e6d0..a93c099a918d1029f5a0db68a5023188d09abca5 100644 (file)
@@ -16,7 +16,6 @@
 #include <fstream>
 
 #include "common/errno.h"
-#include "common/JSONFormatter.h"
 #include "mds/mdstypes.h"
 #include "mds/events/EUpdate.h"
 #include "mds/LogEvent.h"
index 5a1eae109363507fcec3dbbd42889f6b08d6b69e..d07d48743e2df937b2f5c43db255c66d9c87826a 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "common/ceph_argparse.h"
 #include "common/errno.h"
-#include "common/JSONFormatter.h"
 #include "osdc/Journaler.h"
 #include "mds/mdstypes.h"
 #include "mds/LogEvent.h"
index 7eab1b43cf6f657f2e32d61386c6a286338c7bb1..99a0856d7f820dc220804e77d853abbdd13012e0 100644 (file)
@@ -14,8 +14,6 @@
 
 #include "common/ceph_argparse.h"
 #include "common/errno.h"
-#include "common/Formatter.h"
-#include "common/JSONFormatter.h"
 
 #include "mds/SessionMap.h"
 #include "mds/InoTable.h"
index d686c93ec54da7384359e779dbc5972bde1f669b..a1a31a647e62e7e51ada3905d67829e5322093af 100644 (file)
@@ -26,8 +26,6 @@ using namespace libradosstriper;
 #include "common/debug.h"
 #include "common/errno.h"
 #include "common/Formatter.h"
-#include "common/JSONFormatter.h"
-#include "common/XMLFormatter.h"
 #include "common/obj_bencher.h"
 #include "mds/inode_backtrace.h"
 #include "auth/Crypto.h"