base.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Use of this source code is governed by a BSD-style
  2. # license that can be found in the LICENSE file.
  3. # Copyright 2019 The OSArchiver Authors. All rights reserved.
  4. """
  5. Source abstract base class file
  6. """
  7. from abc import ABCMeta, abstractmethod
  8. class Source(metaclass=ABCMeta):
  9. """
  10. The source absrtact base class
  11. """
  12. def __init__(self, name=None, backend=None, conf=None):
  13. """
  14. Source object is defined by a name and a backend
  15. """
  16. self.name = name
  17. self.backend = backend
  18. self.conf = conf
  19. @abstractmethod
  20. def read(self, **kwargs):
  21. """
  22. read method that should be implemented by the backend
  23. """
  24. @abstractmethod
  25. def delete(self, **kwargs):
  26. """
  27. delete method that should be implemented by the backend
  28. """
  29. @abstractmethod
  30. def clean_exit(self):
  31. """
  32. clean_exit method that should be implemented by the backend
  33. provide a way to close and clean properly backend stuff
  34. """