#postgresql #database-server #server #embedded-database

postgresql_archive

A library for downloading and extracting PostgreSQL archives

48 releases (16 breaking)

new 0.17.3 Nov 12, 2024
0.17.0 Sep 28, 2024
0.14.2 Jul 17, 2024
0.7.3 Mar 25, 2024

#575 in Database interfaces

Download history 871/week @ 2024-07-29 875/week @ 2024-08-05 897/week @ 2024-08-12 660/week @ 2024-08-19 959/week @ 2024-08-26 844/week @ 2024-09-02 547/week @ 2024-09-09 619/week @ 2024-09-16 875/week @ 2024-09-23 1393/week @ 2024-09-30 589/week @ 2024-10-07 651/week @ 2024-10-14 692/week @ 2024-10-21 834/week @ 2024-10-28 851/week @ 2024-11-04 849/week @ 2024-11-11

3,240 downloads per month
Used in 6 crates (2 directly)

(Apache-2.0 OR MIT) AND PostgreSQL

110KB
2.5K SLoC

PostgreSQL Archive

ci Documentation Code Coverage Benchmarks Latest version License Semantic Versioning

A configurable library for downloading and extracting PostgreSQL archives.

Examples

Asynchronous API

use postgresql_archive::{extract, get_archive, Result, VersionReq};
use postgresql_archive::configuration::theseus;

#[tokio::main]
async fn main() -> Result<()> {
    let url = theseus::URL;
    let (archive_version, archive) = get_archive(url, &VersionReq::STAR).await?;
    let out_dir = std::env::temp_dir();
    extract(url, &archive, &out_dir).await
}

Synchronous API

use postgresql_archive::configuration::theseus;
use postgresql_archive::{Result, VersionReq};
use postgresql_archive::blocking::{extract, get_archive};

fn main() -> Result<()> {
    let url = theseus::URL;
    let (archive_version, archive) = get_archive(url, &VersionReq::STAR)?;
    let out_dir = std::env::temp_dir();
    extract(url, &archive, &out_dir)
}

Feature flags

postgresql_archive uses [feature flags] to address compile time and binary size uses.

The following features are available:

Name Description Default?
blocking Enables the blocking API No
native-tls Enables native-tls support Yes
rustls-tls Enables rustls-tls support No

Configurations

Name Description Default?
theseus Enables theseus PostgreSQL binaries Yes
zonky Enables zonky PostgreSQL binaries No

Hashers

Name Description Default?
md5 Enables md5 hashers No
sha1 Enables sha1 hashers No
sha2 Enables sha2 hashers Yes¹

¹ enabled by the theseus feature flag.

Repositories

Name Description Default?
github Enables github repository Yes¹
maven Enables maven repository No

¹ enabled by the theseus feature flag.

Supported platforms

postgresql_archive provides implementations for the following:

Safety

This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~23–39MB
~602K SLoC