Explorar o código

adding flush function to transport, it addresses the problem of data growth

Steve L. Nyemba %!s(int64=8) %!d(string=hai) anos
pai
achega
fb6d0df6f0
Modificáronse 1 ficheiros con 14 adicións e 1 borrados
  1. 14 1
      src/utils/transport.py

+ 14 - 1
src/utils/transport.py

@@ -105,6 +105,15 @@ class Writer:
 		elif xchar is None and isinstance(row,dict):
 			row = json.dumps(row)
 		return row
+	"""
+		It is important to be able to archive data so as to insure that growth is controlled
+		Nothing in nature grows indefinitely neither should data being handled.
+	"""
+	def archive(self):
+		pass
+	def flush(self):
+		pass
+	
 """
   This class is designed to read data from an Http request file handler provided to us by flask
   The file will be heald in memory and processed accordingly
@@ -314,7 +323,11 @@ class QueueWriter(MessageQueue,Writer):
 		);
 		self.close()
 
-
+	def flush(self,label):
+		self.init(label)
+		_mode = 1  #-- Non persistent
+		self.channel.queue_delete( queue=label);
+		self.close()
 		
 """
 	This class will read from a queue provided an exchange, queue and host