Compare commits

..

24 Commits
static ... main

Author SHA1 Message Date
Thijs Cadier f69ea92007 Bump version 1 year ago
Thijs Cadier 1194acf7ff Only enable zstd if package found 1 year ago
Thijs Cadier e7a200e47e Bump version 1 year ago
Thijs Cadier 81b452d429 Disable snappy if the lib can't be found 1 year ago
thijsc d176ca1cf6 Bump version 2 years ago
Thijs Cadier 8da4e45e01
Merge pull request #73 from appsignal/mongoc_1_22
Bump mongoc driver to 1.22.0
2 years ago
thijsc 74d1f73261 Bump mongoc driver to 1.22.0 2 years ago
Thijs Cadier 7fcdeed53c Bump version 4 years ago
Thijs Cadier e3bb485807
Merge pull request #67 from appsignal/bsconc_memory_leak_fix
Fix memory leak in Bscon::new
4 years ago
Thijs Cadier fa2dd0dbd9 Fix memory leak in Bscon::new
See https://github.com/appsignal/mongo-rust-driver/issues/66 for
details. Thanks to @austinjones for figuring this out.
4 years ago
Thijs Cadier 6b298e17a2 Hard version lock on sys dependency 4 years ago
Thijs Cadier 13ab54f62e Bump version 4 years ago
Thijs Cadier f83786cdac
Merge pull request #65 from appsignal/snappy
Tweak linking in build
4 years ago
Thijs Cadier d67b74f8c6 Tweak linking in build 4 years ago
Thijs Cadier a231e250cc Bump version 4 years ago
Thijs Cadier f2180f4263 Remove travis from readme and cargo config 4 years ago
Thijs Cadier c9af4825ed Always print cargo link in sys build 4 years ago
Thijs Cadier f581295984
Merge pull request #64 from appsignal/mongoc_1_17_5
Bump libmongoc to 1.17.5
4 years ago
Thijs Cadier 719a8f52bc Bump libmongoc to 1.17.5 4 years ago
Thijs Cadier 903d387dd5 Bump version 4 years ago
Thijs Cadier c24310b49d Use static libbson in probe in build 4 years ago
Thijs Cadier 219bfb839a Remove two cmake options 4 years ago
Thijs Cadier 7c09166ebd Bump version 4 years ago
Thijs Cadier a38d9bc26e
Merge pull request #61 from appsignal/static
Move back to static linking
4 years ago

@ -1,3 +1,31 @@
# 0.14.2
* Disable zstd if package is not found
# 0.14.1
* Disable snappy if package is not found
# 0.14.0
* Bump mongoc to 1.22.0
# 0.13.6
* Memory leak fix in Bscon::new by (by austinjones)
# 0.13.5
* Hard version lock on sys dependency
# 0.13.4
* Tweak linking options, use snappy if available
# 0.13.3
* Upgrade libmongoc to 1.17.4
* Another static linking fix
# 0.13.2
* Fix probe of libbson so static linking actually works
# 0.13.1
* Statically link libmongoc
# 0.13.0 # 0.13.0
* Bump bson dependency to 1.2 * Bump bson dependency to 1.2
* Upgrade libmongoc to 1.17.4 * Upgrade libmongoc to 1.17.4

@ -1,6 +1,6 @@
[package] [package]
name = "mongo_driver" name = "mongo_driver"
version = "0.13.0" version = "0.14.2"
authors = ["Thijs Cadier <thijs@appsignal.com>"] authors = ["Thijs Cadier <thijs@appsignal.com>"]
description = "Mongo Rust driver built on top of the Mongo C driver" description = "Mongo Rust driver built on top of the Mongo C driver"
readme = "README.md" readme = "README.md"
@ -12,7 +12,6 @@ license = "MIT/Apache-2.0"
edition = "2018" edition = "2018"
[badges] [badges]
travis-ci = { repository = "thijsc/mongo-rust-driver" }
is-it-maintained-issue-resolution = { repository = "thijsc/mongo-rust-driver" } is-it-maintained-issue-resolution = { repository = "thijsc/mongo-rust-driver" }
is-it-maintained-open-issues = { repository = "thijsc/mongo-rust-driver" } is-it-maintained-open-issues = { repository = "thijsc/mongo-rust-driver" }
@ -25,7 +24,7 @@ serde_derive = "1.0"
[dependencies.mongoc-sys] [dependencies.mongoc-sys]
path = "mongoc-sys" path = "mongoc-sys"
version = "1.17.4" version = "=1.22.0-2"
[dev-dependencies] [dev-dependencies]
chrono = "^0.4" chrono = "^0.4"

