def updateBloomFilter(self, request, context): nodeids = self.node.get_active_node_ids() dates_set = set() for node in nodeids: client = self.node.get_client(node) if client is None: continue data = client.getUniqueDateIds() for d in data.dates: dates_set.add(d.date) c = CreateBloomFilter(len(dates_set), dates_set) self.node.bloomfilter = c return server_pb2.BoolResponse(result=True)
def requestVote(self, request, context): logger.info("Requesting vote %d", request.id) res = self.node.giveVote(request.id) return server_pb2.BoolResponse(result=res)
def setLeader(self, request, context): logger.info("Setting leader %d", request.id) self.node.leader_id = request.id self.node.voted = False return server_pb2.BoolResponse(result=True)
def pingInternal(self, request, context): return server_pb2.BoolResponse(result=True)