hadoop-hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zs...@apache.org
Subject svn commit: r724247 [2/6] - in /hadoop/hive/trunk/service: ./ if/ include/ include/thrift/ include/thrift/concurrency/ include/thrift/fb303/ include/thrift/fb303/if/ include/thrift/if/ include/thrift/processor/ include/thrift/protocol/ include/thrift/s...
Date Mon, 08 Dec 2008 04:25:51 GMT
Added: hadoop/hive/trunk/service/include/thrift/fb303/FacebookService.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/fb303/FacebookService.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/fb303/FacebookService.h (added)
+++ hadoop/hive/trunk/service/include/thrift/fb303/FacebookService.h Sun Dec  7 20:25:22 2008
@@ -0,0 +1,1583 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+#ifndef FacebookService_H
+#define FacebookService_H
+
+#include <TProcessor.h>
+#include "fb303_types.h"
+
+namespace facebook { namespace fb303 {
+
+class FacebookServiceIf {
+ public:
+  virtual ~FacebookServiceIf() {}
+  virtual void getName(std::string& _return) = 0;
+  virtual void getVersion(std::string& _return) = 0;
+  virtual fb_status getStatus() = 0;
+  virtual void getStatusDetails(std::string& _return) = 0;
+  virtual void getCounters(std::map<std::string, int64_t> & _return) = 0;
+  virtual int64_t getCounter(const std::string& key) = 0;
+  virtual void setOption(const std::string& key, const std::string& value) = 0;
+  virtual void getOption(std::string& _return, const std::string& key) = 0;
+  virtual void getOptions(std::map<std::string, std::string> & _return) = 0;
+  virtual int64_t aliveSince() = 0;
+  virtual void getLimitedReflection(facebook::thrift::reflection::limited::Service& _return) = 0;
+  virtual void reinitialize() = 0;
+  virtual void shutdown() = 0;
+  virtual void getSingleTimeseries(std::map<int64_t, double> & _return, const std::string& name, const int32_t series_length) = 0;
+  virtual void getTimeseries(std::map<std::string, std::map<int64_t, double> > & _return, const int32_t series_length) = 0;
+};
+
+class FacebookServiceNull : virtual public FacebookServiceIf {
+ public:
+  virtual ~FacebookServiceNull() {}
+  void getName(std::string& /* _return */) {
+    return;
+  }
+  void getVersion(std::string& /* _return */) {
+    return;
+  }
+  fb_status getStatus() {
+    fb_status _return = (fb_status)0;
+    return _return;
+  }
+  void getStatusDetails(std::string& /* _return */) {
+    return;
+  }
+  void getCounters(std::map<std::string, int64_t> & /* _return */) {
+    return;
+  }
+  int64_t getCounter(const std::string& /* key */) {
+    int64_t _return = 0;
+    return _return;
+  }
+  void setOption(const std::string& /* key */, const std::string& /* value */) {
+    return;
+  }
+  void getOption(std::string& /* _return */, const std::string& /* key */) {
+    return;
+  }
+  void getOptions(std::map<std::string, std::string> & /* _return */) {
+    return;
+  }
+  int64_t aliveSince() {
+    int64_t _return = 0;
+    return _return;
+  }
+  void getLimitedReflection(facebook::thrift::reflection::limited::Service& /* _return */) {
+    return;
+  }
+  void reinitialize() {
+    return;
+  }
+  void shutdown() {
+    return;
+  }
+  void getSingleTimeseries(std::map<int64_t, double> & /* _return */, const std::string& /* name */, const int32_t /* series_length */) {
+    return;
+  }
+  void getTimeseries(std::map<std::string, std::map<int64_t, double> > & /* _return */, const int32_t /* series_length */) {
+    return;
+  }
+};
+
+class FacebookService_getName_args {
+ public:
+
+  FacebookService_getName_args() {
+  }
+
+  virtual ~FacebookService_getName_args() throw() {}
+
+
+  bool operator == (const FacebookService_getName_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_getName_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getName_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getName_pargs {
+ public:
+
+
+  virtual ~FacebookService_getName_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getName_result {
+ public:
+
+  FacebookService_getName_result() : success("") {
+  }
+
+  virtual ~FacebookService_getName_result() throw() {}
+
+  std::string success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getName_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getName_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getName_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getName_presult {
+ public:
+
+
+  virtual ~FacebookService_getName_presult() throw() {}
+
+  std::string* success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_getVersion_args {
+ public:
+
+  FacebookService_getVersion_args() {
+  }
+
+  virtual ~FacebookService_getVersion_args() throw() {}
+
+
+  bool operator == (const FacebookService_getVersion_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_getVersion_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getVersion_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getVersion_pargs {
+ public:
+
+
+  virtual ~FacebookService_getVersion_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getVersion_result {
+ public:
+
+  FacebookService_getVersion_result() : success("") {
+  }
+
+  virtual ~FacebookService_getVersion_result() throw() {}
+
+  std::string success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getVersion_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getVersion_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getVersion_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getVersion_presult {
+ public:
+
+
+  virtual ~FacebookService_getVersion_presult() throw() {}
+
+  std::string* success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_getStatus_args {
+ public:
+
+  FacebookService_getStatus_args() {
+  }
+
+  virtual ~FacebookService_getStatus_args() throw() {}
+
+
+  bool operator == (const FacebookService_getStatus_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_getStatus_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getStatus_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getStatus_pargs {
+ public:
+
+
+  virtual ~FacebookService_getStatus_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getStatus_result {
+ public:
+
+  FacebookService_getStatus_result() {
+  }
+
+  virtual ~FacebookService_getStatus_result() throw() {}
+
+  fb_status success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getStatus_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getStatus_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getStatus_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getStatus_presult {
+ public:
+
+
+  virtual ~FacebookService_getStatus_presult() throw() {}
+
+  fb_status* success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_getStatusDetails_args {
+ public:
+
+  FacebookService_getStatusDetails_args() {
+  }
+
+  virtual ~FacebookService_getStatusDetails_args() throw() {}
+
+
+  bool operator == (const FacebookService_getStatusDetails_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_getStatusDetails_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getStatusDetails_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getStatusDetails_pargs {
+ public:
+
+
+  virtual ~FacebookService_getStatusDetails_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getStatusDetails_result {
+ public:
+
+  FacebookService_getStatusDetails_result() : success("") {
+  }
+
+  virtual ~FacebookService_getStatusDetails_result() throw() {}
+
+  std::string success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getStatusDetails_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getStatusDetails_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getStatusDetails_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getStatusDetails_presult {
+ public:
+
+
+  virtual ~FacebookService_getStatusDetails_presult() throw() {}
+
+  std::string* success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_getCounters_args {
+ public:
+
+  FacebookService_getCounters_args() {
+  }
+
+  virtual ~FacebookService_getCounters_args() throw() {}
+
+
+  bool operator == (const FacebookService_getCounters_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_getCounters_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getCounters_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getCounters_pargs {
+ public:
+
+
+  virtual ~FacebookService_getCounters_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getCounters_result {
+ public:
+
+  FacebookService_getCounters_result() {
+  }
+
+  virtual ~FacebookService_getCounters_result() throw() {}
+
+  std::map<std::string, int64_t>  success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getCounters_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getCounters_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getCounters_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getCounters_presult {
+ public:
+
+
+  virtual ~FacebookService_getCounters_presult() throw() {}
+
+  std::map<std::string, int64_t> * success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_getCounter_args {
+ public:
+
+  FacebookService_getCounter_args() : key("") {
+  }
+
+  virtual ~FacebookService_getCounter_args() throw() {}
+
+  std::string key;
+
+  struct __isset {
+    __isset() : key(false) {}
+    bool key;
+  } __isset;
+
+  bool operator == (const FacebookService_getCounter_args & rhs) const
+  {
+    if (!(key == rhs.key))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getCounter_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getCounter_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getCounter_pargs {
+ public:
+
+
+  virtual ~FacebookService_getCounter_pargs() throw() {}
+
+  const std::string* key;
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getCounter_result {
+ public:
+
+  FacebookService_getCounter_result() : success(0) {
+  }
+
+  virtual ~FacebookService_getCounter_result() throw() {}
+
+  int64_t success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getCounter_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getCounter_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getCounter_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getCounter_presult {
+ public:
+
+
+  virtual ~FacebookService_getCounter_presult() throw() {}
+
+  int64_t* success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_setOption_args {
+ public:
+
+  FacebookService_setOption_args() : key(""), value("") {
+  }
+
+  virtual ~FacebookService_setOption_args() throw() {}
+
+  std::string key;
+  std::string value;
+
+  struct __isset {
+    __isset() : key(false), value(false) {}
+    bool key;
+    bool value;
+  } __isset;
+
+  bool operator == (const FacebookService_setOption_args & rhs) const
+  {
+    if (!(key == rhs.key))
+      return false;
+    if (!(value == rhs.value))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_setOption_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_setOption_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_setOption_pargs {
+ public:
+
+
+  virtual ~FacebookService_setOption_pargs() throw() {}
+
+  const std::string* key;
+  const std::string* value;
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_setOption_result {
+ public:
+
+  FacebookService_setOption_result() {
+  }
+
+  virtual ~FacebookService_setOption_result() throw() {}
+
+
+  bool operator == (const FacebookService_setOption_result & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_setOption_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_setOption_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_setOption_presult {
+ public:
+
+
+  virtual ~FacebookService_setOption_presult() throw() {}
+
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_getOption_args {
+ public:
+
+  FacebookService_getOption_args() : key("") {
+  }
+
+  virtual ~FacebookService_getOption_args() throw() {}
+
+  std::string key;
+
+  struct __isset {
+    __isset() : key(false) {}
+    bool key;
+  } __isset;
+
+  bool operator == (const FacebookService_getOption_args & rhs) const
+  {
+    if (!(key == rhs.key))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getOption_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getOption_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getOption_pargs {
+ public:
+
+
+  virtual ~FacebookService_getOption_pargs() throw() {}
+
+  const std::string* key;
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getOption_result {
+ public:
+
+  FacebookService_getOption_result() : success("") {
+  }
+
+  virtual ~FacebookService_getOption_result() throw() {}
+
+  std::string success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getOption_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getOption_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getOption_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getOption_presult {
+ public:
+
+
+  virtual ~FacebookService_getOption_presult() throw() {}
+
+  std::string* success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_getOptions_args {
+ public:
+
+  FacebookService_getOptions_args() {
+  }
+
+  virtual ~FacebookService_getOptions_args() throw() {}
+
+
+  bool operator == (const FacebookService_getOptions_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_getOptions_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getOptions_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getOptions_pargs {
+ public:
+
+
+  virtual ~FacebookService_getOptions_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getOptions_result {
+ public:
+
+  FacebookService_getOptions_result() {
+  }
+
+  virtual ~FacebookService_getOptions_result() throw() {}
+
+  std::map<std::string, std::string>  success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getOptions_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getOptions_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getOptions_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getOptions_presult {
+ public:
+
+
+  virtual ~FacebookService_getOptions_presult() throw() {}
+
+  std::map<std::string, std::string> * success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_aliveSince_args {
+ public:
+
+  FacebookService_aliveSince_args() {
+  }
+
+  virtual ~FacebookService_aliveSince_args() throw() {}
+
+
+  bool operator == (const FacebookService_aliveSince_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_aliveSince_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_aliveSince_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_aliveSince_pargs {
+ public:
+
+
+  virtual ~FacebookService_aliveSince_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_aliveSince_result {
+ public:
+
+  FacebookService_aliveSince_result() : success(0) {
+  }
+
+  virtual ~FacebookService_aliveSince_result() throw() {}
+
+  int64_t success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_aliveSince_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_aliveSince_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_aliveSince_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_aliveSince_presult {
+ public:
+
+
+  virtual ~FacebookService_aliveSince_presult() throw() {}
+
+  int64_t* success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_getLimitedReflection_args {
+ public:
+
+  FacebookService_getLimitedReflection_args() {
+  }
+
+  virtual ~FacebookService_getLimitedReflection_args() throw() {}
+
+
+  bool operator == (const FacebookService_getLimitedReflection_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_getLimitedReflection_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getLimitedReflection_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getLimitedReflection_pargs {
+ public:
+
+
+  virtual ~FacebookService_getLimitedReflection_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getLimitedReflection_result {
+ public:
+
+  FacebookService_getLimitedReflection_result() {
+  }
+
+  virtual ~FacebookService_getLimitedReflection_result() throw() {}
+
+  facebook::thrift::reflection::limited::Service success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getLimitedReflection_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getLimitedReflection_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getLimitedReflection_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getLimitedReflection_presult {
+ public:
+
+
+  virtual ~FacebookService_getLimitedReflection_presult() throw() {}
+
+  facebook::thrift::reflection::limited::Service* success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_reinitialize_args {
+ public:
+
+  FacebookService_reinitialize_args() {
+  }
+
+  virtual ~FacebookService_reinitialize_args() throw() {}
+
+
+  bool operator == (const FacebookService_reinitialize_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_reinitialize_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_reinitialize_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_reinitialize_pargs {
+ public:
+
+
+  virtual ~FacebookService_reinitialize_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_shutdown_args {
+ public:
+
+  FacebookService_shutdown_args() {
+  }
+
+  virtual ~FacebookService_shutdown_args() throw() {}
+
+
+  bool operator == (const FacebookService_shutdown_args & /* rhs */) const
+  {
+    return true;
+  }
+  bool operator != (const FacebookService_shutdown_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_shutdown_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_shutdown_pargs {
+ public:
+
+
+  virtual ~FacebookService_shutdown_pargs() throw() {}
+
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getSingleTimeseries_args {
+ public:
+
+  FacebookService_getSingleTimeseries_args() : name(""), series_length(0) {
+  }
+
+  virtual ~FacebookService_getSingleTimeseries_args() throw() {}
+
+  std::string name;
+  int32_t series_length;
+
+  struct __isset {
+    __isset() : name(false), series_length(false) {}
+    bool name;
+    bool series_length;
+  } __isset;
+
+  bool operator == (const FacebookService_getSingleTimeseries_args & rhs) const
+  {
+    if (!(name == rhs.name))
+      return false;
+    if (!(series_length == rhs.series_length))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getSingleTimeseries_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getSingleTimeseries_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getSingleTimeseries_pargs {
+ public:
+
+
+  virtual ~FacebookService_getSingleTimeseries_pargs() throw() {}
+
+  const std::string* name;
+  const int32_t* series_length;
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getSingleTimeseries_result {
+ public:
+
+  FacebookService_getSingleTimeseries_result() {
+  }
+
+  virtual ~FacebookService_getSingleTimeseries_result() throw() {}
+
+  std::map<int64_t, double>  success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getSingleTimeseries_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getSingleTimeseries_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getSingleTimeseries_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getSingleTimeseries_presult {
+ public:
+
+
+  virtual ~FacebookService_getSingleTimeseries_presult() throw() {}
+
+  std::map<int64_t, double> * success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookService_getTimeseries_args {
+ public:
+
+  FacebookService_getTimeseries_args() : series_length(0) {
+  }
+
+  virtual ~FacebookService_getTimeseries_args() throw() {}
+
+  int32_t series_length;
+
+  struct __isset {
+    __isset() : series_length(false) {}
+    bool series_length;
+  } __isset;
+
+  bool operator == (const FacebookService_getTimeseries_args & rhs) const
+  {
+    if (!(series_length == rhs.series_length))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getTimeseries_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getTimeseries_args & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getTimeseries_pargs {
+ public:
+
+
+  virtual ~FacebookService_getTimeseries_pargs() throw() {}
+
+  const int32_t* series_length;
+
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getTimeseries_result {
+ public:
+
+  FacebookService_getTimeseries_result() {
+  }
+
+  virtual ~FacebookService_getTimeseries_result() throw() {}
+
+  std::map<std::string, std::map<int64_t, double> >  success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  bool operator == (const FacebookService_getTimeseries_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    return true;
+  }
+  bool operator != (const FacebookService_getTimeseries_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const FacebookService_getTimeseries_result & ) const;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+  uint32_t write(facebook::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class FacebookService_getTimeseries_presult {
+ public:
+
+
+  virtual ~FacebookService_getTimeseries_presult() throw() {}
+
+  std::map<std::string, std::map<int64_t, double> > * success;
+
+  struct __isset {
+    __isset() : success(false) {}
+    bool success;
+  } __isset;
+
+  uint32_t read(facebook::thrift::protocol::TProtocol* iprot);
+
+};
+
+class FacebookServiceClient : virtual public FacebookServiceIf {
+ public:
+  FacebookServiceClient(boost::shared_ptr<facebook::thrift::protocol::TProtocol> prot) :
+    piprot_(prot),
+    poprot_(prot) {
+    iprot_ = prot.get();
+    oprot_ = prot.get();
+  }
+  FacebookServiceClient(boost::shared_ptr<facebook::thrift::protocol::TProtocol> iprot, boost::shared_ptr<facebook::thrift::protocol::TProtocol> oprot) :
+    piprot_(iprot),
+    poprot_(oprot) {
+    iprot_ = iprot.get();
+    oprot_ = oprot.get();
+  }
+  boost::shared_ptr<facebook::thrift::protocol::TProtocol> getInputProtocol() {
+    return piprot_;
+  }
+  boost::shared_ptr<facebook::thrift::protocol::TProtocol> getOutputProtocol() {
+    return poprot_;
+  }
+  void getName(std::string& _return);
+  void send_getName();
+  void recv_getName(std::string& _return);
+  void getVersion(std::string& _return);
+  void send_getVersion();
+  void recv_getVersion(std::string& _return);
+  fb_status getStatus();
+  void send_getStatus();
+  fb_status recv_getStatus();
+  void getStatusDetails(std::string& _return);
+  void send_getStatusDetails();
+  void recv_getStatusDetails(std::string& _return);
+  void getCounters(std::map<std::string, int64_t> & _return);
+  void send_getCounters();
+  void recv_getCounters(std::map<std::string, int64_t> & _return);
+  int64_t getCounter(const std::string& key);
+  void send_getCounter(const std::string& key);
+  int64_t recv_getCounter();
+  void setOption(const std::string& key, const std::string& value);
+  void send_setOption(const std::string& key, const std::string& value);
+  void recv_setOption();
+  void getOption(std::string& _return, const std::string& key);
+  void send_getOption(const std::string& key);
+  void recv_getOption(std::string& _return);
+  void getOptions(std::map<std::string, std::string> & _return);
+  void send_getOptions();
+  void recv_getOptions(std::map<std::string, std::string> & _return);
+  int64_t aliveSince();
+  void send_aliveSince();
+  int64_t recv_aliveSince();
+  void getLimitedReflection(facebook::thrift::reflection::limited::Service& _return);
+  void send_getLimitedReflection();
+  void recv_getLimitedReflection(facebook::thrift::reflection::limited::Service& _return);
+  void reinitialize();
+  void send_reinitialize();
+  void shutdown();
+  void send_shutdown();
+  void getSingleTimeseries(std::map<int64_t, double> & _return, const std::string& name, const int32_t series_length);
+  void send_getSingleTimeseries(const std::string& name, const int32_t series_length);
+  void recv_getSingleTimeseries(std::map<int64_t, double> & _return);
+  void getTimeseries(std::map<std::string, std::map<int64_t, double> > & _return, const int32_t series_length);
+  void send_getTimeseries(const int32_t series_length);
+  void recv_getTimeseries(std::map<std::string, std::map<int64_t, double> > & _return);
+ protected:
+  boost::shared_ptr<facebook::thrift::protocol::TProtocol> piprot_;
+  boost::shared_ptr<facebook::thrift::protocol::TProtocol> poprot_;
+  facebook::thrift::protocol::TProtocol* iprot_;
+  facebook::thrift::protocol::TProtocol* oprot_;
+};
+
+class FacebookServiceProcessor : virtual public facebook::thrift::TProcessor {
+ protected:
+  boost::shared_ptr<FacebookServiceIf> iface_;
+  virtual bool process_fn(facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot, std::string& fname, int32_t seqid);
+ private:
+  std::map<std::string, void (FacebookServiceProcessor::*)(int32_t, facebook::thrift::protocol::TProtocol*, facebook::thrift::protocol::TProtocol*)> processMap_;
+  void process_getName(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getVersion(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getStatus(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getStatusDetails(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getCounters(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getCounter(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_setOption(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getOption(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getOptions(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_aliveSince(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getLimitedReflection(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_reinitialize(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_shutdown(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getSingleTimeseries(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+  void process_getTimeseries(int32_t seqid, facebook::thrift::protocol::TProtocol* iprot, facebook::thrift::protocol::TProtocol* oprot);
+ public:
+  FacebookServiceProcessor(boost::shared_ptr<FacebookServiceIf> iface) :
+    iface_(iface) {
+    processMap_["getName"] = &FacebookServiceProcessor::process_getName;
+    processMap_["getVersion"] = &FacebookServiceProcessor::process_getVersion;
+    processMap_["getStatus"] = &FacebookServiceProcessor::process_getStatus;
+    processMap_["getStatusDetails"] = &FacebookServiceProcessor::process_getStatusDetails;
+    processMap_["getCounters"] = &FacebookServiceProcessor::process_getCounters;
+    processMap_["getCounter"] = &FacebookServiceProcessor::process_getCounter;
+    processMap_["setOption"] = &FacebookServiceProcessor::process_setOption;
+    processMap_["getOption"] = &FacebookServiceProcessor::process_getOption;
+    processMap_["getOptions"] = &FacebookServiceProcessor::process_getOptions;
+    processMap_["aliveSince"] = &FacebookServiceProcessor::process_aliveSince;
+    processMap_["getLimitedReflection"] = &FacebookServiceProcessor::process_getLimitedReflection;
+    processMap_["reinitialize"] = &FacebookServiceProcessor::process_reinitialize;
+    processMap_["shutdown"] = &FacebookServiceProcessor::process_shutdown;
+    processMap_["getSingleTimeseries"] = &FacebookServiceProcessor::process_getSingleTimeseries;
+    processMap_["getTimeseries"] = &FacebookServiceProcessor::process_getTimeseries;
+  }
+
+  virtual bool process(boost::shared_ptr<facebook::thrift::protocol::TProtocol> piprot, boost::shared_ptr<facebook::thrift::protocol::TProtocol> poprot);
+  virtual ~FacebookServiceProcessor() {}
+};
+
+class FacebookServiceMultiface : virtual public FacebookServiceIf {
+ public:
+  FacebookServiceMultiface(std::vector<boost::shared_ptr<FacebookServiceIf> >& ifaces) : ifaces_(ifaces) {
+  }
+  virtual ~FacebookServiceMultiface() {}
+ protected:
+  std::vector<boost::shared_ptr<FacebookServiceIf> > ifaces_;
+  FacebookServiceMultiface() {}
+  void add(boost::shared_ptr<FacebookServiceIf> iface) {
+    ifaces_.push_back(iface);
+  }
+ public:
+  void getName(std::string& _return) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        ifaces_[i]->getName(_return);
+        return;
+      } else {
+        ifaces_[i]->getName(_return);
+      }
+    }
+  }
+
+  void getVersion(std::string& _return) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        ifaces_[i]->getVersion(_return);
+        return;
+      } else {
+        ifaces_[i]->getVersion(_return);
+      }
+    }
+  }
+
+  fb_status getStatus() {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        return ifaces_[i]->getStatus();
+      } else {
+        ifaces_[i]->getStatus();
+      }
+    }
+  }
+
+  void getStatusDetails(std::string& _return) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        ifaces_[i]->getStatusDetails(_return);
+        return;
+      } else {
+        ifaces_[i]->getStatusDetails(_return);
+      }
+    }
+  }
+
+  void getCounters(std::map<std::string, int64_t> & _return) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        ifaces_[i]->getCounters(_return);
+        return;
+      } else {
+        ifaces_[i]->getCounters(_return);
+      }
+    }
+  }
+
+  int64_t getCounter(const std::string& key) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        return ifaces_[i]->getCounter(key);
+      } else {
+        ifaces_[i]->getCounter(key);
+      }
+    }
+  }
+
+  void setOption(const std::string& key, const std::string& value) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      ifaces_[i]->setOption(key, value);
+    }
+  }
+
+  void getOption(std::string& _return, const std::string& key) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        ifaces_[i]->getOption(_return, key);
+        return;
+      } else {
+        ifaces_[i]->getOption(_return, key);
+      }
+    }
+  }
+
+  void getOptions(std::map<std::string, std::string> & _return) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        ifaces_[i]->getOptions(_return);
+        return;
+      } else {
+        ifaces_[i]->getOptions(_return);
+      }
+    }
+  }
+
+  int64_t aliveSince() {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        return ifaces_[i]->aliveSince();
+      } else {
+        ifaces_[i]->aliveSince();
+      }
+    }
+  }
+
+  void getLimitedReflection(facebook::thrift::reflection::limited::Service& _return) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        ifaces_[i]->getLimitedReflection(_return);
+        return;
+      } else {
+        ifaces_[i]->getLimitedReflection(_return);
+      }
+    }
+  }
+
+  void reinitialize() {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      ifaces_[i]->reinitialize();
+    }
+  }
+
+  void shutdown() {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      ifaces_[i]->shutdown();
+    }
+  }
+
+  void getSingleTimeseries(std::map<int64_t, double> & _return, const std::string& name, const int32_t series_length) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        ifaces_[i]->getSingleTimeseries(_return, name, series_length);
+        return;
+      } else {
+        ifaces_[i]->getSingleTimeseries(_return, name, series_length);
+      }
+    }
+  }
+
+  void getTimeseries(std::map<std::string, std::map<int64_t, double> > & _return, const int32_t series_length) {
+    uint32_t sz = ifaces_.size();
+    for (uint32_t i = 0; i < sz; ++i) {
+      if (i == sz - 1) {
+        ifaces_[i]->getTimeseries(_return, series_length);
+        return;
+      } else {
+        ifaces_[i]->getTimeseries(_return, series_length);
+      }
+    }
+  }
+
+};
+
+}} // namespace
+
+#endif

Added: hadoop/hive/trunk/service/include/thrift/fb303/ServiceTracker.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/fb303/ServiceTracker.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/fb303/ServiceTracker.h (added)
+++ hadoop/hive/trunk/service/include/thrift/fb303/ServiceTracker.h Sun Dec  7 20:25:22 2008
@@ -0,0 +1,202 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+/**
+ * ServiceTracker is a utility class for logging and timing service
+ * calls to a fb303 Thrift server.  Currently, ServiceTracker offers
+ * the following features:
+ *
+ *   . Logging of service method start, end (and duration), and
+ *     optional steps in between.
+ *
+ *   . Automatic check of server status via fb303::getStatus()
+ *     with a ServiceException thrown if server not alive
+ *     (at method start).
+ *
+ *   . A periodic logged checkpoint reporting lifetime time, lifetime
+ *     service count, and per-method statistics since the last checkpoint
+ *     time (at method finish).
+ *
+ *   . Export of fb303 counters for lifetime and checkpoint statistics
+ *     (at method finish).
+ *
+ *   . For TThreadPoolServers, a logged warning when all server threads
+ *     are busy (at method start).  (Must call setThreadManager() after
+ *     ServiceTracker instantiation for this feature to be enabled.)
+ *
+ * Individual features may be enabled or disabled by arguments to the
+ * constructor.  The constructor also accepts a pointer to a logging
+ * method -- if no pointer is passed, the tracker will log to stdout.
+ *
+ * ServiceTracker defines private methods for service start, finish,
+ * and step, which are designed to be accessed by instantiating a
+ * friend ServiceMethod object, as in the following example:
+ *
+ *    #include <ServiceTracker.h>
+ *    class MyServiceHandler : virtual public MyServiceIf,
+ *                             public facebook::fb303::FacebookBase
+ *    {
+ *    public:
+ *      MyServiceHandler::MyServiceHandler() : mServiceTracker(this) {}
+ *      void MyServiceHandler::myServiceMethod(int userId) {
+ *        // note: Instantiating a ServiceMethod object starts a timer
+ *        // and tells the ServiceTracker to log the start.  Might throw
+ *        // a ServiceException.
+ *        ServiceMethod serviceMethod(&mServiceTracker,
+ *                                   "myServiceMethod",
+ *                                   userId);
+ *        ...
+ *        // note: Calling the step method tells the ServiceTracker to
+ *        // log the step, with a time elapsed since start.
+ *        serviceMethod.step("post parsing, begin processing");
+ *        ...
+ *        // note: When the ServiceMethod object goes out of scope, the
+ *        // ServiceTracker will log the total elapsed time of the method.
+ *      }
+ *      ...
+ *    private:
+ *      ServiceTracker mServiceTracker;
+ *    }
+ *
+ * The step() method call is optional; the startService() and
+ * finishService() methods are handled by the object's constructor and
+ * destructor.
+ *
+ * The ServiceTracker is (intended to be) thread-safe.
+ *
+ * Future:
+ *
+ *   . Come up with something better for logging than passing a
+ *     function pointer to the constructor.
+ *
+ *   . Add methods for tracking errors from service methods, e.g.
+ *     ServiceTracker::reportService().
+ */
+
+#ifndef SERVICETRACKER_H
+#define SERVICETRACKER_H
+
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <exception>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+#include "thrift/concurrency/Mutex.h"
+
+
+namespace facebook { namespace thrift { namespace concurrency {
+  class ThreadManager;
+}}}
+
+
+namespace facebook { namespace fb303 {
+
+
+class FacebookBase;
+class ServiceMethod;
+
+
+class Stopwatch
+{
+public:
+  enum Unit { UNIT_SECONDS, UNIT_MILLISECONDS, UNIT_MICROSECONDS };
+  Stopwatch();
+  uint64_t elapsedUnits(Unit unit, std::string *label = NULL) const;
+  void reset();
+private:
+  timeval startTime_;
+};
+
+
+class ServiceTracker
+{
+  friend class ServiceMethod;
+
+public:
+
+  static uint64_t CHECKPOINT_MINIMUM_INTERVAL_SECONDS;
+  static int LOG_LEVEL;
+
+  ServiceTracker(facebook::fb303::FacebookBase *handler,
+                 void (*logMethod)(int, const std::string &)
+                 = &ServiceTracker::defaultLogMethod,
+                 bool featureCheckpoint = true,
+                 bool featureStatusCheck = true,
+                 bool featureThreadCheck = true,
+                 Stopwatch::Unit stopwatchUnit
+                 = Stopwatch::UNIT_MILLISECONDS);
+
+  void setThreadManager(boost::shared_ptr<facebook::thrift::concurrency::ThreadManager> threadManager);
+
+private:
+
+  facebook::fb303::FacebookBase *handler_;
+  void (*logMethod_)(int, const std::string &);
+  boost::shared_ptr<facebook::thrift::concurrency::ThreadManager> threadManager_;
+
+  bool featureCheckpoint_;
+  bool featureStatusCheck_;
+  bool featureThreadCheck_;
+  Stopwatch::Unit stopwatchUnit_;
+
+  facebook::thrift::concurrency::Mutex statisticsMutex_;
+  time_t checkpointTime_;
+  uint64_t checkpointServices_;
+  uint64_t checkpointDuration_;
+  std::map<std::string, std::pair<uint64_t, uint64_t> > checkpointServiceDuration_;
+
+  void startService(const ServiceMethod &serviceMethod);
+  int64_t stepService(const ServiceMethod &serviceMethod,
+                      const std::string &stepName);
+  void finishService(const ServiceMethod &serviceMethod);
+  void reportCheckpoint();
+  static void defaultLogMethod(int level, const std::string &message);
+};
+
+
+class ServiceMethod
+{
+  friend class ServiceTracker;
+public:
+  ServiceMethod(ServiceTracker *tracker,
+                const std::string &name,
+                const std::string &signature,
+                bool featureLogOnly = false);
+  ServiceMethod(ServiceTracker *tracker,
+                const std::string &name,
+                uint64_t id,
+                bool featureLogOnly = false);
+  ~ServiceMethod();
+  uint64_t step(const std::string &stepName);
+private:
+  ServiceTracker *tracker_;
+  std::string name_;
+  std::string signature_;
+  bool featureLogOnly_;
+  Stopwatch timer_;
+};
+
+
+class ServiceException : public std::exception
+{
+public:
+  explicit ServiceException(const std::string &message, int code = 0)
+    : message_(message), code_(code) {}
+  ~ServiceException() throw() {}
+  virtual const char *what() const throw() { return message_.c_str(); }
+  int code() const throw() { return code_; }
+private:
+  std::string message_;
+  int code_;
+};
+
+
+}} // facebook::fb303
+
+#endif

Added: hadoop/hive/trunk/service/include/thrift/fb303/fb303_constants.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/fb303/fb303_constants.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/fb303/fb303_constants.h (added)
+++ hadoop/hive/trunk/service/include/thrift/fb303/fb303_constants.h Sun Dec  7 20:25:22 2008
@@ -0,0 +1,23 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+#ifndef fb303_CONSTANTS_H
+#define fb303_CONSTANTS_H
+
+#include "fb303_types.h"
+
+namespace facebook { namespace fb303 {
+
+class fb303Constants {
+ public:
+  fb303Constants();
+
+};
+
+extern const fb303Constants g_fb303_constants;
+
+}} // namespace
+
+#endif

Added: hadoop/hive/trunk/service/include/thrift/fb303/fb303_types.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/fb303/fb303_types.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/fb303/fb303_types.h (added)
+++ hadoop/hive/trunk/service/include/thrift/fb303/fb303_types.h Sun Dec  7 20:25:22 2008
@@ -0,0 +1,30 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+#ifndef fb303_TYPES_H
+#define fb303_TYPES_H
+
+#include <Thrift.h>
+#include <reflection_limited_types.h>
+#include <protocol/TProtocol.h>
+#include <transport/TTransport.h>
+
+#include "reflection_limited_types.h"
+
+
+namespace facebook { namespace fb303 {
+
+enum fb_status {
+  DEAD = 0,
+  STARTING = 1,
+  ALIVE = 2,
+  STOPPING = 3,
+  STOPPED = 4,
+  WARNING = 5
+};
+
+}} // namespace
+
+#endif

Added: hadoop/hive/trunk/service/include/thrift/fb303/if/fb303.thrift
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/fb303/if/fb303.thrift?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/fb303/if/fb303.thrift (added)
+++ hadoop/hive/trunk/service/include/thrift/fb303/if/fb303.thrift Sun Dec  7 20:25:22 2008
@@ -0,0 +1,108 @@
+/**
+ * fb303.thrift
+ *
+ * Copyright (c) 2006- Facebook
+ * Distributed under the Thrift Software License
+ *
+ * See accompanying file LICENSE or visit the Thrift site at:
+ * http://developers.facebook.com/thrift/
+ *
+ *
+ * Definition of common Facebook data types and status reporting mechanisms
+ * common to all Facebook services. In some cases, these methods are
+ * provided in the base implementation, and in other cases they simply define
+ * methods that inheriting applications should implement (i.e. status report)
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+
+include "thrift/if/reflection_limited.thrift"
+
+namespace java com.facebook.fb303
+namespace cpp facebook.fb303
+
+/**
+ * Common status reporting mechanism across all services
+ */
+enum fb_status {
+  DEAD = 0,
+  STARTING = 1,
+  ALIVE = 2,
+  STOPPING = 3,
+  STOPPED = 4,
+  WARNING = 5,
+}
+
+/**
+ * Standard base service
+ */
+service FacebookService {
+
+  /**
+   * Returns a descriptive name of the service
+   */
+  string getName(),
+
+  /**
+   * Returns the version of the service
+   */
+  string getVersion(),
+
+  /**
+   * Gets the status of this service
+   */
+  fb_status getStatus(),
+
+  /**
+   * User friendly description of status, such as why the service is in
+   * the dead or warning state, or what is being started or stopped.
+   */
+  string getStatusDetails(),
+
+  /**
+   * Gets the counters for this service
+   */
+  map<string, i64> getCounters(),
+
+  /**
+   * Gets the value of a single counter
+   */
+  i64 getCounter(1: string key),
+
+  /**
+   * Sets an option
+   */
+  void setOption(1: string key, 2: string value),
+
+  /**
+   * Gets an option
+   */
+  string getOption(1: string key),
+
+  /**
+   * Gets all options
+   */
+  map<string, string> getOptions(),
+
+  /**
+   * Returns the unix time that the server has been running since
+   */
+  i64 aliveSince(),
+
+  /**
+   * Returns a limited description of this service.
+   */
+  reflection_limited.Service
+  getLimitedReflection(),
+
+  /**
+   * Tell the server to reload its configuration, reopen log files, etc
+   */
+  async void reinitialize()
+
+  /**
+   * Suggest a shutdown to the server
+   */
+  async void shutdown()
+
+}

Added: hadoop/hive/trunk/service/include/thrift/if/reflection_limited.thrift
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/if/reflection_limited.thrift?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/if/reflection_limited.thrift (added)
+++ hadoop/hive/trunk/service/include/thrift/if/reflection_limited.thrift Sun Dec  7 20:25:22 2008
@@ -0,0 +1,71 @@
+#!/usr/local/bin/thrift -php -java -cpp -py
+
+// NOTICE!!!
+// DO NOT FORGET to run regen.sh if you change this file
+// (or if you change the compiler).
+
+// This interface is deprecated.
+// There is no replacement yet, but I hate it so much that
+// I'm deprecating it before it's done.
+// @author I'm too ashamed to say.
+
+// dreiss naively thinks he knows how to do this better,
+// so talk to him if you are interested in taking it on,
+// or if you just want someone to make it better for you.
+
+namespace cpp facebook.thrift.reflection.limited
+namespace java com.facebook.thrift.reflection.limited
+namespace py thrift.reflection.limited
+
+enum TTypeTag {
+  T_VOID   = 1,
+  T_BOOL   = 2,
+  T_BYTE   = 3,
+  T_I16    = 6,
+  T_I32    = 8,
+  T_I64    = 10,
+  T_DOUBLE = 4,
+  T_STRING = 11,
+  T_STRUCT = 12,
+  T_MAP    = 13,
+  T_SET    = 14,
+  T_LIST   = 15,
+  // This doesn't exist in TBinaryProtocol, but it could be useful for reflection.
+  T_ENUM   = 101,
+  T_NOT_REFLECTED = 102,
+}
+
+struct SimpleType {
+  1: TTypeTag ttype,
+  2: string name,  // For structs and emums.
+}
+
+struct ContainerType {
+  1: TTypeTag ttype,
+  2:          SimpleType subtype1,
+  3: optional SimpleType subtype2,
+}
+
+struct ThriftType {
+  1: bool is_container,
+  2: optional SimpleType simple_type,
+  3: optional ContainerType container_type,
+}
+
+struct Argument {
+  1: i16 key,
+  2: string name,
+  3: ThriftType type,
+}
+
+struct Method {
+  1: string name,
+  2: ThriftType return_type,
+  3: list<Argument> arguments,
+}
+
+struct Service {
+  1: string name,
+  2: list<Method> methods,
+  3: bool fully_reflected,
+}

Added: hadoop/hive/trunk/service/include/thrift/processor/PeekProcessor.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/processor/PeekProcessor.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/processor/PeekProcessor.h (added)
+++ hadoop/hive/trunk/service/include/thrift/processor/PeekProcessor.h Sun Dec  7 20:25:22 2008
@@ -0,0 +1,64 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#ifndef PEEKPROCESSOR_H
+#define PEEKPROCESSOR_H
+
+#include <string>
+#include <TProcessor.h>
+#include <transport/TTransport.h>
+#include <transport/TTransportUtils.h>
+#include <boost/shared_ptr.hpp>
+
+namespace facebook { namespace thrift { namespace processor { 
+
+/*
+ * Class for peeking at the raw data that is being processed by another processor
+ * and gives the derived class a chance to change behavior accordingly
+ *
+ * @author James Wang <jwang@facebook.com>
+ */
+class PeekProcessor : public facebook::thrift::TProcessor {
+  
+ public:
+  PeekProcessor();
+  virtual ~PeekProcessor();
+
+  // Input here: actualProcessor  - the underlying processor
+  //             protocolFactory  - the protocol factory used to wrap the memory buffer
+  //             transportFactory - this TPipedTransportFactory is used to wrap the source transport
+  //                                via a call to getPipedTransport
+  void initialize(boost::shared_ptr<facebook::thrift::TProcessor> actualProcessor,
+                  boost::shared_ptr<facebook::thrift::protocol::TProtocolFactory> protocolFactory,
+                  boost::shared_ptr<facebook::thrift::transport::TPipedTransportFactory> transportFactory);
+
+  boost::shared_ptr<facebook::thrift::transport::TTransport> getPipedTransport(boost::shared_ptr<facebook::thrift::transport::TTransport> in);
+
+  void setTargetTransport(boost::shared_ptr<facebook::thrift::transport::TTransport> targetTransport);
+
+  virtual bool process(boost::shared_ptr<facebook::thrift::protocol::TProtocol> in, 
+                       boost::shared_ptr<facebook::thrift::protocol::TProtocol> out);
+
+  // The following three functions can be overloaded by child classes to
+  // achieve desired peeking behavior
+  virtual void peekName(const std::string& fname);
+  virtual void peekBuffer(uint8_t* buffer, uint32_t size);
+  virtual void peek(boost::shared_ptr<facebook::thrift::protocol::TProtocol> in, 
+                    facebook::thrift::protocol::TType ftype,
+                    int16_t fid);
+  virtual void peekEnd();
+
+ private:
+  boost::shared_ptr<facebook::thrift::TProcessor> actualProcessor_;
+  boost::shared_ptr<facebook::thrift::protocol::TProtocol> pipedProtocol_;
+  boost::shared_ptr<facebook::thrift::transport::TPipedTransportFactory> transportFactory_;
+  boost::shared_ptr<facebook::thrift::transport::TMemoryBuffer> memoryBuffer_;
+  boost::shared_ptr<facebook::thrift::transport::TTransport> targetTransport_;
+};
+
+}}} // facebook::thrift::processor
+
+#endif

Added: hadoop/hive/trunk/service/include/thrift/processor/StatsProcessor.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/processor/StatsProcessor.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/processor/StatsProcessor.h (added)
+++ hadoop/hive/trunk/service/include/thrift/processor/StatsProcessor.h Sun Dec  7 20:25:22 2008
@@ -0,0 +1,252 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#ifndef STATSPROCESSOR_H
+#define STATSPROCESSOR_H
+
+#include <boost/shared_ptr.hpp>
+#include <transport/TTransport.h>
+#include <protocol/TProtocol.h>
+#include <TProcessor.h>
+
+namespace facebook { namespace thrift { namespace processor { 
+
+/*
+ * Class for keeping track of function call statistics and printing them if desired
+ *
+ * @author James Wang <jwang@facebook.com>
+ */
+class StatsProcessor : public facebook::thrift::TProcessor {
+public:
+  StatsProcessor(bool print, bool frequency) 
+    : print_(print),
+      frequency_(frequency)
+  {}
+  virtual ~StatsProcessor() {};
+
+  virtual bool process(boost::shared_ptr<facebook::thrift::protocol::TProtocol> piprot, boost::shared_ptr<facebook::thrift::protocol::TProtocol> poprot) {
+
+    piprot_ = piprot;
+
+    std::string fname;
+    facebook::thrift::protocol::TMessageType mtype;
+    int32_t seqid;
+
+    piprot_->readMessageBegin(fname, mtype, seqid);
+    if (mtype != facebook::thrift::protocol::T_CALL) {
+      if (print_) {
+        printf("Unknown message type\n");
+      }
+      throw facebook::thrift::TException("Unexpected message type");
+    }
+    if (print_) {
+      printf("%s (", fname.c_str());
+    }
+    if (frequency_) {
+      if (frequency_map_.find(fname) != frequency_map_.end()) {
+        frequency_map_[fname]++;
+      } else {
+        frequency_map_[fname] = 1;
+      }
+    }
+
+    facebook::thrift::protocol::TType ftype;
+    int16_t fid;
+
+    while (true) {
+      piprot_->readFieldBegin(fname, ftype, fid);
+      if (ftype == facebook::thrift::protocol::T_STOP) {
+        break;
+      }
+
+      printAndPassToBuffer(ftype);
+      if (print_) {
+        printf(", ");
+      }
+    }
+
+    if (print_) {
+      printf("\b\b)\n");
+    }
+    return true;
+  }
+
+  const std::map<std::string, int64_t>& get_frequency_map() {
+    return frequency_map_;
+  }
+
+protected:
+  void printAndPassToBuffer(facebook::thrift::protocol::TType ftype) {
+    switch (ftype) {
+      case facebook::thrift::protocol::T_BOOL:
+        {
+          bool boolv;
+          piprot_->readBool(boolv);
+          if (print_) {
+            printf("%d", boolv);
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_BYTE:
+        {
+          int8_t bytev;
+          piprot_->readByte(bytev);
+          if (print_) {
+            printf("%d", bytev);
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_I16:
+        {
+          int16_t i16;
+          piprot_->readI16(i16);
+          if (print_) {
+            printf("%d", i16);
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_I32:
+        {
+          int32_t i32;
+          piprot_->readI32(i32);
+          if (print_) {
+            printf("%d", i32);
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_I64:
+        {
+          int64_t i64;
+          piprot_->readI64(i64);
+          if (print_) {
+            printf("%ld", i64);
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_DOUBLE:
+        {
+          double dub; 
+          piprot_->readDouble(dub);
+          if (print_) {
+            printf("%f", dub);
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_STRING: 
+        {
+          std::string str;
+          piprot_->readString(str);
+          if (print_) {
+            printf("%s", str.c_str());
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_STRUCT: 
+        {
+          std::string name;
+          int16_t fid;
+          facebook::thrift::protocol::TType ftype;
+          piprot_->readStructBegin(name);
+          if (print_) {
+            printf("<");
+          }
+          while (true) {
+            piprot_->readFieldBegin(name, ftype, fid);
+            if (ftype == facebook::thrift::protocol::T_STOP) {
+              break;
+            }
+            printAndPassToBuffer(ftype);
+            if (print_) {
+              printf(",");
+            }
+            piprot_->readFieldEnd();
+          }
+          piprot_->readStructEnd();
+          if (print_) {
+            printf("\b>");
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_MAP:
+        {
+          facebook::thrift::protocol::TType keyType;
+          facebook::thrift::protocol::TType valType;
+          uint32_t i, size;
+          piprot_->readMapBegin(keyType, valType, size);
+          if (print_) {
+            printf("{");
+          }
+          for (i = 0; i < size; i++) {
+            printAndPassToBuffer(keyType);
+            if (print_) {
+              printf("=>");
+            }
+            printAndPassToBuffer(valType);
+            if (print_) {
+              printf(",");
+            }
+          }
+          piprot_->readMapEnd();
+          if (print_) {
+            printf("\b}");
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_SET:
+        {
+          facebook::thrift::protocol::TType elemType;
+          uint32_t i, size;
+          piprot_->readSetBegin(elemType, size);
+          if (print_) {
+            printf("{");
+          }
+          for (i = 0; i < size; i++) {
+            printAndPassToBuffer(elemType);
+            if (print_) {
+              printf(",");
+            }
+          }
+          piprot_->readSetEnd();
+          if (print_) {
+            printf("\b}");
+          }
+        }
+        break;
+      case facebook::thrift::protocol::T_LIST:
+        {
+          facebook::thrift::protocol::TType elemType;
+          uint32_t i, size;
+          piprot_->readListBegin(elemType, size);
+          if (print_) {
+            printf("[");
+          }
+          for (i = 0; i < size; i++) {
+            printAndPassToBuffer(elemType);
+            if (print_) {
+              printf(",");
+            }
+          }
+          piprot_->readListEnd();
+          if (print_) {
+            printf("\b]");
+          }
+        }
+        break;
+      default:
+        break;
+    }
+  }
+
+  boost::shared_ptr<facebook::thrift::protocol::TProtocol> piprot_;
+  std::map<std::string, int64_t> frequency_map_;
+
+  bool print_;
+  bool frequency_;
+};
+
+}}} // facebook::thrift::processor
+
+#endif

Added: hadoop/hive/trunk/service/include/thrift/protocol/TBinaryProtocol.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/protocol/TBinaryProtocol.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/protocol/TBinaryProtocol.h (added)
+++ hadoop/hive/trunk/service/include/thrift/protocol/TBinaryProtocol.h Sun Dec  7 20:25:22 2008
@@ -0,0 +1,239 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#ifndef _THRIFT_PROTOCOL_TBINARYPROTOCOL_H_
+#define _THRIFT_PROTOCOL_TBINARYPROTOCOL_H_ 1
+
+#include "TProtocol.h"
+
+#include <boost/shared_ptr.hpp>
+
+namespace facebook { namespace thrift { namespace protocol { 
+
+/**
+ * The default binary protocol for thrift. Writes all data in a very basic
+ * binary format, essentially just spitting out the raw bytes.
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+class TBinaryProtocol : public TProtocol {
+ protected:
+  static const int32_t VERSION_MASK = 0xffff0000;
+  static const int32_t VERSION_1 = 0x80010000;
+  // VERSION_2 (0x80020000)  is taken by TDenseProtocol.
+
+ public:
+  TBinaryProtocol(boost::shared_ptr<TTransport> trans) :
+    TProtocol(trans),
+    string_limit_(0),
+    container_limit_(0),
+    strict_read_(false),
+    strict_write_(true),
+    string_buf_(NULL),
+    string_buf_size_(0) {}
+
+  TBinaryProtocol(boost::shared_ptr<TTransport> trans,
+                  int32_t string_limit,
+                  int32_t container_limit,
+                  bool strict_read,
+                  bool strict_write) :
+    TProtocol(trans),
+    string_limit_(string_limit),
+    container_limit_(container_limit),
+    strict_read_(strict_read),
+    strict_write_(strict_write),
+    string_buf_(NULL),
+    string_buf_size_(0) {}
+
+  ~TBinaryProtocol() {
+    if (string_buf_ != NULL) {
+      free(string_buf_);
+      string_buf_size_ = 0;
+    }
+  }
+
+  void setStringSizeLimit(int32_t string_limit) {
+    string_limit_ = string_limit;
+  }
+
+  void setContainerSizeLimit(int32_t container_limit) {
+    container_limit_ = container_limit;
+  }
+
+  void setStrict(bool strict_read, bool strict_write) {
+    strict_read_ = strict_read;
+    strict_write_ = strict_write;
+  }
+
+  /**
+   * Writing functions.
+   */
+
+  virtual uint32_t writeMessageBegin(const std::string& name,
+                                     const TMessageType messageType,
+                                     const int32_t seqid);
+
+  virtual uint32_t writeMessageEnd();
+
+
+  uint32_t writeStructBegin(const std::string& name);
+
+  uint32_t writeStructEnd();
+
+  uint32_t writeFieldBegin(const std::string& name,
+                           const TType fieldType,
+                           const int16_t fieldId);
+
+  uint32_t writeFieldEnd();
+
+  uint32_t writeFieldStop();
+                                       
+  uint32_t writeMapBegin(const TType keyType,
+                         const TType valType,
+                         const uint32_t size);
+
+  uint32_t writeMapEnd();
+
+  uint32_t writeListBegin(const TType elemType,
+                          const uint32_t size);
+
+  uint32_t writeListEnd();
+
+  uint32_t writeSetBegin(const TType elemType,
+                         const uint32_t size);
+
+  uint32_t writeSetEnd();
+
+  uint32_t writeBool(const bool value);
+
+  uint32_t writeByte(const int8_t byte);
+
+  uint32_t writeI16(const int16_t i16);
+
+  uint32_t writeI32(const int32_t i32);
+
+  uint32_t writeI64(const int64_t i64);
+
+  uint32_t writeDouble(const double dub);
+
+
+  uint32_t writeString(const std::string& str);
+
+  /**
+   * Reading functions
+   */
+
+
+  uint32_t readMessageBegin(std::string& name,
+                            TMessageType& messageType,
+                            int32_t& seqid);
+
+  uint32_t readMessageEnd();
+
+  uint32_t readStructBegin(std::string& name);
+
+  uint32_t readStructEnd();
+
+  uint32_t readFieldBegin(std::string& name,
+                          TType& fieldType,
+                          int16_t& fieldId);
+  
+  uint32_t readFieldEnd();
+ 
+  uint32_t readMapBegin(TType& keyType,
+                        TType& valType,
+                        uint32_t& size);
+
+  uint32_t readMapEnd();
+
+  uint32_t readListBegin(TType& elemType,
+                         uint32_t& size);
+  
+  uint32_t readListEnd();
+
+  uint32_t readSetBegin(TType& elemType,
+                        uint32_t& size);
+
+  uint32_t readSetEnd();
+
+  uint32_t readBool(bool& value);
+
+  uint32_t readByte(int8_t& byte);
+
+  uint32_t readI16(int16_t& i16);
+
+  uint32_t readI32(int32_t& i32);
+
+  uint32_t readI64(int64_t& i64);
+
+  uint32_t readDouble(double& dub);
+
+  uint32_t readString(std::string& str);
+
+ protected:
+  uint32_t readStringBody(std::string& str, int32_t sz);
+
+  int32_t string_limit_;
+  int32_t container_limit_;
+
+  // Enforce presence of version identifier
+  bool strict_read_;
+  bool strict_write_;
+
+  // Buffer for reading strings, save for the lifetime of the protocol to
+  // avoid memory churn allocating memory on every string read
+  uint8_t* string_buf_;
+  int32_t string_buf_size_;
+
+};
+
+/**
+ * Constructs binary protocol handlers
+ */
+class TBinaryProtocolFactory : public TProtocolFactory {
+ public:
+  TBinaryProtocolFactory() :
+    string_limit_(0),
+    container_limit_(0),
+    strict_read_(false),
+    strict_write_(true) {}
+
+  TBinaryProtocolFactory(int32_t string_limit, int32_t container_limit, bool strict_read, bool strict_write) :
+    string_limit_(string_limit),
+    container_limit_(container_limit),
+    strict_read_(strict_read),
+    strict_write_(strict_write) {}
+
+  virtual ~TBinaryProtocolFactory() {}
+
+  void setStringSizeLimit(int32_t string_limit) {
+    string_limit_ = string_limit;
+  }
+
+  void setContainerSizeLimit(int32_t container_limit) {
+    container_limit_ = container_limit;
+  }
+
+  void setStrict(bool strict_read, bool strict_write) {
+    strict_read_ = strict_read;
+    strict_write_ = strict_write;
+  }
+
+  boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> trans) {
+    return boost::shared_ptr<TProtocol>(new TBinaryProtocol(trans, string_limit_, container_limit_, strict_read_, strict_write_));
+  }
+
+ private:
+  int32_t string_limit_;
+  int32_t container_limit_;
+  bool strict_read_;
+  bool strict_write_;
+
+};
+
+}}} // facebook::thrift::protocol
+
+#endif // #ifndef _THRIFT_PROTOCOL_TBINARYPROTOCOL_H_

Added: hadoop/hive/trunk/service/include/thrift/protocol/TDebugProtocol.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/protocol/TDebugProtocol.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/protocol/TDebugProtocol.h (added)
+++ hadoop/hive/trunk/service/include/thrift/protocol/TDebugProtocol.h Sun Dec  7 20:25:22 2008
@@ -0,0 +1,194 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#ifndef _THRIFT_PROTOCOL_TDEBUGPROTOCOL_H_
+#define _THRIFT_PROTOCOL_TDEBUGPROTOCOL_H_ 1
+
+#include "TProtocol.h"
+#include "TOneWayProtocol.h"
+
+#include <boost/shared_ptr.hpp>
+
+#include <transport/TTransportUtils.h>
+
+namespace facebook { namespace thrift { namespace protocol { 
+
+/*
+
+!!! EXPERIMENTAL CODE !!!
+
+This protocol is very much a work in progress.
+It doesn't handle many cases properly.
+It throws exceptions in many cases.
+It probably segfaults in many cases.
+Bug reports and feature requests are welcome.
+Complaints are not. :R
+
+*/
+
+
+/**
+ * Protocol that prints the payload in a nice human-readable format.
+ * Reading from this protocol is not supported.
+ *
+ * @author David Reiss <dreiss@facebook.com>
+ */
+class TDebugProtocol : public TWriteOnlyProtocol {
+ private:
+  enum write_state_t {
+    UNINIT,
+    STRUCT,
+    LIST,
+    SET,
+    MAP_KEY,
+    MAP_VALUE,
+  };
+
+ public:
+  TDebugProtocol(boost::shared_ptr<TTransport> trans)
+    : TWriteOnlyProtocol(trans, "TDebugProtocol")
+  {
+    write_state_.push_back(UNINIT);
+  }
+
+
+  virtual uint32_t writeMessageBegin(const std::string& name,
+                                     const TMessageType messageType,
+                                     const int32_t seqid);
+
+  virtual uint32_t writeMessageEnd();
+
+
+  uint32_t writeStructBegin(const std::string& name);
+
+  uint32_t writeStructEnd();
+
+  uint32_t writeFieldBegin(const std::string& name,
+                           const TType fieldType,
+                           const int16_t fieldId);
+
+  uint32_t writeFieldEnd();
+
+  uint32_t writeFieldStop();
+                                       
+  uint32_t writeMapBegin(const TType keyType,
+                         const TType valType,
+                         const uint32_t size);
+
+  uint32_t writeMapEnd();
+
+  uint32_t writeListBegin(const TType elemType,
+                          const uint32_t size);
+
+  uint32_t writeListEnd();
+
+  uint32_t writeSetBegin(const TType elemType,
+                         const uint32_t size);
+
+  uint32_t writeSetEnd();
+
+  uint32_t writeBool(const bool value);
+
+  uint32_t writeByte(const int8_t byte);
+
+  uint32_t writeI16(const int16_t i16);
+
+  uint32_t writeI32(const int32_t i32);
+
+  uint32_t writeI64(const int64_t i64);
+
+  uint32_t writeDouble(const double dub);
+
+  uint32_t writeString(const std::string& str);
+
+
+ private:
+  void indentUp();
+  void indentDown();
+  uint32_t writePlain(const std::string& str);
+  uint32_t writeIndented(const std::string& str);
+  uint32_t startItem();
+  uint32_t endItem();
+  uint32_t writeItem(const std::string& str);
+
+  static std::string fieldTypeName(TType type);
+
+  std::string indent_str_;
+  static const int indent_inc = 2;
+
+  std::vector<write_state_t> write_state_;
+  std::vector<int> list_idx_;
+};
+
+/**
+ * Constructs debug protocol handlers
+ */
+class TDebugProtocolFactory : public TProtocolFactory {
+ public:
+  TDebugProtocolFactory() {}
+  virtual ~TDebugProtocolFactory() {}
+
+  boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> trans) {
+    return boost::shared_ptr<TProtocol>(new TDebugProtocol(trans));
+  }
+
+};
+
+}}} // facebook::thrift::protocol
+
+
+namespace facebook { namespace thrift { 
+
+template<typename ThriftStruct>
+std::string ThriftDebugString(const ThriftStruct& ts) {
+  using namespace facebook::thrift::transport;
+  using namespace facebook::thrift::protocol;
+  TMemoryBuffer* buffer = new TMemoryBuffer;
+  boost::shared_ptr<TTransport> trans(buffer);
+  TDebugProtocol protocol(trans);
+
+  ts.write(&protocol);
+
+  uint8_t* buf;
+  uint32_t size;
+  buffer->getBuffer(&buf, &size);
+  return std::string((char*)buf, (unsigned int)size);
+}
+
+// TODO(dreiss): This is badly broken.  Don't use it unless you are me.
+#if 0
+template<typename Object>
+std::string DebugString(const std::vector<Object>& vec) {
+  using namespace facebook::thrift::transport;
+  using namespace facebook::thrift::protocol;
+  TMemoryBuffer* buffer = new TMemoryBuffer;
+  boost::shared_ptr<TTransport> trans(buffer);
+  TDebugProtocol protocol(trans);
+
+  // I am gross!
+  protocol.writeStructBegin("SomeRandomVector");
+
+  // TODO: Fix this with a trait.
+  protocol.writeListBegin((TType)99, vec.size());
+  typename std::vector<Object>::const_iterator it;
+  for (it = vec.begin(); it != vec.end(); ++it) {
+    it->write(&protocol);
+  }
+  protocol.writeListEnd();
+
+  uint8_t* buf;
+  uint32_t size;
+  buffer->getBuffer(&buf, &size);
+  return std::string((char*)buf, (unsigned int)size);
+}
+#endif // 0
+
+}} // facebook::thrift
+
+
+#endif // #ifndef _THRIFT_PROTOCOL_TDEBUGPROTOCOL_H_
+
+

Added: hadoop/hive/trunk/service/include/thrift/protocol/TDenseProtocol.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/service/include/thrift/protocol/TDenseProtocol.h?rev=724247&view=auto
==============================================================================
--- hadoop/hive/trunk/service/include/thrift/protocol/TDenseProtocol.h (added)
+++ hadoop/hive/trunk/service/include/thrift/protocol/TDenseProtocol.h Sun Dec  7 20:25:22 2008
@@ -0,0 +1,238 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+#ifndef _THRIFT_PROTOCOL_TDENSEPROTOCOL_H_
+#define _THRIFT_PROTOCOL_TDENSEPROTOCOL_H_ 1
+
+#include "TBinaryProtocol.h"
+
+namespace facebook { namespace thrift { namespace protocol {
+
+/**
+ * !!!WARNING!!!
+ * This class is still highly experimental.  Incompatible changes
+ * WILL be made to it without notice.  DO NOT USE IT YET unless
+ * you are coordinating your testing with the author.
+ *
+ * The dense protocol is designed to use as little space as possible.
+ *
+ * There are two types of dense protocol instances.  Standalone instances
+ * are not used for RPC and just encoded and decode structures of 
+ * a predetermined type.  Non-standalone instances are used for RPC.
+ * Currently, only standalone instances exist.
+ *
+ * To use a standalone dense protocol object, you must set the type_spec
+ * property (either in the constructor, or with setTypeSpec) to the local
+ * reflection TypeSpec of the structures you will write to (or read from) the
+ * protocol instance.
+ *
+ * BEST PRACTICES:
+ * - Never use optional for primitives or containers.
+ * - Only use optional for structures if they are very big and very rarely set.
+ * - All integers are variable-length, so you can use i64 without bloating.
+ * - NEVER EVER change the struct definitions IN ANY WAY without either
+ *   changing your cache keys or talking to dreiss.
+ *
+ * TODO(dreiss): New class write with old meta.
+ *
+ * We override all of TBinaryProtocol's methods.
+ * We inherit so that we can can explicitly call TBPs's primitive-writing
+ * methods within our versions.
+ *
+ * @author David Reiss <dreiss@facebook.com>
+ */
+class TDenseProtocol : public TBinaryProtocol {
+ protected:
+  static const int32_t VERSION_MASK = 0xffff0000;
+  // VERSION_1 (0x80010000)  is taken by TBinaryProtocol.
+  static const int32_t VERSION_2 = 0x80020000;
+
+ public:
+  typedef facebook::thrift::reflection::local::TypeSpec TypeSpec;
+  static const int FP_PREFIX_LEN;
+
+  /**
+   * @param tran       The transport to use.
+   * @param type_spec  The TypeSpec of the structures using this protocol.
+   */
+  TDenseProtocol(boost::shared_ptr<TTransport> trans,
+                 TypeSpec* type_spec = NULL) :
+    TBinaryProtocol(trans),
+    type_spec_(type_spec),
+    standalone_(true)
+  {}
+
+  void setTypeSpec(TypeSpec* type_spec) {
+    type_spec_ = type_spec;
+  }
+  TypeSpec* getTypeSpec() {
+    return type_spec_;
+  }
+
+
+  /*
+   * Writing functions.
+   */
+
+  virtual uint32_t writeMessageBegin(const std::string& name,
+                                     const TMessageType messageType,
+                                     const int32_t seqid);
+
+  virtual uint32_t writeMessageEnd();
+
+
+  virtual uint32_t writeStructBegin(const std::string& name);
+
+  virtual uint32_t writeStructEnd();
+
+  virtual uint32_t writeFieldBegin(const std::string& name,
+                                   const TType fieldType,
+                                   const int16_t fieldId);
+
+  virtual uint32_t writeFieldEnd();
+
+  virtual uint32_t writeFieldStop();
+
+  virtual uint32_t writeMapBegin(const TType keyType,
+                                 const TType valType,
+                                 const uint32_t size);
+
+  virtual uint32_t writeMapEnd();
+
+  virtual uint32_t writeListBegin(const TType elemType,
+                                  const uint32_t size);
+
+  virtual uint32_t writeListEnd();
+
+  virtual uint32_t writeSetBegin(const TType elemType,
+                                 const uint32_t size);
+
+  virtual uint32_t writeSetEnd();
+
+  virtual uint32_t writeBool(const bool value);
+
+  virtual uint32_t writeByte(const int8_t byte);
+
+  virtual uint32_t writeI16(const int16_t i16);
+
+  virtual uint32_t writeI32(const int32_t i32);
+
+  virtual uint32_t writeI64(const int64_t i64);
+
+  virtual uint32_t writeDouble(const double dub);
+
+  virtual uint32_t writeString(const std::string& str);
+
+
+  /*
+   * Helper writing functions (don't do state transitions).
+   */
+  inline uint32_t subWriteI32(const int32_t i32);
+
+  inline uint32_t subWriteString(const std::string& str);
+
+  uint32_t subWriteBool(const bool value) {
+    return TBinaryProtocol::writeBool(value);
+  }
+
+
+  /*
+   * Reading functions
+   */
+
+  uint32_t readMessageBegin(std::string& name,
+                            TMessageType& messageType,
+                            int32_t& seqid);
+
+  uint32_t readMessageEnd();
+
+  uint32_t readStructBegin(std::string& name);
+
+  uint32_t readStructEnd();
+
+  uint32_t readFieldBegin(std::string& name,
+                          TType& fieldType,
+                          int16_t& fieldId);
+
+  uint32_t readFieldEnd();
+
+  uint32_t readMapBegin(TType& keyType,
+                        TType& valType,
+                        uint32_t& size);
+
+  uint32_t readMapEnd();
+
+  uint32_t readListBegin(TType& elemType,
+                         uint32_t& size);
+
+  uint32_t readListEnd();
+
+  uint32_t readSetBegin(TType& elemType,
+                        uint32_t& size);
+
+  uint32_t readSetEnd();
+
+  uint32_t readBool(bool& value);
+
+  uint32_t readByte(int8_t& byte);
+
+  uint32_t readI16(int16_t& i16);
+
+  uint32_t readI32(int32_t& i32);
+
+  uint32_t readI64(int64_t& i64);
+
+  uint32_t readDouble(double& dub);
+
+  uint32_t readString(std::string& str);
+
+
+  /*
+   * Helper reading functions (don't do state transitions).
+   */
+  inline uint32_t subReadI32(int32_t& i32);
+
+  inline uint32_t subReadString(std::string& str);
+
+  uint32_t subReadBool(bool& value) {
+    return TBinaryProtocol::readBool(value);
+  }
+
+
+ private:
+
+  // Implementation functions, documented in the .cpp.
+  inline void checkTType(const TType ttype);
+  inline void stateTransition();
+
+  // Read and write variable-length integers.
+  // Uses the same technique as the MIDI file format.
+  inline uint32_t vlqRead(uint64_t& vlq);
+  inline uint32_t vlqWrite(uint64_t vlq);
+
+  // Called before throwing an exception to make the object reusable.
+  void resetState() {
+    ts_stack_.clear();
+    idx_stack_.clear();
+    mkv_stack_.clear();
+  }
+
+  // TypeSpec of the top-level structure to write,
+  // for standalone protocol objects.
+  TypeSpec* type_spec_;
+
+  std::vector<TypeSpec*> ts_stack_;   // TypeSpec stack.
+  std::vector<int>       idx_stack_;  // InDeX stack.
+  std::vector<bool>      mkv_stack_;  // Map Key/Vlue stack.
+                                      // True = key, False = value.
+
+  // True iff this is a standalone instance (no RPC).
+  bool standalone_;
+};
+
+}}} // facebook::thrift::protocol
+
+#endif // #ifndef _THRIFT_PROTOCOL_TDENSEPROTOCOL_H_



Mime
View raw message