blob: 685ff20f38c4d553284d5964f3c09e01b1a97326 [file] [log] [blame]
David Reiss0b36a2d2009-02-07 02:36:43 +00001#!/usr/bin/env python
David Reissea2cba82009-03-30 21:35:00 +00002
David Reiss0b36a2d2009-02-07 02:36:43 +00003#
David Reissea2cba82009-03-30 21:35:00 +00004# Licensed to the Apache Software Foundation (ASF) under one
5# or more contributor license agreements. See the NOTICE file
6# distributed with this work for additional information
7# regarding copyright ownership. The ASF licenses this file
8# to you under the Apache License, Version 2.0 (the
9# "License"); you may not use this file except in compliance
10# with the License. You may obtain a copy of the License at
David Reiss0b36a2d2009-02-07 02:36:43 +000011#
David Reissea2cba82009-03-30 21:35:00 +000012# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing,
15# software distributed under the License is distributed on an
16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17# KIND, either express or implied. See the License for the
18# specific language governing permissions and limitations
19# under the License.
20#
David Reiss0b36a2d2009-02-07 02:36:43 +000021
22import time
23import FacebookService
24import thrift.reflection.limited
25from ttypes import fb_status
26
27class FacebookBase(FacebookService.Iface):
28
29 def __init__(self, name):
30 self.name = name
31 self.alive = int(time.time())
32 self.counters = {}
33
34 def getName(self, ):
35 return self.name
36
37 def getVersion(self, ):
38 return ''
39
40 def getStatus(self, ):
41 return fb_status.ALIVE
42
43 def getCounters(self):
44 return self.counters
45
46 def resetCounter(self, key):
47 self.counters[key] = 0
48
49 def getCounter(self, key):
50 if self.counters.has_key(key):
51 return self.counters[key]
52 return 0
53
54 def incrementCounter(self, key):
55 self.counters[key] = self.getCounter(key) + 1
56
57 def setOption(self, key, value):
58 pass
59
60 def getOption(self, key):
61 return ""
62
63 def getOptions(self):
64 return {}
65
66 def getOptions(self):
67 return {}
68
69 def aliveSince(self):
70 return self.alive
71
72 def getCpuProfile(self, duration):
73 return ""
74
75 def getLimitedReflection(self):
76 return thrift.reflection.limited.Service()
77
78 def reinitialize(self):
79 pass
80
81 def shutdown(self):
82 pass