Esempio n. 1
0
 def __init__(self, storage):
     threading.Thread.__init__(self)
     self.storage = storage
     
     conf = config.getSub("retriever")
     self.interval = conf.get("interval", cast = config.nonNegativeFloat, default = 60.0)
     self.mask = re.compile(conf.get("mask", default = ".*"))
     self.strategy = conf.get("timestamp", cast = Retriever.castStrategy, default = BY_MTIME)
     self.feed = conf.get("feed", cast = config.directory, default = join(config.workDir, "feed"))
     self.batchSize = conf.get("batch", cast = config.positiveInt, default = 1)
     
     self.running = self.interval > 0.0
Esempio n. 2
0
 def __init__(self, storage):
     threading.Thread.__init__(self)
     self.storage = storage
     
     conf = config.getSub("bluetooth")
     self.channel = conf.get("rfcomm_channel", cast = config.channel, default = 2)
     self.batch = conf.get("batch", cast = config.positiveInt, default = 100)
     self.timeout = conf.get("timeout", cast = config.positiveFloat, default = 10.0)
     self.delSent = conf.get("delete_sent", cast = config.boolean, default = False)
     
     self.running = True
     self.server_sock = None
Esempio n. 3
0
 def __init__(self):
     self.dbLock = False
     
     conf = config.getSub("storage")
     self.capacity = conf.get("capacity", cast = config.positiveInt, default = 2048)
     self.vacPercent = conf.get("vacuum_percent", cast = config.positivePercent, default = 20.0) / 100
     self.timeout = conf.get("timeout", cast = config.positiveFloat, default = 10.0)
     
     try:
         conn = sqlite3.connect(self.dbFile())
         with conn:
             conn.execute("CREATE TABLE IF NOT EXISTS packets (timestamp INT8, data BLOB)")
         self.vaccum()
     except Exception:
         log.critical("Failed to initialize database", exc_info = 1)
         sys.exit(1)
     
     self.connections = {}
     self.connectionId = genConnId()
     log.info("Database initialized")