Skip to content

Commit

Permalink
feat!: add semantic versioing support and configurable repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
brianheineman committed Jun 28, 2024
1 parent cfc0679 commit 964a420
Show file tree
Hide file tree
Showing 28 changed files with 1,207 additions and 754 deletions.
31 changes: 19 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[workspace]
default-members = ["postgresql_archive", "postgresql_commands", "postgresql_embedded"]
members = ["examples/*", "postgresql_archive", "postgresql_commands", "postgresql_embedded"]
default-members = [
"postgresql_archive",
"postgresql_commands",
"postgresql_embedded",
]
members = [
"examples/*",
"postgresql_archive",
"postgresql_commands",
"postgresql_embedded",
]
resolver = "2"

[workspace.package]
Expand Down Expand Up @@ -28,8 +37,9 @@ rand = "0.8.5"
regex = "1.10.5"
reqwest = { version = "0.12.5", default-features = false }
reqwest-middleware = "0.3.1"
reqwest-retry = "0.5.0"
reqwest-retry = "0.6.0"
reqwest-tracing = "0.5.0"
semver = "1.0.23"
serde = "1.0.203"
serde_json = "1.0.118"
sha2 = "0.10.8"
Expand Down
5 changes: 3 additions & 2 deletions examples/archive_async/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#![forbid(unsafe_code)]
#![deny(clippy::pedantic)]

use postgresql_archive::{extract, get_archive, Result, DEFAULT_RELEASES_URL, LATEST};
use postgresql_archive::{extract, get_archive, Result, VersionReq, DEFAULT_POSTGRESQL_URL};

#[tokio::main]
async fn main() -> Result<()> {
let (archive_version, archive) = get_archive(DEFAULT_RELEASES_URL, &LATEST).await?;
let version_req = VersionReq::STAR;
let (archive_version, archive) = get_archive(DEFAULT_POSTGRESQL_URL, &version_req).await?;
let out_dir = tempfile::tempdir()?.into_path();
extract(&archive, &out_dir).await?;
println!(
Expand Down
5 changes: 3 additions & 2 deletions examples/archive_sync/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#![deny(clippy::pedantic)]

use postgresql_archive::blocking::{extract, get_archive};
use postgresql_archive::{Result, DEFAULT_RELEASES_URL, LATEST};
use postgresql_archive::{Result, VersionReq, DEFAULT_POSTGRESQL_URL};

fn main() -> Result<()> {
let (archive_version, archive) = get_archive(DEFAULT_RELEASES_URL, &LATEST)?;
let version_req = VersionReq::STAR;
let (archive_version, archive) = get_archive(DEFAULT_POSTGRESQL_URL, &version_req)?;
let out_dir = tempfile::tempdir()?.into_path();
extract(&archive, &out_dir)?;
println!(
Expand Down
2 changes: 2 additions & 0 deletions postgresql_archive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ reqwest = { workspace = true, default-features = false, features = ["json"] }
reqwest-middleware = { workspace = true }
reqwest-retry = { workspace = true }
reqwest-tracing = { workspace = true }
semver = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
sha2 = { workspace = true }
Expand All @@ -33,6 +34,7 @@ tempfile = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"], optional = true }
tracing = { workspace = true, features = ["log"] }
url = "2.5.2"

[dev-dependencies]
criterion = { workspace = true }
Expand Down
6 changes: 0 additions & 6 deletions postgresql_archive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ Licensed under either of

at your option.

PostgreSQL is covered under [The PostgreSQL License](https://opensource.org/licenses/postgresql).

## Notes

Uses PostgreSQL binaries from [theseus-rs/postgresql-binaries](https://github.com/theseus-rs/postgresql-binaries).

## Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
Expand Down
6 changes: 3 additions & 3 deletions postgresql_archive/benches/archive.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bytes::Bytes;
use criterion::{criterion_group, criterion_main, Criterion};
use postgresql_archive::blocking::{extract, get_archive};
use postgresql_archive::{Result, DEFAULT_RELEASES_URL, LATEST};
use postgresql_archive::{Result, VersionReq, DEFAULT_POSTGRESQL_URL};
use std::fs::{create_dir_all, remove_dir_all};
use std::time::Duration;

Expand All @@ -10,8 +10,8 @@ fn benchmarks(criterion: &mut Criterion) {
}

fn bench_extract(criterion: &mut Criterion) -> Result<()> {
let version = &LATEST;
let (_archive_version, archive) = get_archive(DEFAULT_RELEASES_URL, version)?;
let version_req = VersionReq::STAR;
let (_archive_version, archive) = get_archive(DEFAULT_POSTGRESQL_URL, &version_req)?;

criterion.bench_function("extract", |bencher| {
bencher.iter(|| {
Expand Down
Loading

0 comments on commit 964a420

Please sign in to comment.