THRIFT-292. Restore fb303/FacebookBase.py
This file was deleted in r739384, but is is not generated code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@741825 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/contrib/fb303/py/fb303/FacebookBase.py b/contrib/fb303/py/fb303/FacebookBase.py
new file mode 100644
index 0000000..d0cf89b
--- /dev/null
+++ b/contrib/fb303/py/fb303/FacebookBase.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# 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/
+
+import time
+import FacebookService
+import thrift.reflection.limited
+from ttypes import fb_status
+
+class FacebookBase(FacebookService.Iface):
+
+ def __init__(self, name):
+ self.name = name
+ self.alive = int(time.time())
+ self.counters = {}
+
+ def getName(self, ):
+ return self.name
+
+ def getVersion(self, ):
+ return ''
+
+ def getStatus(self, ):
+ return fb_status.ALIVE
+
+ def getCounters(self):
+ return self.counters
+
+ def resetCounter(self, key):
+ self.counters[key] = 0
+
+ def getCounter(self, key):
+ if self.counters.has_key(key):
+ return self.counters[key]
+ return 0
+
+ def incrementCounter(self, key):
+ self.counters[key] = self.getCounter(key) + 1
+
+ def setOption(self, key, value):
+ pass
+
+ def getOption(self, key):
+ return ""
+
+ def getOptions(self):
+ return {}
+
+ def getOptions(self):
+ return {}
+
+ def aliveSince(self):
+ return self.alive
+
+ def getCpuProfile(self, duration):
+ return ""
+
+ def getLimitedReflection(self):
+ return thrift.reflection.limited.Service()
+
+ def reinitialize(self):
+ pass
+
+ def shutdown(self):
+ pass