Skip to content

Commit

Permalink
Add cluster set local address wrapper (#40)
Browse files Browse the repository at this point in the history
* wrapper for set_local_address and rebase to 0.11

Signed-off-by: Harry Dodds <harry.dodds@metaswitch.com>

* don't download the driver use the local copies

Signed-off-by: Harry Dodds <harry.dodds@metaswitch.com>

* Update to pick up 2.8.1 of C++ driver

Signed-off-by: Harry Dodds <harry.dodds@metaswitch.com>

* Now using cassandra cpp driver 2.10.0
Rebased this branch on master.
This is to expose the new function (set_local_address)
added by CPP-499.

Signed-off-by: David Ray david.ray@metaswitch.com

* add-cluster-set-local-address-wrapper
Add changelog entry and prepare to release version 0.13.0

Signed-off-by: David Ray david.ray@metaswitch.com
  • Loading branch information
hd22 authored and kw217 committed Dec 4, 2018
1 parent 378925a commit 142a5d4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Expand Up @@ -6,6 +6,10 @@ This file's format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). The
version number is tracked in the file `VERSION`.

## [0.13.0] - 2018-12-04
- Added new set_local_address function using the function Datastax added in
cassandra-cpp-driver version 2.10.0

## [0.12.0] - 2018-12-04
### Fixed
- No longer leaks all `CassResult`s.
Expand Down Expand Up @@ -106,7 +110,8 @@ First release of https://github.com/Metaswitch/cassandra-rs
## [0.8.1] - 2016-12-13
Last release of https://github.com/tupshin/cassandra-rs

[Unreleased]: https://github.com/Metaswitch/cassandra-rs/compare/0.12.0...HEAD
[Unreleased]: https://github.com/Metaswitch/cassandra-rs/compare/0.13.0...HEAD
[0.13.0]: https://github.com/Metaswitch/cassandra-rs/compare/0.12.0...0.13.0
[0.12.0]: https://github.com/Metaswitch/cassandra-rs/compare/0.11.0...0.12.0
[0.11.0]: https://github.com/Metaswitch/cassandra-rs/compare/0.10.2...0.11.0
[0.10.2]: https://github.com/Metaswitch/cassandra-rs/compare/0.10.1...0.10.2
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -8,7 +8,7 @@ keywords = [ "Cassandra", "binding", "CQL", "client", "database" ]
categories = [ "api-bindings", "database", "external-ffi-bindings", "asynchronous" ]
license = "Apache-2.0"
name = "cassandra-cpp"
version = "0.12.0"
version = "0.13.0"
authors = ["Tupshin Harper <tupshin@tupshin.com>", "Keith Wansbrough <Keith.Wansbrough@metaswitch.com>"]
build = "build.rs"

Expand Down
13 changes: 13 additions & 0 deletions src/cassandra/cluster.rs
Expand Up @@ -15,6 +15,7 @@ use cassandra_sys::cass_cluster_set_connect_timeout;
use cassandra_sys::cass_cluster_set_connection_heartbeat_interval;
use cassandra_sys::cass_cluster_set_connection_idle_timeout;
use cassandra_sys::cass_cluster_set_contact_points;
use cassandra_sys::cass_cluster_set_local_address;
use cassandra_sys::cass_cluster_set_core_connections_per_host;
use cassandra_sys::cass_cluster_set_credentials;
use cassandra_sys::cass_cluster_set_latency_aware_routing;
Expand Down Expand Up @@ -117,6 +118,18 @@ impl Cluster {
}
}

/// Sets the local address to bind when connecting to the cluster,
/// if desired.
///
/// Only numeric addresses are supported.
pub fn set_local_address(&mut self, name: &str) -> Result<&mut Self> {
unsafe {
let s = CString::new(name.clone())?;
let err = cass_cluster_set_local_address(self.0, s.as_ptr());
err.to_result(self)
}
}


/// Sets the port
///
Expand Down
1 change: 1 addition & 0 deletions src/cassandra/value.rs
Expand Up @@ -32,6 +32,7 @@ use cassandra_sys::CASS_VALUE_TYPE_TIME;
use cassandra_sys::CASS_VALUE_TYPE_TIMESTAMP;
use cassandra_sys::CASS_VALUE_TYPE_TIMEUUID;
use cassandra_sys::CASS_VALUE_TYPE_TINY_INT;
use cassandra_sys::CASS_VALUE_TYPE_DURATION;
use cassandra_sys::CASS_VALUE_TYPE_TUPLE;
use cassandra_sys::CASS_VALUE_TYPE_UDT;
use cassandra_sys::CASS_VALUE_TYPE_UNKNOWN;
Expand Down

0 comments on commit 142a5d4

Please sign in to comment.