blob: d0cf89b43c76d37af8d25d589fdc860b001870f4 [file] [log] [blame]
David Reiss0b36a2d2009-02-07 02:36:43 +00001#!/usr/bin/env python
2#
3# Copyright (c) 2006- Facebook
4# Distributed under the Thrift Software License
5#
6# See accompanying file LICENSE or visit the Thrift site at:
7# http://developers.facebook.com/thrift/
8
9import time
10import FacebookService
11import thrift.reflection.limited
12from ttypes import fb_status
13
14class FacebookBase(FacebookService.Iface):
15
16 def __init__(self, name):
17 self.name = name
18 self.alive = int(time.time())
19 self.counters = {}
20
21 def getName(self, ):
22 return self.name
23
24 def getVersion(self, ):
25 return ''
26
27 def getStatus(self, ):
28 return fb_status.ALIVE
29
30 def getCounters(self):
31 return self.counters
32
33 def resetCounter(self, key):
34 self.counters[key] = 0
35
36 def getCounter(self, key):
37 if self.counters.has_key(key):
38 return self.counters[key]
39 return 0
40
41 def incrementCounter(self, key):
42 self.counters[key] = self.getCounter(key) + 1
43
44 def setOption(self, key, value):
45 pass
46
47 def getOption(self, key):
48 return ""
49
50 def getOptions(self):
51 return {}
52
53 def getOptions(self):
54 return {}
55
56 def aliveSince(self):
57 return self.alive
58
59 def getCpuProfile(self, duration):
60 return ""
61
62 def getLimitedReflection(self):
63 return thrift.reflection.limited.Service()
64
65 def reinitialize(self):
66 pass
67
68 def shutdown(self):
69 pass