base_non_rdf_layout.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import logging
  2. from abc import ABCMeta, abstractmethod
  3. logger = logging.getLogger(__name__)
  4. class BaseNonRdfLayout(metaclass=ABCMeta):
  5. """
  6. Abstract class for setting the non-RDF (bitstream) store layout.
  7. Differerent layouts can be created by implementing all the abstract methods
  8. of this class. A non-RDF layout is not necessarily restricted to a
  9. traditional filesystem—e.g. a layout persisting to HDFS can be written too.
  10. """
  11. def __init__(self, config):
  12. """
  13. Initialize the base non-RDF store layout.
  14. """
  15. self.config = config
  16. self.root = config['location']
  17. ## INTERFACE METHODS ##
  18. @abstractmethod
  19. def persist(self, stream):
  20. """Store the stream in the designated persistence layer."""
  21. pass
  22. @abstractmethod
  23. def delete(self, id):
  24. """Delete a stream by its identifier (i.e. checksum)."""
  25. pass
  26. @abstractmethod
  27. def local_path(self, uuid):
  28. """Return the local path of a file."""
  29. pass