summaryrefslogtreecommitdiffstats
path: root/module/PullEvents.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/PullEvents.py')
-rw-r--r--module/PullEvents.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/module/PullEvents.py b/module/PullEvents.py
index 5ec76765e..b8859a9a6 100644
--- a/module/PullEvents.py
+++ b/module/PullEvents.py
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
-
+
@author: mkaay
"""
@@ -24,15 +24,15 @@ class PullManager():
def __init__(self, core):
self.core = core
self.clients = []
-
+
def newClient(self, uuid):
self.clients.append(Client(uuid))
-
+
def clean(self):
for n, client in enumerate(self.clients):
if client.lastActive + 30 < time():
del self.clients[n]
-
+
def getEvents(self, uuid):
events = []
validUuid = False
@@ -47,7 +47,7 @@ class PullManager():
self.newClient(uuid)
events = [ReloadAllEvent("queue").toList(), ReloadAllEvent("collector").toList()]
return uniqify(events, repr)
-
+
def addEvent(self, event):
for client in self.clients:
client.addEvent(event)
@@ -57,15 +57,15 @@ class Client():
self.uuid = uuid
self.lastActive = time()
self.events = []
-
+
def newEvents(self):
return len(self.events) > 0
-
+
def popEvent(self):
if not len(self.events):
return None
return self.events.pop(0)
-
+
def addEvent(self, event):
self.events.append(event)
@@ -76,7 +76,7 @@ class UpdateEvent():
self.type = itype
self.id = iid
self.destination = destination
-
+
def toList(self):
return ["update", self.destination, self.type, self.id]
@@ -87,7 +87,7 @@ class RemoveEvent():
self.type = itype
self.id = iid
self.destination = destination
-
+
def toList(self):
return ["remove", self.destination, self.type, self.id]
@@ -99,7 +99,7 @@ class InsertEvent():
self.id = iid
self.after = after
self.destination = destination
-
+
def toList(self):
return ["insert", self.destination, self.type, self.id, self.after]
@@ -107,7 +107,7 @@ class ReloadAllEvent():
def __init__(self, destination):
assert destination == "queue" or destination == "collector"
self.destination = destination
-
+
def toList(self):
return ["reload", self.destination]