store.backends.http_simple_store

HTTP-based simple store backend.

Module Contents

Classes

HTTPSimpleStoreResourceInfo

Resource information for HTTP simple store.

HTTPSimpleStore

Simple HTTP-based store for downloading resources from URLs.

Attributes

logger

store.backends.http_simple_store.logger
class store.backends.http_simple_store.HTTPSimpleStoreResourceInfo(url: str, sha: str)

Bases: e3.store.backends.base.ResourceInfo

Resource information for HTTP simple store.

Variables:
  • url – URL of the resource

  • sha – SHA1 hash of the resource

property uid: str

Return unique identifier.

verify(resource_path: str) bool

Verify the integrity of a resource.

Parameters:

resource_path – path to the resource to verify

Returns:

True if the resource SHA1 matches, False otherwise

class store.backends.http_simple_store.HTTPSimpleStore(store_configuration: Any, cache_backend: e3.store.cache.backends.base.Cache)

Bases: e3.store.backends.base.Store

Simple HTTP-based store for downloading resources from URLs.

get_resource_metadata(query: dict[str, str]) HTTPSimpleStoreResourceInfo

Return resource metadata directly computed from the query.

There is no remote server involved here.

Parameters:

query – a dict containing two keys ‘sha’ and ‘url’. sha is the sha1sum of the resource and url is the remote url

download_resource_content(metadata: e3.store.backends.base.ResourceInfo, dest: str) str | None

Download a resource.

Parameters:
  • metadata – metadata associated with the resource to download

  • dest – where to download the resource

Returns:

the path to the downloaded resource