]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
logging:Move LogEntry.h into common with LogClient
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 2 Dec 2010 18:54:09 +0000 (10:54 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 6 Dec 2010 23:30:17 +0000 (15:30 -0800)
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/Makefile.am
src/common/LogClient.h
src/common/LogEntry.h [new file with mode: 0644]
src/include/LogEntry.h [deleted file]
src/messages/MLog.h
src/messages/MLogAck.h
src/mon/LogMonitor.h
src/osd/OSD.h
src/tools/ceph.cc

index ea4dc3e0dda078e621057bb1aadedc70b5ab69bf..d0d650a35cac5cf4ecc61b93726f30b1e3cf6d4d 100644 (file)
@@ -591,6 +591,7 @@ noinst_HEADERS = \
         common/Timer.h\
         common/tls.h\
        common/WorkQueue.h\
+       common/LogEntry.h\
        common/LogClient.h\
         config.h\
         crush/CrushWrapper.h\
@@ -608,7 +609,6 @@ noinst_HEADERS = \
         include/Context.h\
        include/CompatSet.h\
         include/Distribution.h\
-       include/LogEntry.h\
        include/Spinlock.h\
        include/addr_parsing.h\
        include/assert.h\
index 4a0e1f3b87d9d316f9df04d4037c1013293a586d..aad5eb9d1adcb3f4ddc53d1410d8d57aab0ea6c7 100644 (file)
 #ifndef CEPH_LOGCLIENT_H
 #define CEPH_LOGCLIENT_H
 
-#include "msg/Dispatcher.h"
-
+#include "common/LogEntry.h"
 #include "common/Mutex.h"
-#include "include/LogEntry.h"
+#include "msg/Dispatcher.h"
 
 #include <iosfwd>
 #include <sstream>
diff --git a/src/common/LogEntry.h b/src/common/LogEntry.h
new file mode 100644 (file)
index 0000000..db5c2e7
--- /dev/null
@@ -0,0 +1,144 @@
+// -*- 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) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * 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.
+ * 
+ */
+
+#ifndef CEPH_LOGENTRY_H
+#define CEPH_LOGENTRY_H
+
+#include "include/types.h"
+#include "include/encoding.h"
+
+typedef enum {
+  CLOG_DEBUG = 0,
+  CLOG_INFO = 1,
+  CLOG_SEC = 2,
+  CLOG_WARN = 3,
+  CLOG_ERROR = 4,
+} clog_type;
+
+struct LogEntryKey {
+  entity_inst_t who;
+  utime_t stamp;
+  uint64_t seq;
+
+  LogEntryKey() {}
+  LogEntryKey(entity_inst_t w, utime_t t, uint64_t s) : who(w), stamp(t), seq(s) {}
+
+  void encode(bufferlist& bl) const {
+    ::encode(who, bl);
+    ::encode(stamp, bl);
+    ::encode(seq, bl);
+  }
+  void decode(bufferlist::iterator& bl) {
+    ::decode(who, bl);
+    ::decode(stamp, bl);
+    ::decode(seq, bl);
+  }
+};
+WRITE_CLASS_ENCODER(LogEntryKey)
+
+static inline bool operator==(const LogEntryKey& l, const LogEntryKey& r) {
+  return l.who == r.who && l.stamp == r.stamp && l.seq == r.seq;
+}
+
+struct LogEntry {
+  entity_inst_t who;
+  utime_t stamp;
+  uint64_t seq;
+  clog_type type;
+  string msg;
+
+  LogEntryKey key() const { return LogEntryKey(who, stamp, seq); }
+
+  void encode(bufferlist& bl) const {
+    __u8 v = 1;
+    ::encode(v, bl);
+    __u16 t = type;
+    ::encode(who, bl);
+    ::encode(stamp, bl);
+    ::encode(seq, bl);
+    ::encode(t, bl);
+    ::encode(msg, bl);
+  }
+  void decode(bufferlist::iterator& bl) {
+    __u8 v;
+    ::decode(v, bl);
+    __u16 t;
+    ::decode(who, bl);
+    ::decode(stamp, bl);
+    ::decode(seq, bl);
+    ::decode(t, bl);
+    type = (clog_type)t;
+    ::decode(msg, bl);
+  }
+};
+WRITE_CLASS_ENCODER(LogEntry)
+
+struct LogSummary {
+  version_t version;
+  list<LogEntry> tail;
+
+  LogSummary() : version(0) {}
+
+  void add(const LogEntry& e) {
+    tail.push_back(e);
+    while (tail.size() > 50)
+      tail.pop_front();
+  }
+  bool contains(LogEntryKey k) const {
+    for (list<LogEntry>::const_iterator p = tail.begin();
+        p != tail.end();
+        p++)
+      if (p->key() == k) return true;
+    return false;
+  }
+
+  void encode(bufferlist& bl) const {
+    __u8 v = 1;
+    ::encode(v, bl);
+    ::encode(version, bl);
+    ::encode(tail, bl);
+  }
+  void decode(bufferlist::iterator& bl) {
+    __u8 v;
+    ::decode(v, bl);
+    ::decode(version, bl);
+    ::decode(tail, bl);
+  }
+};
+WRITE_CLASS_ENCODER(LogSummary)
+
+inline ostream& operator<<(ostream& out, const clog_type& t)
+{
+  switch (t) {
+  case CLOG_DEBUG:
+    return out << "[DBG]";
+  case CLOG_INFO:
+    return out << "[INF]";
+  case CLOG_WARN:
+    return out << "[WRN]";
+  case CLOG_ERROR:
+    return out << "[ERR]";
+  case CLOG_SEC:
+    return out << "[SEC]";
+  default:
+    return out << "[???]";
+  }
+}
+
+inline ostream& operator<<(ostream& out, const LogEntry& e)
+{
+  return out << e.stamp << " " << e.who << " " << e.seq << " : " << e.type << " " << e.msg;
+}
+
+#endif
diff --git a/src/include/LogEntry.h b/src/include/LogEntry.h
deleted file mode 100644 (file)
index db5c2e7..0000000
+++ /dev/null
@@ -1,144 +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) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * 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.
- * 
- */
-
-#ifndef CEPH_LOGENTRY_H
-#define CEPH_LOGENTRY_H
-
-#include "include/types.h"
-#include "include/encoding.h"
-
-typedef enum {
-  CLOG_DEBUG = 0,
-  CLOG_INFO = 1,
-  CLOG_SEC = 2,
-  CLOG_WARN = 3,
-  CLOG_ERROR = 4,
-} clog_type;
-
-struct LogEntryKey {
-  entity_inst_t who;
-  utime_t stamp;
-  uint64_t seq;
-
-  LogEntryKey() {}
-  LogEntryKey(entity_inst_t w, utime_t t, uint64_t s) : who(w), stamp(t), seq(s) {}
-
-  void encode(bufferlist& bl) const {
-    ::encode(who, bl);
-    ::encode(stamp, bl);
-    ::encode(seq, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    ::decode(who, bl);
-    ::decode(stamp, bl);
-    ::decode(seq, bl);
-  }
-};
-WRITE_CLASS_ENCODER(LogEntryKey)
-
-static inline bool operator==(const LogEntryKey& l, const LogEntryKey& r) {
-  return l.who == r.who && l.stamp == r.stamp && l.seq == r.seq;
-}
-
-struct LogEntry {
-  entity_inst_t who;
-  utime_t stamp;
-  uint64_t seq;
-  clog_type type;
-  string msg;
-
-  LogEntryKey key() const { return LogEntryKey(who, stamp, seq); }
-
-  void encode(bufferlist& bl) const {
-    __u8 v = 1;
-    ::encode(v, bl);
-    __u16 t = type;
-    ::encode(who, bl);
-    ::encode(stamp, bl);
-    ::encode(seq, bl);
-    ::encode(t, bl);
-    ::encode(msg, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    __u8 v;
-    ::decode(v, bl);
-    __u16 t;
-    ::decode(who, bl);
-    ::decode(stamp, bl);
-    ::decode(seq, bl);
-    ::decode(t, bl);
-    type = (clog_type)t;
-    ::decode(msg, bl);
-  }
-};
-WRITE_CLASS_ENCODER(LogEntry)
-
-struct LogSummary {
-  version_t version;
-  list<LogEntry> tail;
-
-  LogSummary() : version(0) {}
-
-  void add(const LogEntry& e) {
-    tail.push_back(e);
-    while (tail.size() > 50)
-      tail.pop_front();
-  }
-  bool contains(LogEntryKey k) const {
-    for (list<LogEntry>::const_iterator p = tail.begin();
-        p != tail.end();
-        p++)
-      if (p->key() == k) return true;
-    return false;
-  }
-
-  void encode(bufferlist& bl) const {
-    __u8 v = 1;
-    ::encode(v, bl);
-    ::encode(version, bl);
-    ::encode(tail, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    __u8 v;
-    ::decode(v, bl);
-    ::decode(version, bl);
-    ::decode(tail, bl);
-  }
-};
-WRITE_CLASS_ENCODER(LogSummary)
-
-inline ostream& operator<<(ostream& out, const clog_type& t)
-{
-  switch (t) {
-  case CLOG_DEBUG:
-    return out << "[DBG]";
-  case CLOG_INFO:
-    return out << "[INF]";
-  case CLOG_WARN:
-    return out << "[WRN]";
-  case CLOG_ERROR:
-    return out << "[ERR]";
-  case CLOG_SEC:
-    return out << "[SEC]";
-  default:
-    return out << "[???]";
-  }
-}
-
-inline ostream& operator<<(ostream& out, const LogEntry& e)
-{
-  return out << e.stamp << " " << e.who << " " << e.seq << " : " << e.type << " " << e.msg;
-}
-
-#endif
index 2a6fab5c1cdc33348b59e76e88ce95481ec25164..db2cb287af5ac246d687451eadf474186cfd30cb 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef CEPH_MLOG_H
 #define CEPH_MLOG_H
 
-#include "include/LogEntry.h"
+#include "common/LogEntry.h"
 #include "messages/PaxosServiceMessage.h"
 
 class MLog : public PaxosServiceMessage {
index 1617096230d8a85f18e16bf4cba3dafa6f0e7a10..27b098276a1cb81a6f94d82526ceb3dc474d749a 100644 (file)
@@ -15,8 +15,6 @@
 #ifndef CEPH_MLOGACK_H
 #define CEPH_MLOGACK_H
 
-#include "include/LogEntry.h"
-
 class MLogAck : public Message {
 public:
   ceph_fsid_t fsid;
index 91e0185b132fb99452588be4f140fa88f007e5d4..330a50a4e3101b82a962f91b71f12bebc6602535 100644 (file)
@@ -23,7 +23,7 @@ using namespace std;
 #include "msg/Messenger.h"
 #include "PaxosService.h"
 
-#include "include/LogEntry.h"
+#include "common/LogEntry.h"
 
 class MMonCommand;
 class MLog;
index 7bcf8fa3468fa1bba87ac2038c760a2fac0af6f6..fa6db5c8138939f1c774f251a43c1eb53090f47c 100644 (file)
@@ -30,7 +30,6 @@
 #include "common/DecayCounter.h"
 #include "common/ClassHandler.h"
 
-#include "include/LogEntry.h"
 #include "include/CompatSet.h"
 
 #include "auth/KeyRing.h"
index 98d8c9b998f40b321bade392dd2342173df72c6a..25c9e33a5579e25c3bfc7fdd963758c6b5d176e7 100644 (file)
@@ -78,7 +78,7 @@ Context *resend_event = 0;
 #include "mon/PGMap.h"
 #include "osd/OSDMap.h"
 #include "mds/MDSMap.h"
-#include "include/LogEntry.h"
+#include "common/LogEntry.h"
 #include "include/ClassLibrary.h"
 
 #include "mon/mon_types.h"