From 0b36a2d9c0a40ca51014e723dddd74e4bbb5d291 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Sat, 7 Feb 2009 02:36:43 +0000 Subject: [PATCH] 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 --- contrib/fb303/py/fb303/FacebookBase.py | 69 ++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 contrib/fb303/py/fb303/FacebookBase.py diff --git a/contrib/fb303/py/fb303/FacebookBase.py b/contrib/fb303/py/fb303/FacebookBase.py new file mode 100644 index 00000000..d0cf89b4 --- /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 -- 2.17.1