Function brane_cli::data::download_data

source ·
pub async fn download_data(
    api_endpoint: impl AsRef<str>,
    proxy_addr: &Option<String>,
    certs_dir: impl AsRef<Path>,
    data_dir: impl AsRef<Path>,
    name: impl AsRef<str>,
    access: &HashMap<String, AccessKind>,
) -> Result<Option<AccessKind>, DataError>
Expand description

Attempts to download the given dataset from the instance.

For now, this function uses a random selection since it assumes there will usually only be one location that advertises having it. However, this is super bad practise and will lead to undefined results if there are multiple.

§Arguments

  • api_endpoint: The remote brane-api endpoint that we use to download the possible registries.
  • proxy_addr: If given, the any data transfers will be proxied through this address.
  • certs_dir: The directory where certificates are stored. Expected to contain nested directories that store the certs by domain ID.
  • data_dir: The directory to download the dataset to.
  • name: The name of the dataset to download.
  • access: The locations where it is available.

§Returns

The AccessKind with how to download the dataset if it was downloaded successfully, or None if it wasn’t available.

§Errors

This function errors if we failed to download the dataset somehow.