From 4855a691e8828247ef81fe9fad7e761675bd5f02 Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Wed, 24 Aug 2011 18:57:54 +0300 Subject: [PATCH] ppf/new: Add top.py. --- ppf/new/top.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ppf/new/top.py diff --git a/ppf/new/top.py b/ppf/new/top.py new file mode 100644 index 0000000..5c0aa2b --- /dev/null +++ b/ppf/new/top.py @@ -0,0 +1,27 @@ +""" +Top level functions for parsing and storing information. + +2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro +""" + +import storage +import parsing + +def parse_store_session(writer, parser, session_id): + """ + Parse and store information for a BitTorrent session. + + writer is an instance of the storage.SwarmWriter class. + parser is an instance of the parsing.LogParser class (may be + LibtorrentLogParser, TriblerLogParser or some other). + session_id is the client session id. + """ + + while True: + msg = parser.get_next_message() + # In case of no more messages, exit loop. + if msg == None: + break + + msg.set_client_session_id(session_id) + writer.add_message(msg) -- 2.20.1