data_store_interface.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. from abc import ABC, abstractmethod
  2. from models.process_data import ProcessData
  3. class IDataStore(ABC):
  4. """
  5. 定义数据保存接口
  6. """
  7. @abstractmethod
  8. def insert_collect_data(self,
  9. url: str,
  10. keyword: str,
  11. content: str,
  12. is_batch=True) -> None:
  13. raise NotImplementedError("insert 应由子类重写。")
  14. @abstractmethod
  15. def save_collect_data(self, is_force=False):
  16. raise NotImplementedError("save 应由子类重写。")
  17. @abstractmethod
  18. def query_urls_to_process(self):
  19. raise NotImplementedError("query_to_process 应由子类重写。")
  20. @abstractmethod
  21. def query_one_collect_by_url(self, url):
  22. raise NotImplementedError("query_one_collect_by_url 应由子类重写。")
  23. @abstractmethod
  24. def query_one_process_by_no(self, no):
  25. raise NotImplementedError("query_one_process_by_no 应由子类重写。")
  26. @abstractmethod
  27. def insert_process_data(self, data: ProcessData):
  28. raise NotImplementedError("insert_process_data 应由子类重写。")
  29. @abstractmethod
  30. def save_process_data(self, is_force=False):
  31. raise NotImplementedError("save_process_data 应由子类重写。")
  32. @abstractmethod
  33. def set_process_other_urls(self, url, other_urls: str):
  34. raise NotImplementedError("save_process_data 应由子类重写。")
  35. @abstractmethod
  36. def query_to_send(self):
  37. raise NotImplementedError("query_to_send 应由子类重写。")
  38. @abstractmethod
  39. def set_send(self, no: str):
  40. raise NotImplementedError("set_send 应由子类重写。")
  41. @abstractmethod
  42. def get_email_by_area(self, area: str):
  43. raise NotImplementedError("get_email_by_area 应由子类重写。")