store.backends.base
===================

.. py:module:: store.backends.base


Attributes
----------

.. autoapisummary::

   store.backends.base.logger


Classes
-------

.. autoapisummary::

   store.backends.base.ResourceInfo
   store.backends.base.CachedResource
   store.backends.base.StoreError
   store.backends.base.Store


Module Contents
---------------

.. py:data:: logger

.. py:class:: ResourceInfo

   Object representing resource metadata.

   This is subclassed by all store drivers.


   .. py:method:: uid() -> str
      :abstractmethod:


      Return an unique identifier.

      This is meant to be used to implement a cache system.



   .. py:method:: verify(resource_path: str) -> bool
      :abstractmethod:


      Verify that a downloaded resource is valid.

      This is meant to validate the resource fingerprint (e.g. sha1sum).
      :param resource_path: path to the downloaded resource



.. py:class:: CachedResource

   Bases: :py:obj:`namedtuple`\ (\ :py:obj:`'CachedResource'`\ , [\ :py:obj:`'uid'`\ , :py:obj:`'local_path'`\ ]\ )


   Cached information about an already downloaded resource.


   .. py:attribute:: __slots__
      :value: ()



.. py:class:: StoreError

   Bases: :py:obj:`e3.error.E3Error`


.. py:class:: Store(store_configuration: Any, cache_backend: e3.store.cache.backends.base.Cache)

   .. py:attribute:: store_configuration


   .. py:attribute:: cache_backend


   .. py:method:: get_resource_metadata(query: dict) -> ResourceInfo
      :abstractmethod:


      Get a resource metadata from query.

      :param query: a dictionary containing store specific queries to
          identify a resource



   .. py:method:: download_resource(metadata: ResourceInfo, dest: str) -> str | None

      Download a resource identified by its metadata in dest.

      :param metadata: resource metadata
      :param dest: directory where the resource will be stored
      :return: resource path



   .. py:method:: download_resource_content(metadata: ResourceInfo, dest: str) -> str | None
      :abstractmethod:


      Download a resource identified by its metadata in dest.

      The resource is supposed to be validated with metadata.verify
      once the download is completed.

      :param metadata: resource metadata
      :param dest: directory where the resource will be stored
      :return: resource path



