From 42a47d9bbeeaf3a9cf656b0e8c4d9422c861daaa Mon Sep 17 00:00:00 2001 From: schdwlk Date: Sun, 29 Mar 2020 15:54:52 +0200 Subject: [PATCH] Created ConsumerLocator skeleton --- ConsumerLocator.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/ConsumerLocator.py b/ConsumerLocator.py index 8e95b4c..22ac703 100644 --- a/ConsumerLocator.py +++ b/ConsumerLocator.py @@ -11,6 +11,40 @@ __copyright__ = "Copyright 2020, GoldenPogácsa Team" __module_name__ = "consumerlocator" __version__text__ = "1" + class ConsumerLocator: + def __init__(self): + self.consumerList = ["KnownHost"] + self.currentConsumer = self.consumerList[0] pass + + def learnConsumerList(self): + """" + Learns the list of consumers. + """ + pass + + def updateConsumer(self): + """ + Updates the current consumer. + :return: + """ + self.currentConsumer = self.consumerList[0] + + def getCurrentConsumer(self): + """ + Returns the currently selected consumer. + :return: the current consumer + """ + return self.currentConsumer + + def checkConsumer(self): + """ + Check the consumers health. + :return: True if OK, False if fail + """ + if communicator.ping(self.currentConsumer): + return True + else: + return False