Skip to content

Commit 0099f77

Browse files
Merge pull request #3 from theseus-rs/update-public-api
Update public API
2 parents 4859652 + 6f31b49 commit 0099f77

File tree

9 files changed

+105
-97
lines changed

9 files changed

+105
-97
lines changed

Cargo.lock

Lines changed: 2 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2021"
1010
keywords = ["postgresql", "ffi", "database"]
1111
license = "(Apache-2.0 OR MIT) AND PostgreSQL"
1212
repository = "https://github.com/theseus-rs/postgresql-embedded"
13-
version = "0.1.2"
13+
version = "0.2.0"
1414

1515
[workspace.dependencies]
1616
anyhow = { version = "1.0" }

postgresql_archive/README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![ci](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml)
44
[![Latest version](https://img.shields.io/crates/v/postgresql_archive.svg)](https://crates.io/crates/postgresql_embedded)
5-
[![Documentation](https://docs.rs/postgresql_archive/badge.svg)](https://docs.rs/postgresql_embedded)
5+
[![Documentation](https://docs.rs/postgresql_archive/badge.svg)](https://docs.rs/postgresql_archive)
66
[![License](https://img.shields.io/crates/l/postgresql_archive?)](https://github.com/theseus-rs/postgresql-embedded/tree/main/postgresql_archive#license)
77
[![Semantic Versioning](https://img.shields.io/badge/%E2%9A%99%EF%B8%8F_SemVer-2.0.0-blue)](https://semver.org/spec/v2.0.0.html)
88

@@ -43,41 +43,41 @@ uses.
4343

4444
The following features are available:
4545

46-
| Name | Description | Default? |
47-
|---|---|---|
48-
| `blocking` | Enables the blocking API | No |
46+
| Name | Description | Default? |
47+
|--------------|--------------------------|----------|
48+
| `blocking` | Enables the blocking API | No |
4949

5050
## Supported platforms
5151

5252
`postgresql_archive` supports all platforms provided by [theseus-rs/postgresql-binaries](https://github.com/theseus-rs/postgresql-binaries).
5353

5454
Currently supported platforms are:
5555

56-
| OS | [Target](https://doc.rust-lang.org/nightly/rustc/platform-support.html) |
57-
|---|---|
58-
| Linux | aarch64-unknown-linux-gnu |
59-
| Linux | aarch64-unknown-linux-musl |
60-
| Linux | arm-unknown-linux-gnueabi |
61-
| Linux | arm-unknown-linux-gnueabihf |
62-
| Linux | arm-unknown-linux-musleabi |
63-
| Linux | arm-unknown-linux-musleabihf |
64-
| Linux | armv5te-unknown-linux-gnueabi |
65-
| Linux | armv7-unknown-linux-gnueabihf |
66-
| Linux | armv7-unknown-linux-musleabihf |
67-
| Linux | i586-unknown-linux-gnu |
68-
| Linux | i586-unknown-linux-musl |
69-
| Linux | i686-unknown-linux-gnu |
70-
| Linux | i686-unknown-linux-musl |
71-
| Linux | mips64-unknown-linux-gnuabi64 |
72-
| Linux | powerpc64le-unknown-linux-gnu |
73-
| Linux | powerpc64le-unknown-linux-musl |
74-
| Linux | s390x-unknown-linux-gnu |
75-
| Linux | s390x-unknown-linux-musl |
76-
| Linux | x86_64-unknown-linux-gnu |
77-
| Linux | x86_64-unknown-linux-musl |
78-
| MacOS | aarch64-apple-darwin |
79-
| MacOS | x86_64-apple-darwin |
80-
| Windows | x86_64-pc-windows-msvc |
56+
| OS | [Target](https://doc.rust-lang.org/nightly/rustc/platform-support.html) |
57+
|---------|-------------------------------------------------------------------------|
58+
| Linux | aarch64-unknown-linux-gnu |
59+
| Linux | aarch64-unknown-linux-musl |
60+
| Linux | arm-unknown-linux-gnueabi |
61+
| Linux | arm-unknown-linux-gnueabihf |
62+
| Linux | arm-unknown-linux-musleabi |
63+
| Linux | arm-unknown-linux-musleabihf |
64+
| Linux | armv5te-unknown-linux-gnueabi |
65+
| Linux | armv7-unknown-linux-gnueabihf |
66+
| Linux | armv7-unknown-linux-musleabihf |
67+
| Linux | i586-unknown-linux-gnu |
68+
| Linux | i586-unknown-linux-musl |
69+
| Linux | i686-unknown-linux-gnu |
70+
| Linux | i686-unknown-linux-musl |
71+
| Linux | mips64-unknown-linux-gnuabi64 |
72+
| Linux | powerpc64le-unknown-linux-gnu |
73+
| Linux | powerpc64le-unknown-linux-musl |
74+
| Linux | s390x-unknown-linux-gnu |
75+
| Linux | s390x-unknown-linux-musl |
76+
| Linux | x86_64-unknown-linux-gnu |
77+
| Linux | x86_64-unknown-linux-musl |
78+
| MacOS | aarch64-apple-darwin |
79+
| MacOS | x86_64-apple-darwin |
80+
| Windows | x86_64-pc-windows-msvc |
8181

8282
## Safety
8383

postgresql_archive/src/archive.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ impl GitHubHeaders for RequestBuilder {
6464
}
6565
}
6666

67-
/// Gets a release from GitHub for a given [`version`](Version) of PostgreSQL. If a release for the
68-
/// [`version`](Version) is not found, then a [`ReleaseNotFound`] error is returned.
67+
/// Gets a release from GitHub for a given [version](Version) of PostgreSQL. If a release for the
68+
/// [version](Version) is not found, then a [ReleaseNotFound] error is returned.
6969
async fn get_release(version: &Version) -> Result<Release> {
7070
let url = "https://api.github.com/repos/theseus-rs/postgresql-binaries/releases";
7171
let client = reqwest::Client::new();
@@ -127,16 +127,18 @@ async fn get_release(version: &Version) -> Result<Release> {
127127
}
128128
}
129129

130-
/// Gets the version of PostgreSQL for the specified [`version`](Version). If the version minor or release is not
131-
/// specified, then the latest version is returned. If a release for the [`version`](Version) is not found, then a
132-
/// [`ReleaseNotFound`] error is returned.
130+
/// Gets the version of PostgreSQL for the specified [version](Version). If the version minor or release is not
131+
/// specified, then the latest version is returned. If a release for the [version](Version) is not found, then a
132+
/// [ReleaseNotFound] error is returned.
133133
pub async fn get_version(version: &Version) -> Result<Version> {
134134
let release = get_release(version).await?;
135135
Version::from_str(&release.tag_name)
136136
}
137137

138-
/// Gets the assets for a given [`version`](Version) of PostgreSQL and `target` (e.g. `x86_64-unknown-linux-gnu`).
139-
/// If the [`version`](Version) or `target` is not found, then an [error](crate::error::ArchiveError) is returned.
138+
/// Gets the assets for a given [version](Version) of PostgreSQL and
139+
/// [target](https://doc.rust-lang.org/nightly/rustc/platform-support.html).
140+
/// If the [version](Version) or [target](https://doc.rust-lang.org/nightly/rustc/platform-support.html)
141+
/// is not found, then an [error](crate::error::ArchiveError) is returned.
140142
///
141143
/// Two assets are returned. The first [asset](Asset) is the archive, and the second [asset](Asset) is the archive hash.
142144
async fn get_asset<S: AsRef<str>>(version: &Version, target: S) -> Result<(Version, Asset, Asset)> {
@@ -166,16 +168,19 @@ async fn get_asset<S: AsRef<str>>(version: &Version, target: S) -> Result<(Versi
166168
}
167169
}
168170

169-
/// Gets the archive for a given [`version`](Version) of PostgreSQL for the current target.
170-
/// If the [`version`](Version) is not found for this target, then an [error](crate::error::ArchiveError) is returned.
171+
/// Gets the archive for a given [version](Version) of PostgreSQL for the current target.
172+
/// If the [version](Version) is not found for this target, then an
173+
/// [error](crate::error::ArchiveError) is returned.
171174
///
172175
/// Returns the archive bytes and the archive hash.
173176
pub async fn get_archive(version: &Version) -> Result<(Version, Bytes, String)> {
174177
get_archive_for_target(version, target_triple::TARGET).await
175178
}
176179

177-
/// Gets the archive for a given [`version`](Version) of PostgreSQL and `target` (e.g. `x86_64-unknown-linux-gnu`).
178-
/// If the [`version`](Version) or `target` is not found, then an [error](crate::error::ArchiveError) is returned.
180+
/// Gets the archive for a given [version](Version) of PostgreSQL and
181+
/// [target](https://doc.rust-lang.org/nightly/rustc/platform-support.html).
182+
/// If the [version](Version) or [target](https://doc.rust-lang.org/nightly/rustc/platform-support.html)
183+
/// is not found, then an [error](crate::error::ArchiveError) is returned.
179184
///
180185
/// Returns the archive bytes and the archive hash.
181186
pub async fn get_archive_for_target<S: AsRef<str>>(
@@ -220,7 +225,7 @@ pub async fn get_archive_for_target<S: AsRef<str>>(
220225
Ok((asset_version, archive, hash))
221226
}
222227

223-
/// Extracts the compressed tar `bytes` to the `out_dir`.
228+
/// Extracts the compressed tar [bytes](Bytes) to the [out_dir](Path).
224229
pub async fn extract(bytes: &Bytes, out_dir: &Path) -> Result<()> {
225230
let input = BufReader::new(Cursor::new(bytes));
226231
let decoder = GzDecoder::new(input);

postgresql_archive/src/blocking/mod.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@ lazy_static! {
77
static ref RUNTIME: Runtime = Runtime::new().unwrap();
88
}
99

10-
/// Gets the version of PostgreSQL for the specified [`version`](Version). If the version minor or release is not
11-
/// specified, then the latest version is returned. If a release for the [`version`](Version) is not found, then a
12-
/// [`ReleaseNotFound`](crate::ArchiveError::ReleaseNotFound) error is returned.
10+
/// Gets the version of PostgreSQL for the specified [version](Version). If the version minor or release is not
11+
/// specified, then the latest version is returned. If a release for the [version](Version) is not found, then a
12+
/// [ReleaseNotFound](crate::ArchiveError::ReleaseNotFound) error is returned.
1313
pub fn get_version(version: &Version) -> crate::Result<Version> {
1414
RUNTIME
1515
.handle()
1616
.block_on(async move { crate::get_version(version).await })
1717
}
1818

19-
/// Gets the archive for a given [`version`](Version) of PostgreSQL for the current target.
20-
/// If the [`version`](Version) is not found for this target, then an [error](crate::ArchiveError) is returned.
19+
/// Gets the archive for a given [version](Version) of PostgreSQL for the current target.
20+
/// If the [version](Version) is not found for this target, then an
21+
/// [error](crate::ArchiveError) is returned.
2122
///
2223
/// Returns the archive bytes and the archive hash.
2324
pub fn get_archive(version: &Version) -> crate::Result<(Version, Bytes, String)> {
@@ -26,8 +27,10 @@ pub fn get_archive(version: &Version) -> crate::Result<(Version, Bytes, String)>
2627
.block_on(async move { crate::get_archive(version).await })
2728
}
2829

29-
/// Gets the archive for a given [`version`](Version) of PostgreSQL and `target` (e.g. `x86_64-unknown-linux-gnu`).
30-
/// If the [`version`](Version) or `target` is not found, then an [error](crate::ArchiveError) is returned.
30+
/// Gets the archive for a given [version](Version) of PostgreSQL and
31+
/// [target](https://doc.rust-lang.org/nightly/rustc/platform-support.html).
32+
/// If the [version](Version) or [target](https://doc.rust-lang.org/nightly/rustc/platform-support.html)
33+
/// is not found, then an [error](crate::error::ArchiveError) is returned.
3134
///
3235
/// Returns the archive bytes and the archive hash.
3336
pub fn get_archive_for_target<S: AsRef<str>>(
@@ -39,7 +42,7 @@ pub fn get_archive_for_target<S: AsRef<str>>(
3942
.block_on(async move { crate::get_archive_for_target(version, target).await })
4043
}
4144

42-
/// Extracts the compressed tar `bytes` to the `out_dir`.
45+
/// Extracts the compressed tar [bytes](Bytes) to the [out_dir](Path).
4346
pub fn extract(bytes: &Bytes, out_dir: &Path) -> crate::Result<()> {
4447
RUNTIME
4548
.handle()

postgresql_archive/src/lib.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//!
2222
//! ### Asynchronous API
2323
//!
24-
//! ```rust, ignore
24+
//! ```no_run
2525
//! use postgresql_archive::{extract, get_archive, LATEST};
2626
//!
2727
//! #[tokio::main]
@@ -33,7 +33,7 @@
3333
//! ```
3434
//!
3535
//! ### Synchronous API
36-
//! ```rust, ignore
36+
//! ```no_run
3737
//! use postgresql_archive::LATEST;
3838
//! use postgresql_archive::blocking::{extract, get_archive};
3939
//!
@@ -49,39 +49,39 @@
4949
//!
5050
//! The following features are available:
5151
//!
52-
//! Name | Description | Default?
53-
//! ---|---|---
54-
//! `blocking` | Enables the blocking API | No
52+
//! | Name | Description | Default? |
53+
//! |--------------|--------------------------|----------|
54+
//! | `blocking` | Enables the blocking API | No |
5555
//!
5656
//! ## Supported platforms
5757
//!
5858
//! postgresql_archive supports all platforms provided by [theseus-rs/postgresql-binaries](https://github.com/theseus-rs/postgresql-binaries):
5959
//!
60-
//! OS | [Target](https://doc.rust-lang.org/nightly/rustc/platform-support.html)
61-
//! ---|---
62-
//! Linux | aarch64-unknown-linux-gnu
63-
//! Linux | aarch64-unknown-linux-musl
64-
//! Linux | arm-unknown-linux-gnueabi
65-
//! Linux | arm-unknown-linux-gnueabihf
66-
//! Linux | arm-unknown-linux-musleabi
67-
//! Linux | arm-unknown-linux-musleabihf
68-
//! Linux | armv5te-unknown-linux-gnueabi
69-
//! Linux | armv7-unknown-linux-gnueabihf
70-
//! Linux | armv7-unknown-linux-musleabihf
71-
//! Linux | i586-unknown-linux-gnu
72-
//! Linux | i586-unknown-linux-musl
73-
//! Linux | i686-unknown-linux-gnu
74-
//! Linux | i686-unknown-linux-musl
75-
//! Linux | mips64-unknown-linux-gnuabi64
76-
//! Linux | powerpc64le-unknown-linux-gnu
77-
//! Linux | powerpc64le-unknown-linux-musl
78-
//! Linux | s390x-unknown-linux-gnu
79-
//! Linux | s390x-unknown-linux-musl
80-
//! Linux | x86_64-unknown-linux-gnu
81-
//! Linux | x86_64-unknown-linux-musl
82-
//! MacOS | aarch64-apple-darwin
83-
//! MacOS | x86_64-apple-darwin
84-
//! Windows | x86_64-pc-windows-msvc
60+
//! | OS | [Target](https://doc.rust-lang.org/nightly/rustc/platform-support.html) |
61+
//! |---------|-------------------------------------------------------------------------|
62+
//! | Linux | aarch64-unknown-linux-gnu |
63+
//! | Linux | aarch64-unknown-linux-musl |
64+
//! | Linux | arm-unknown-linux-gnueabi |
65+
//! | Linux | arm-unknown-linux-gnueabihf |
66+
//! | Linux | arm-unknown-linux-musleabi |
67+
//! | Linux | arm-unknown-linux-musleabihf |
68+
//! | Linux | armv5te-unknown-linux-gnueabi |
69+
//! | Linux | armv7-unknown-linux-gnueabihf |
70+
//! | Linux | armv7-unknown-linux-musleabihf |
71+
//! | Linux | i586-unknown-linux-gnu |
72+
//! | Linux | i586-unknown-linux-musl |
73+
//! | Linux | i686-unknown-linux-gnu |
74+
//! | Linux | i686-unknown-linux-musl |
75+
//! | Linux | mips64-unknown-linux-gnuabi64 |
76+
//! | Linux | powerpc64le-unknown-linux-gnu |
77+
//! | Linux | powerpc64le-unknown-linux-musl |
78+
//! | Linux | s390x-unknown-linux-gnu |
79+
//! | Linux | s390x-unknown-linux-musl |
80+
//! | Linux | x86_64-unknown-linux-gnu |
81+
//! | Linux | x86_64-unknown-linux-musl |
82+
//! | MacOS | aarch64-apple-darwin |
83+
//! | MacOS | x86_64-apple-darwin |
84+
//! | Windows | x86_64-pc-windows-msvc |
8585
//!
8686
//! ## Safety
8787
//!

postgresql_embedded/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ version.workspace = true
1313
[build-dependencies]
1414
anyhow = { workspace = true }
1515
hex = { workspace = true }
16-
postgresql_archive = { path = "../postgresql_archive", version = "0.1.2" }
16+
postgresql_archive = { path = "../postgresql_archive", version = "0.2.0" }
1717
sha2 = { workspace = true }
1818
tokio = { workspace = true }
1919

@@ -23,7 +23,7 @@ bytes = { workspace = true }
2323
hex = { workspace = true }
2424
home = { workspace = true }
2525
lazy_static = { workspace = true }
26-
postgresql_archive = { path = "../postgresql_archive", version = "0.1.2" }
26+
postgresql_archive = { path = "../postgresql_archive", version = "0.2.0" }
2727
rand = { workspace = true }
2828
sha2 = { workspace = true }
2929
tempfile = { workspace = true }

postgresql_embedded/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ uses.
7373

7474
The following features are available:
7575

76-
| Name | Description | Default? |
77-
|------------|---|---|
78-
| `bundled` | Bundles the PostgreSQL archive into the resulting binary | Yes |
79-
| `blocking` | Enables the blocking API; requires `tokio` | No |
80-
| `tokio` | Enables using tokio for async | No |
76+
| Name | Description | Default? |
77+
|------------|-----------------------------------------------------------|----------|
78+
| `bundled` | Bundles the PostgreSQL archive into the resulting binary | Yes |
79+
| `blocking` | Enables the blocking API; requires `tokio` | No |
80+
| `tokio` | Enables using tokio for async | No |
8181

8282
## Safety
8383

postgresql_embedded/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
//!
2323
//! ### Asynchronous API
2424
//!
25-
//! ```rust, ignore
25+
//! ```no_run
2626
//! use postgresql_embedded::PostgreSQL;
2727
//!
2828
//! #[tokio::main]
@@ -41,7 +41,7 @@
4141
//! ```
4242
//!
4343
//! ### Synchronous API
44-
//! ```rust, ignore
44+
//! ```no_run
4545
//! use postgresql_embedded::blocking::PostgreSQL;
4646
//!
4747
//! let mut postgresql = PostgreSQL::default();
@@ -80,11 +80,11 @@
8080
//!
8181
//! The following features are available:
8282
//!
83-
//! Name | Description | Default?
84-
//! ---|---|---
85-
//! `bundled` | Bundles the PostgreSQL archive into the resulting binary | Yes
86-
//! `blocking` | Enables the blocking API; requires `tokio` | No
87-
//! `tokio` | Enables using tokio for async | No
83+
//! | Name | Description | Default? |
84+
//! |------------|-----------------------------------------------------------|----------|
85+
//! | `bundled` | Bundles the PostgreSQL archive into the resulting binary | Yes |
86+
//! | `blocking` | Enables the blocking API; requires `tokio` | No |
87+
//! | `tokio` | Enables using tokio for async | No |
8888
//!
8989
//! ## Safety
9090
//!
@@ -112,7 +112,7 @@
112112
pub mod blocking;
113113
mod command;
114114
mod error;
115-
pub mod postgresql;
115+
mod postgresql;
116116
mod settings;
117117

118118
pub use error::{EmbeddedError, Result};

0 commit comments

Comments
 (0)