Exemple #1
0
 def get_slice(self,column,start,end):
     stream = StreamingTupleWithCallback(self._get_item_callback,
                                         self._get_length_callback)
     stream.set_meta('data',PeriodicLog.get_slice(self,column,start,end,1))
     return stream
Exemple #2
0
 def _setup_data_stream(self,log,callback,start,end,extended,meta=None):
     if meta is None:
         meta = {}
     stream = StreamingTupleWithCallback(callback,self._get_stream_length)
     stream.set_meta('begin',start)
     stream.set_meta('end',end)
     stream.set_meta('log', log)
     stream.set_meta('extended', extended)
     positive = {'index':0}
     negative = {'index':-1}
     positive['seek'] = start
     log.seek(end)
     line = _readline_backwards(log)
     negative['seek'] = log.tell()
     positive['last'] = None
     negative['last'] = None
     stream.set_meta('positive',positive)
     stream.set_meta('negative',negative)
     stream.get_meta().update(meta)
     try:
         callback(-1,stream)
         callback(0,stream)
     except IndexError:
         pass
     return stream