soar_registry/lib.rs
1//! Registry management for the soar package manager.
2//!
3//! This crate provides functionality for fetching, processing, and managing
4//! package metadata from remote repositories.
5//!
6//! # Overview
7//!
8//! The crate handles metadata sources:
9//! - **Repositories**: Standard package repositories containing package metadata
10//!
11//! Metadata can be provided in two formats:
12//! - SQLite databases (`.sdb` files, optionally zstd-compressed)
13//! - JSON files containing package arrays
14//!
15//! # Example
16//!
17//! ```no_run
18//! use soar_registry::{fetch_metadata, MetadataContent};
19//! use soar_config::repository::Repository;
20//!
21//! async fn sync_repo(repo: &Repository, existing_etag: Option<String>) -> soar_registry::Result<()> {
22//! if let Some((etag, content)) = fetch_metadata(repo, false, existing_etag).await? {
23//! match content {
24//! MetadataContent::SqliteDb(bytes) => {
25//! // Write SQLite database to disk
26//! }
27//! MetadataContent::Json(packages) => {
28//! // Process JSON packages into a database
29//! }
30//! }
31//! }
32//! Ok(())
33//! }
34//! ```
35
36pub mod error;
37pub mod metadata;
38pub mod package;
39
40pub use error::{ErrorContext, RegistryError, Result};
41pub use metadata::{
42 fetch_metadata, parse_index, process_metadata_content, write_metadata_db, MetadataContent,
43 SQLITE_MAGIC_BYTES, SUPPORTED_FORMAT, ZST_MAGIC_BYTES,
44};
45pub use package::RemotePackage;