Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

chore: correct lint errors #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
237 changes: 115 additions & 122 deletions 237 Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 2 postgresql_archive/src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub async fn extract(url: &str, bytes: &Vec<u8>, out_dir: &Path) -> Result<Vec<P
let extractor_fn = extractor::registry::get(url)?;
let mut extract_directories = extractor::ExtractDirectories::default();
extract_directories.add_mapping(Regex::new(".*")?, out_dir.to_path_buf());
extractor_fn(bytes, extract_directories)
extractor_fn(bytes, &extract_directories)
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions 4 postgresql_archive/src/configuration/theseus/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tracing::{debug, instrument, warn};
/// # Errors
/// Returns an error if the extraction fails.
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: ExtractDirectories) -> Result<Vec<PathBuf>> {
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let out_dir = extract_directories.get_path(".")?;

let parent_dir = if let Some(parent) = out_dir.parent() {
Expand Down Expand Up @@ -41,7 +41,7 @@ pub fn extract(bytes: &Vec<u8>, extract_directories: ExtractDirectories) -> Resu
debug!("Extracting archive to {}", extract_dir.to_string_lossy());
let mut archive_extract_directories = ExtractDirectories::default();
archive_extract_directories.add_mapping(Regex::new(".*")?, extract_dir.clone());
let files = tar_gz_extract(bytes, archive_extract_directories)?;
let files = tar_gz_extract(bytes, &archive_extract_directories)?;

if out_dir.exists() {
debug!(
Expand Down
4 changes: 2 additions & 2 deletions 4 postgresql_archive/src/configuration/zonky/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use zip::ZipArchive;
/// Returns an error if the extraction fails.
#[expect(clippy::case_sensitive_file_extension_comparisons)]
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: ExtractDirectories) -> Result<Vec<PathBuf>> {
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let out_dir = extract_directories.get_path(".")?;
let parent_dir = if let Some(parent) = out_dir.parent() {
parent
Expand Down Expand Up @@ -63,7 +63,7 @@ pub fn extract(bytes: &Vec<u8>, extract_directories: ExtractDirectories) -> Resu

let mut archive_extract_directories = ExtractDirectories::default();
archive_extract_directories.add_mapping(Regex::new(".*")?, extract_dir.clone());
let files = tar_xz_extract(&archive_bytes, archive_extract_directories)?;
let files = tar_xz_extract(&archive_bytes, &archive_extract_directories)?;

if out_dir.exists() {
debug!(
Expand Down
4 changes: 2 additions & 2 deletions 4 postgresql_archive/src/extractor/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static REGISTRY: LazyLock<Arc<Mutex<RepositoryRegistry>>> =
LazyLock::new(|| Arc::new(Mutex::new(RepositoryRegistry::default())));

type SupportsFn = fn(&str) -> Result<bool>;
type ExtractFn = fn(&Vec<u8>, ExtractDirectories) -> Result<Vec<PathBuf>>;
type ExtractFn = fn(&Vec<u8>, &ExtractDirectories) -> Result<Vec<PathBuf>>;

/// Singleton struct to store extractors
#[expect(clippy::type_complexity)]
Expand Down Expand Up @@ -107,7 +107,7 @@ mod tests {
let extractor = get(url)?;
let mut extract_directories = ExtractDirectories::default();
extract_directories.add_mapping(Regex::new(".*")?, PathBuf::from("test"));
assert!(extractor(&Vec::new(), extract_directories).is_ok());
assert!(extractor(&Vec::new(), &extract_directories).is_ok());
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion 2 postgresql_archive/src/extractor/tar_gz_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use tracing::{debug, instrument, warn};
/// # Errors
/// Returns an error if the extraction fails.
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: ExtractDirectories) -> Result<Vec<PathBuf>> {
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let mut files = Vec::new();
let input = BufReader::new(Cursor::new(bytes));
let decoder = GzDecoder::new(input);
Expand Down
2 changes: 1 addition & 1 deletion 2 postgresql_archive/src/extractor/tar_xz_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use tracing::{debug, instrument, warn};
/// # Errors
/// Returns an error if the extraction fails.
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: ExtractDirectories) -> Result<Vec<PathBuf>> {
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let mut files = Vec::new();
let input = BufReader::new(Cursor::new(bytes));
let decoder = XzDecoder::new(input);
Expand Down
2 changes: 1 addition & 1 deletion 2 postgresql_archive/src/extractor/zip_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use zip::ZipArchive;
/// # Errors
/// Returns an error if the extraction fails.
#[instrument(skip(bytes))]
pub fn extract(bytes: &Vec<u8>, extract_directories: ExtractDirectories) -> Result<Vec<PathBuf>> {
pub fn extract(bytes: &Vec<u8>, extract_directories: &ExtractDirectories) -> Result<Vec<PathBuf>> {
let mut files = Vec::new();
let reader = Cursor::new(bytes);
let mut archive = ZipArchive::new(reader).map_err(|_| io::Error::other("Zip error"))?;
Expand Down
24 changes: 24 additions & 0 deletions 24 postgresql_embedded/src/postgresql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ impl PostgreSQL {
/// Set up the database by extracting the archive and initializing the database.
/// If the installation directory already exists, the archive will not be extracted.
/// If the data directory already exists, the database will not be initialized.
///
/// # Errors
///
/// If the installation fails, an error will be returned.
#[instrument(skip(self))]
pub async fn setup(&mut self) -> Result<()> {
match self.installed_dir() {
Expand Down Expand Up @@ -259,6 +263,10 @@ impl PostgreSQL {

/// Start the database and wait for the startup to complete.
/// If the port is set to `0`, the database will be started on a random port.
///
/// # Errors
///
/// If the database fails to start, an error will be returned.
#[instrument(skip(self))]
pub async fn start(&mut self) -> Result<()> {
if self.settings.port == 0 {
Expand Down Expand Up @@ -299,6 +307,10 @@ impl PostgreSQL {
}

/// Stop the database gracefully (smart mode) and wait for the shutdown to complete.
///
/// # Errors
///
/// If the database fails to stop, an error will be returned.
#[instrument(skip(self))]
pub async fn stop(&self) -> Result<()> {
debug!(
Expand Down Expand Up @@ -333,6 +345,10 @@ impl PostgreSQL {
}

/// Create a new database with the given name.
///
/// # Errors
///
/// If the database creation fails, an error will be returned.
#[instrument(skip(self))]
pub async fn create_database<S>(&self, database_name: S) -> Result<()>
where
Expand All @@ -359,6 +375,10 @@ impl PostgreSQL {
}

/// Check if a database with the given name exists.
///
/// # Errors
///
/// If the query fails, an error will be returned.
#[instrument(skip(self))]
pub async fn database_exists<S>(&self, database_name: S) -> Result<bool>
where
Expand All @@ -383,6 +403,10 @@ impl PostgreSQL {
}

/// Drop a database with the given name.
///
/// # Errors
///
/// If the database does not exist or if the drop command fails, an error will be returned.
#[instrument(skip(self))]
pub async fn drop_database<S>(&self, database_name: S) -> Result<()>
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Repository for PortalCorp {
extract_directories.add_mapping(Regex::new(r"\.(dll|dylib|so)$")?, library_dir);
extract_directories.add_mapping(Regex::new(r"\.(control|sql)$")?, extension_dir);
let bytes = &archive.to_vec();
let files = zip_extract(bytes, extract_directories)?;
let files = zip_extract(bytes, &extract_directories)?;
Ok(files)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Repository for Steampipe {
extract_directories.add_mapping(Regex::new(r"\.(dll|dylib|so)$")?, library_dir);
extract_directories.add_mapping(Regex::new(r"\.(control|sql)$")?, extension_dir);
let bytes = &archive.to_vec();
let files = tar_gz_extract(bytes, extract_directories)?;
let files = tar_gz_extract(bytes, &extract_directories)?;
Ok(files)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Repository for TensorChord {
extract_directories.add_mapping(Regex::new(r"\.(dll|dylib|so)$")?, library_dir);
extract_directories.add_mapping(Regex::new(r"\.(control|sql)$")?, extension_dir);
let bytes = &archive.to_vec();
let files = zip_extract(bytes, extract_directories)?;
let files = zip_extract(bytes, &extract_directories)?;
Ok(files)
}
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.