Crate rattler_repodata_gateway

Crate rattler_repodata_gateway 

Source
Expand description

rattler_repodata_gateway is a crate that provides functionality to interact with Conda repodata. It currently provides functionality to download and cache repodata.json files through the fetch::fetch_repo_data function.

In the future this crate will also provide more high-level functionality to query information about specific packages from different sources.

§Install

Add the following to your Cargo.toml:

[dependencies]
rattler_repodata_gateway = "0.2.0"

or run

cargo add rattler_repodata_gateway

§Examples

Below is a basic example that shows how to retrieve and cache the repodata for a conda channel using the fetch::fetch_repo_data function:

use std::{default::Default, path::PathBuf};
use reqwest::Client;
use reqwest_middleware::ClientWithMiddleware;
use url::Url;
use rattler_repodata_gateway::fetch;
use rattler_networking::LazyClient;

#[tokio::main]
async fn main() {
    let repodata_url = Url::parse("https://conda.anaconda.org/conda-forge/osx-64/").unwrap();
    let cache = PathBuf::from("./cache");

    let result = fetch::fetch_repo_data(
        repodata_url,
        LazyClient::default(),
        cache,
        fetch::FetchRepoDataOptions { ..Default::default() },
        None,
    ).await;

    let result = match result {
        Err(err) => {
            panic!("{:?}", err);
        }
        Ok(result) => result
    };

    println!("{:?}", result.cache_state);
    println!("{:?}", result.cache_result);
    println!("{:?}", result.lock_file);
    println!("{:?}", result.repo_data_json_path);
}

Modules§

fetch
This module provides functionality to download and cache repodata.json from a remote location.
sparse
This module provides the SparseRepoData which is a struct to enable only sparsely loading records from a repodata.json file.

Structs§

ChannelConfig
Describes additional information for fetching channels.
Gateway
Central access point for high level queries about rattler_conda_types::RepoDataRecords from different channels.
GatewayBuilder
A builder for constructing a Gateway.
RepoData
A container for RepoDataRecords that are returned from the super::Gateway.
SourceConfig
Describes additional properties that influence how the gateway fetches repodata for a specific channel.

Enums§

GatewayError
MaxConcurrency
Defines the maximum concurrency for the gateway.
RunExportExtractorError
SubdirSelection
A selection of subdirectories.

Traits§

DownloadReporter
A trait that enables being notified of download progress.
JLAPReporter
A trait that enables being notified of JLAP operations progress.
Reporter
A trait that enables being notified of repodata fetching progress.
RunExportsReporter
A trait that enables being notified of download progress for run exports.