mod auth;
mod options;
pub mod r2;
pub(crate) mod rest;
#[cfg(not(target_family = "wasm"))]
pub mod s3_tables;
mod catalog_trait;
pub use catalog_trait::Catalog;
pub use options::{CatalogOptions, HttpClientConfig};
pub(crate) use auth::BearerTokenAuthProvider;
#[cfg(not(target_family = "wasm"))]
pub(crate) use auth::SigV4AuthProvider;
use async_trait::async_trait;
pub(crate) type Result<T> = std::result::Result<T, CatalogError>;
#[derive(Debug, thiserror::Error)]
pub(crate) enum CatalogError {
#[error("Resource not found: {0}")]
NotFound(String),
#[error("Conflict: {0}")]
Conflict(String),
#[error("Invalid request: {0}")]
InvalidRequest(String),
#[error("Authentication failed: {0}")]
AuthError(String),
#[error("HTTP error: {0}")]
HttpError(String),
#[error("Server error {status}: {message}")]
ServerError { status: u16, message: String },
#[error("Network error: {0}")]
Network(reqwest::Error),
#[cfg(not(target_family = "wasm"))]
#[error("Invalid ARN: {0}")]
InvalidArn(String),
#[error("Unexpected error: {0}")]
Unexpected(String),
}
#[derive(Debug, Clone)]
pub(crate) struct R2Config {
pub account_id: String,
pub bucket_name: String,
pub api_token: String,
pub endpoint_override: Option<String>,
}
#[async_trait]
pub(crate) trait AuthProvider: Send + Sync + std::fmt::Debug {
async fn sign_request(&self, request: reqwest::Request) -> Result<reqwest::Request>;
}