blob: 07db10cd3def6583ec0377be7c6c5aeed4b3fa06 [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
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090027
David Reiss0b36a2d2009-02-07 02:36:43 +000028class FacebookBase(FacebookService.Iface):
29
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090030 def __init__(self, name):
31 self.name = name
32 self.alive = int(time.time())
33 self.counters = {}
David Reiss0b36a2d2009-02-07 02:36:43 +000034
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090035 def getName(self, ):
36 return self.name
David Reiss0b36a2d2009-02-07 02:36:43 +000037
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090038 def getVersion(self, ):
39 return ''
David Reiss0b36a2d2009-02-07 02:36:43 +000040
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090041 def getStatus(self, ):
42 return fb_status.ALIVE
David Reiss0b36a2d2009-02-07 02:36:43 +000043
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090044 def getCounters(self):
45 return self.counters
David Reiss0b36a2d2009-02-07 02:36:43 +000046
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090047 def resetCounter(self, key):
48 self.counters[key] = 0
David Reiss0b36a2d2009-02-07 02:36:43 +000049
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090050 def getCounter(self, key):
51 if self.counters.has_key(key):
52 return self.counters[key]
53 return 0
David Reiss0b36a2d2009-02-07 02:36:43 +000054
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090055 def incrementCounter(self, key):
56 self.counters[key] = self.getCounter(key) + 1
David Reiss0b36a2d2009-02-07 02:36:43 +000057
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090058 def setOption(self, key, value):
59 pass
David Reiss0b36a2d2009-02-07 02:36:43 +000060
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090061 def getOption(self, key):
62 return ""
David Reiss0b36a2d2009-02-07 02:36:43 +000063
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090064 def getOptions(self):
65 return {}
David Reiss0b36a2d2009-02-07 02:36:43 +000066
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090067 def getOptions(self):
68 return {}
David Reiss0b36a2d2009-02-07 02:36:43 +000069
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090070 def aliveSince(self):
71 return self.alive
David Reiss0b36a2d2009-02-07 02:36:43 +000072
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090073 def getCpuProfile(self, duration):
74 return ""
David Reiss0b36a2d2009-02-07 02:36:43 +000075
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090076 def getLimitedReflection(self):
77 return thrift.reflection.limited.Service()
David Reiss0b36a2d2009-02-07 02:36:43 +000078
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090079 def reinitialize(self):
80 pass
David Reiss0b36a2d2009-02-07 02:36:43 +000081
Nobuaki Sukegawa10308cb2016-02-03 01:57:03 +090082 def shutdown(self):
83 pass