store.backends.base

Attributes

logger

Classes

ResourceInfo

Object representing resource metadata.

CachedResource

Cached information about an already downloaded resource.

StoreError

Store

Module Contents

store.backends.base.logger
class store.backends.base.ResourceInfo

Object representing resource metadata.

This is subclassed by all store drivers.

abstractmethod uid() str

Return an unique identifier.

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

abstractmethod verify(resource_path: str) bool

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

class store.backends.base.CachedResource

Bases: namedtuple('CachedResource', ['uid', 'local_path'])

Cached information about an already downloaded resource.

__slots__ = ()
class store.backends.base.StoreError

Bases: e3.error.E3Error

class store.backends.base.Store(store_configuration: Any, cache_backend: e3.store.cache.backends.base.Cache)
store_configuration
cache_backend
abstractmethod get_resource_metadata(query: dict) ResourceInfo

Get a resource metadata from query.

Parameters:

query – a dictionary containing store specific queries to identify a resource

download_resource(metadata: ResourceInfo, dest: str) str | None

Download a resource identified by its metadata in dest.

Parameters:
  • metadata – resource metadata

  • dest – directory where the resource will be stored

Returns:

resource path

abstractmethod download_resource_content(metadata: ResourceInfo, dest: str) str | None

Download a resource identified by its metadata in dest.

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

Parameters:
  • metadata – resource metadata

  • dest – directory where the resource will be stored

Returns:

resource path