swh.deposit.api.private.deposit_read module

swh.deposit.api.private.deposit_read.aggregate_tarballs(extraction_dir, archive_paths)[source]
Aggregate multiple tarballs into one and returns this new archive’s

path.

Parameters
  • extraction_dir (path) – Path to use for the tarballs computation

  • archive_paths ([str]) – Deposit’s archive paths

Returns

Tuple (directory to clean up, archive path (aggregated or not))

class swh.deposit.api.private.deposit_read.APIReadArchives[source]

Bases: swh.deposit.api.private.APIPrivateView, swh.deposit.api.common.APIGet, swh.deposit.api.private.DepositReadMixin

Dedicated class to read a deposit’s raw archives content.

Only GET is supported.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

process_get(request, collection_name: str, deposit: swh.deposit.models.Deposit) Tuple[int, Any, str][source]
Build a unique tarball from the multiple received and stream that

content to the client.

Parameters
  • request (Request) –

  • collection_name – Collection owning the deposit

  • deposit – Deposit concerned by the reading

Returns

Tuple status, stream of content, content-type

class swh.deposit.api.private.deposit_read.APIReadMetadata[source]

Bases: swh.deposit.api.private.APIPrivateView, swh.deposit.api.common.APIGet, swh.deposit.api.private.DepositReadMixin

Class in charge of aggregating metadata on a deposit.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

metadata_read(deposit: swh.deposit.models.Deposit) Dict[str, Any][source]

Read and aggregate multiple deposit information into one unified dictionary.

Parameters

deposit – Deposit to retrieve information from

Returns

Dictionary of deposit information read by the deposit loader, with the following keys:

origin (Dict): Information about the origin

metadata_raw (List[str]): List of raw metadata received for the

deposit

metadata_dict (Dict): Deposit aggregated metadata into one dict

provider (Dict): the metadata provider information about the

deposit client

tool (Dict): the deposit information

deposit (Dict): deposit information relevant to build the revision

(author_date, committer_date, etc…)

process_get(request, collection_name: str, deposit: swh.deposit.models.Deposit) Tuple[int, Dict, str][source]

Routine to deal with the deposit’s get processing.

Returns

Tuple status, stream of content, content-type