@ -1,6 +1,5 @@
# Mongo Rust Driver # Mongo Rust Driver
[![Build Status](https://travis-ci.org/thijsc/mongo-rust-driver.svg)](https://travis-ci.org/thijsc/mongo-rust-driver)
[![Crate](http://meritbadge.herokuapp.com/mongo_driver)](https://crates.io/crates/mongo_driver) [![Crate](http://meritbadge.herokuapp.com/mongo_driver)](https://crates.io/crates/mongo_driver)
Mongo Rust driver built on top of the [Mongo C driver](https://github.com/mongodb/mongo-c-driver). Mongo Rust driver built on top of the [Mongo C driver](https://github.com/mongodb/mongo-c-driver).

@ -1,6 +1,6 @@
[package] [package]
name = "mongoc-sys" name = "mongoc-sys"
version = "1.17.4" version = "1.22.0-2"
description = "Sys package with installer and bindings for mongoc" description = "Sys package with installer and bindings for mongoc"
authors = ["Thijs Cadier <thijs@appsignal.com>"] authors = ["Thijs Cadier <thijs@appsignal.com>"]
build = "build.rs" build = "build.rs"

@ -10,14 +10,6 @@ fn main() {
.next() .next()
.expect("Crate version is not valid"); .expect("Crate version is not valid");
pkg_config::Config::new().probe("zlib").expect("Cannot find zlib");
if pkg_config::Config::new()
.atleast_version(mongoc_version)
.statik(true)
.probe("libmongoc-1.0")
.is_err()
{
let out_dir_var = env::var("OUT_DIR").expect("No out dir"); let out_dir_var = env::var("OUT_DIR").expect("No out dir");
let out_dir = Path::new(&out_dir_var); let out_dir = Path::new(&out_dir_var);
let driver_src_path = out_dir.join(format!("mongo-c-driver-{}", mongoc_version)); let driver_src_path = out_dir.join(format!("mongo-c-driver-{}", mongoc_version));
@ -55,6 +47,28 @@ fn main() {
let mut cmake = Command::new("cmake"); let mut cmake = Command::new("cmake");
cmake.current_dir(&driver_src_path); cmake.current_dir(&driver_src_path);
let pkg = pkg_config::Config::new();
pkg.probe("zlib").expect("Cannot find zlib");
#[cfg(target_os = "linux")] pkg.probe("icu-i18n").expect("Cannot find icu");
match pkg.probe("snappy") {
Ok(_) => {
cmake.arg("-DENABLE_SNAPPY=ON");
},
Err(e) => {
println!("Snappy not found: {}", e);
cmake.arg("-DENABLE_SNAPPY=OFF");
}
}
match pkg.probe("zstd") {
Ok(_) => {
cmake.arg("-DENABLE_ZSTD=ON");
},
Err(e) => {
println!("Zstd not found: {}", e);
cmake.arg("-DENABLE_ZSTD=OFF");
}
}
cmake.arg("-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF"); cmake.arg("-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF");
cmake.arg("-DENABLE_SSL=OPENSSL"); cmake.arg("-DENABLE_SSL=OPENSSL");
cmake.arg("-DENABLE_SASL=OFF"); cmake.arg("-DENABLE_SASL=OFF");
@ -64,9 +78,6 @@ fn main() {
cmake.arg("-DENABLE_TESTS=OFF"); cmake.arg("-DENABLE_TESTS=OFF");
cmake.arg("-DENABLE_SHM_COUNTERS=OFF"); cmake.arg("-DENABLE_SHM_COUNTERS=OFF");
cmake.arg("-DWITH_PIC=ON"); cmake.arg("-DWITH_PIC=ON");
cmake.arg("-DWITH_SNAPPY=OFF");
cmake.arg("-DWITH_ZLIB=ON");
cmake.arg("-DENABLE_EXTRA_ALIGNMENT=OFF");
// Run in current dir // Run in current dir
cmake.arg("."); cmake.arg(".");
@ -89,6 +100,4 @@ fn main() {
println!("cargo:rustc-link-lib=static=bson-static-1.0"); println!("cargo:rustc-link-lib=static=bson-static-1.0");
println!("cargo:rustc-link-lib=static=mongoc-static-1.0"); println!("cargo:rustc-link-lib=static=mongoc-static-1.0");
println!("cargo:rustc-link-lib=resolv"); println!("cargo:rustc-link-lib=resolv");
#[cfg(target_os = "linux")] println!("cargo:rustc-link-lib=icuuc");
}
} }

@ -16,7 +16,12 @@ pub struct Bsonc {
impl Bsonc { impl Bsonc {
pub fn new() -> Bsonc { pub fn new() -> Bsonc {
Bsonc::from_ptr(unsafe { bindings::bson_new() }) let inner: *const bindings::bson_t = unsafe { bindings::bson_new() };
assert!(!inner.is_null());
Bsonc {
inner: inner as *mut bindings::bson_t,
destroy_inner_on_drop: true,
}
} }
/// Create a bsonc from a raw pointer. Does not run cleanup /// Create a bsonc from a raw pointer. Does not run cleanup
@ -111,6 +116,13 @@ impl Drop for Bsonc {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[test]
fn test_bsonc_new() {
for _ in 0..100 {
let _ = super::Bsonc::new();
}
}
#[test] #[test]
fn test_bsonc_from_and_as_document() { fn test_bsonc_from_and_as_document() {
let document = doc! { "key": "value" }; let document = doc! { "key": "value" };

@ -45,8 +45,7 @@ pub struct Database<'a> {
} }
impl<'a> Database<'a> { impl<'a> Database<'a> {
#[doc(ignore)] pub(crate) fn new(
pub fn new(
created_by: CreatedBy<'a>, created_by: CreatedBy<'a>,
inner: *mut bindings::mongoc_database_t inner: *mut bindings::mongoc_database_t
) -> Database<'a> { ) -> Database<'a> {

Loading…
Cancel
Save