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.jsonfrom a remote location. - sparse
- This module provides the
SparseRepoDatawhich is a struct to enable only sparsely loading records from arepodata.jsonfile.
Structs§
- Channel
Config - Describes additional information for fetching channels.
- Gateway
- Central access point for high level queries about
rattler_conda_types::RepoDataRecords from different channels. - Gateway
Builder - A builder for constructing a
Gateway. - Repo
Data - A container for
RepoDataRecords that are returned from thesuper::Gateway. - Source
Config - Describes additional properties that influence how the gateway fetches repodata for a specific channel.
Enums§
- Gateway
Error - MaxConcurrency
- Defines the maximum concurrency for the gateway.
- RunExport
Extractor Error - Subdir
Selection - A selection of subdirectories.
Traits§
- Download
Reporter - A trait that enables being notified of download progress.
- JLAP
Reporter - A trait that enables being notified of JLAP operations progress.
- Reporter
- A trait that enables being notified of repodata fetching progress.
- RunExports
Reporter - A trait that enables being notified of download progress for run exports.