owmeta_core.bundle.loaders package

Package for uploaders and downloaders of bundles

exception owmeta_core.bundle.loaders.LoadFailed(bundle_id, loader, *args)[source]

Bases: Exception

Thrown when a bundle could not be downloaded

Parameters
bundle_idstr

ID of the bundle on which a download was attempted

loaderLoader

The loader that attempted to download the bundle

args[0]str

Explanation of why the download failed

*args[1:]

Passed on to Exception

class owmeta_core.bundle.loaders.Loader[source]

Bases: object

Downloads bundles into the local index and caches them

Note that a Loader is transient: it will be created when needed to download one bundle and then discarded. Any state that should be carried from request to request should be attached to an AccessorConfig

Attributes
base_directorystr

The path where the bundle archive should be unpacked

bundle_versions(bundle_id)[source]

List the versions available for the bundle.

This is a required part of the Loader interface.

Parameters
bundle_idstr

ID of the bundle for which versions are requested

Returns
A list of int

Each entry is a version of the bundle available via this loader

can_load(bundle_id, bundle_version=None)[source]

Returns True if the bundle named bundle_id is available.

This method is for loaders to determine that they probably can or cannot load the bundle, such as by checking repository metadata. Other loaders that return True from can_load should be tried if a given loader fails, but a warning should be recorded for the loader that failed.

classmethod can_load_from(accessor_config)[source]

Returns True if the given accessor_config is a valid config for this loader

Parameters
accessor_configAccessorConfig

The config which we may be able to load from

load(bundle_id, bundle_version=None)[source]

Load the bundle into the local index

Parameters
bundle_idstr

ID of the bundle to load

bundle_versionint

Version of the bundle to load. Defaults to the latest available. optional

Raises
LoadFailed

Raised when the bundle cannot be loaded

class owmeta_core.bundle.loaders.Uploader[source]

Bases: object

Uploads bundles to remotes

can_upload(bundle_path)[source]

Returns True if this uploader can upload this bundle

Parameters
bundle_pathstr

The file path to the bundle to upload

classmethod can_upload_to(accessor_config)[source]

Returns True if this uploader can upload with the given accessor configuration

Parameters
accessor_configAccessorConfig
upload(bundle_path)[source]

Upload a bundle

Parameters
bundle_pathstr

The file path to the bundle to upload

Submodules