summaryrefslogtreecommitdiff
path: root/contrib/fb303
diff options
context:
space:
mode:
authorDavid Reiss <dreiss@apache.org>2009-02-07 02:36:43 +0000
committerDavid Reiss <dreiss@apache.org>2009-02-07 02:36:43 +0000
commit0b36a2d9c0a40ca51014e723dddd74e4bbb5d291 (patch)
treeb03039ac8924e72663ce0707876d96f52d210eb1 /contrib/fb303
parent0b7d6fa5ee27dcfe60ed946c99fbc1c664bb4057 (diff)
downloadthrift-0b36a2d9c0a40ca51014e723dddd74e4bbb5d291.tar.gz
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
Diffstat (limited to 'contrib/fb303')
-rw-r--r--contrib/fb303/py/fb303/FacebookBase.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/contrib/fb303/py/fb303/FacebookBase.py b/contrib/fb303/py/fb303/FacebookBase.py
new file mode 100644
index 000000000..d0cf89b43
--- /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