Skip to content

Commit cc0fc5c

Browse files
committed
refactor!: remove bytes dependency
1 parent cc78897 commit cc0fc5c

File tree

6 files changed

+4
-12
lines changed

6 files changed

+4
-12
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ version = "0.12.0"
2525
anyhow = "1.0.86"
2626
async-trait = "0.1.80"
2727
blake2 = "0.10.6"
28-
bytes = "1.6.0"
2928
criterion = "0.5.1"
3029
flate2 = "1.0.30"
3130
hex = "0.4.3"

postgresql_archive/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ version.workspace = true
1313
anyhow = { workspace = true }
1414
async-trait = { workspace = true }
1515
blake2 = { workspace = true }
16-
bytes = { workspace = true }
1716
flate2 = { workspace = true }
1817
hex = { workspace = true }
1918
http = { workspace = true }

postgresql_archive/src/archive.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use crate::error::Error::Unexpected;
55
use crate::error::Result;
66
use crate::repository;
7-
use bytes::Bytes;
87
use flate2::bufread::GzDecoder;
98
use human_bytes::human_bytes;
109
use num_format::{Locale, ToFormattedString};
@@ -39,12 +38,11 @@ pub async fn get_version(url: &str, version_req: &VersionReq) -> Result<Version>
3938
/// * If the archive is not found.
4039
/// * If the archive cannot be downloaded.
4140
#[instrument]
42-
pub async fn get_archive(url: &str, version_req: &VersionReq) -> Result<(Version, Bytes)> {
41+
pub async fn get_archive(url: &str, version_req: &VersionReq) -> Result<(Version, Vec<u8>)> {
4342
let repository = repository::registry::get(url)?;
4443
let archive = repository.get_archive(version_req).await?;
4544
let version = archive.version().clone();
46-
let archive_bytes = archive.bytes().to_vec();
47-
let bytes = Bytes::from(archive_bytes.clone());
45+
let bytes = archive.bytes().to_vec();
4846
Ok((version, bytes))
4947
}
5048

@@ -103,7 +101,7 @@ fn acquire_lock(out_dir: &Path) -> Result<PathBuf> {
103101
/// Returns an error if the extraction fails.
104102
#[allow(clippy::cast_precision_loss)]
105103
#[instrument(skip(bytes))]
106-
pub async fn extract(bytes: &Bytes, out_dir: &Path) -> Result<()> {
104+
pub async fn extract(bytes: Vec<u8>, out_dir: &Path) -> Result<()> {
107105
let input = BufReader::new(Cursor::new(bytes));
108106
let decoder = GzDecoder::new(input);
109107
let mut archive = Archive::new(decoder);

postgresql_archive/src/repository/github/repository.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::Error::{
77
};
88
use crate::{hasher, matcher, Result};
99
use async_trait::async_trait;
10-
use bytes::Bytes;
1110
use http::{header, Extensions};
1211
use human_bytes::human_bytes;
1312
use regex::Regex;
@@ -237,7 +236,7 @@ impl Repository for GitHub {
237236
debug!("Downloading archive {}", asset.browser_download_url);
238237
let request = client.get(&asset.browser_download_url);
239238
let response = request.send().await?.error_for_status()?;
240-
let archive: Bytes = response.bytes().await?;
239+
let archive = response.bytes().await?;
241240
let bytes = archive.to_vec();
242241
debug!(
243242
"Archive {} downloaded: {}",

postgresql_embedded/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ tokio = { workspace = true, features = ["full"] }
1818

1919
[dependencies]
2020
anyhow = { workspace = true }
21-
bytes = { workspace = true }
2221
home = { workspace = true }
2322
lazy_static = { workspace = true }
2423
postgresql_archive = { path = "../postgresql_archive", version = "0.12.0", default-features = false }

0 commit comments

Comments
 (0)