def reset(self):
     self.reset_event.set()
     PrintLogger.print("in datasource going to reset")
     self.set_continue_lock(False)
     self._is_reading.clear()
     self._need_to_vaccum.clear()
     SiteTempDataDisk.reset(self)
     FileBuffInterface.reset(self)
     PrintLogger.print("in datasource reset completed")
     self.reset_event.clear()
 def __init__(self, *args, output_buff_size=2000, output_f=1000, **kwargs):
     SiteTempDataDisk.__init__(self, *args, **kwargs)
     FileBuffInterface.__init__(self,
                                self.ref,
                                output_buff_size=output_buff_size,
                                output_f=output_f,
                                power_save_mode=True)
     self._is_reading = Event()
     self._need_to_vaccum = Event()
     self.set_db_update_interval(5)
     self._total_record = SiteTempDataDisk.count_all(self)
     if 0 < self._total_record <= self._output_counter:
         self.set_continue_lock(False)
    def __init__(self,
                 file_name,
                 worker: ExternalTempInterface,
                 stop_event: Event,
                 buf_size=200,
                 output_f=1000,
                 dir_path="",
                 table_name="temp",
                 convert_input=True,
                 convert_output=True,
                 terminate_callback=None):
        """

        :param file_name:
        :param worker:
        :param stop_event:
        :param buf_size:
        :param dir_path:
        :param table_name:
        :param convert_input:
        :param convert_output: convert output to OnSiteLink by default, else return raw tuple data.
        :return:
        """
        self._file_name = file_name
        if len(dir_path) > 0:
            self._file_dir = dir_path
        else:
            self._file_dir = get_temp_db_dir()
        self._file_path = self._file_dir + self._file_name
        PrintLogger.print("ExternalTempDataDiskBuffer create path in init: " +
                          self._file_path)
        FileHandler.create_file_if_not_exist(self._file_path)
        self.stop_event = stop_event
        self._tab = table_name
        self._worker = worker
        self._get_lock = threading.RLock()
        self._put_lock = threading.RLock()
        self._convert_input = convert_input
        self._convert_output = convert_output
        FileBuffInterface.__init__(self,
                                   self._file_name,
                                   buf_size,
                                   output_f=output_f,
                                   power_save_mode=True,
                                   terminate_callback=terminate_callback)
        self.set_db_update_interval(10)

        self._is_reading = Event()
        self._need_to_vaccum = Event()
        self._total_record = self.count_all()
    def __init__(self, file_name,  worker: ExternalTempInterface, stop_event: Event, buf_size=200, output_f=1000,
                 dir_path="",  table_name="temp", convert_input=True, convert_output=True, terminate_callback=None):
        """

        :param file_name:
        :param worker:
        :param stop_event:
        :param buf_size:
        :param dir_path:
        :param table_name:
        :param convert_input:
        :param convert_output: convert output to OnSiteLink by default, else return raw tuple data.
        :return:
        """
        self._file_name = file_name
        if len(dir_path) > 0:
            self._file_dir = dir_path
        else:
            self._file_dir = get_temp_db_dir()
        self._file_path = self._file_dir + self._file_name
        PrintLogger.print("ExternalTempDataDiskBuffer create path in init: " + self._file_path)
        FileHandler.create_file_if_not_exist(self._file_path)
        self.stop_event = stop_event
        self._tab = table_name
        self._worker = worker
        self._get_lock = threading.RLock()
        self._put_lock = threading.RLock()
        self._convert_input = convert_input
        self._convert_output = convert_output
        FileBuffInterface.__init__(self, self._file_name, buf_size, output_f=output_f, power_save_mode=True,
                                   terminate_callback=terminate_callback)
        self.set_db_update_interval(10)

        self._is_reading = Event()
        self._need_to_vaccum = Event()
        self._total_record = self.count_all()
 def can_continue(self):
     return FileBuffInterface.can_continue(self)
 def set_continue_lock(self, can_contiune=True):
     SiteTempDataDisk.set_continue_lock(self, can_contiune)
     FileBuffInterface.set_continue_lock(self, can_contiune)
 def set_progress(self, progress: int):
     SiteTempDataDisk.set_progress(self, progress)
     FileBuffInterface.set_progress(self, progress)
 def __next__(self):
     return FileBuffInterface.__next__(self)
 def __iter__(self):
     return FileBuffInterface.__iter__(self)
 def can_continue(self):
     return FileBuffInterface.can_continue(self)