Skip to content

Commit

Permalink
Merge pull request #42 from aerospike/base64
Browse files Browse the repository at this point in the history
Impl: Replace rustc_serialize::base64 with base64 crate
  • Loading branch information
jhecking authored Oct 12, 2017
2 parents aa54159 + b7f8fc8 commit a62a61b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ travis-ci = { repository = "aerospike/aerospike-client-rust" }
log = "^0.3"
byteorder = "^0.5"
rust-crypto = "^0.2"
rustc-serialize = "0.3"
base64 = "^0.7.0"
crossbeam = "0.2"
rand = "0.3"
scoped-pool = "^1.0"
Expand Down
6 changes: 3 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::sync::Arc;
use std::thread;
use std::vec::Vec;

use rustc_serialize::base64::{ToBase64, FromBase64, STANDARD};
use base64;
use scoped_pool::Pool;

use errors::*;
Expand Down Expand Up @@ -494,7 +494,7 @@ impl Client {
udf_name: &str,
language: UDFLang)
-> Result<()> {
let udf_body = udf_body.to_base64(STANDARD);
let udf_body = base64::encode(udf_body);

let cmd = format!("udf-put:filename={};content={};content-len={};udf-type={};",
udf_name,
Expand All @@ -505,7 +505,7 @@ impl Client {
let response = try!(node.info(policy.base_policy.timeout, &[&cmd]));

if let Some(msg) = response.get("error") {
let msg = try!(msg.from_base64());
let msg = base64::decode(msg)?;
let msg = try!(str::from_utf8(&msg));
bail!("UDF Registration failed: {}, file: {}, line: {}, message: {}",
response.get("error").unwrap_or(&"-".to_string()),
Expand Down
6 changes: 2 additions & 4 deletions src/cluster/partition_tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

extern crate rustc_serialize;

use std::str;
use std::collections::HashMap;
use std::collections::hash_map::Entry::{Vacant, Occupied};
use std::vec::Vec;
use std::sync::Arc;

use parking_lot::RwLock;
use rustc_serialize::base64::FromBase64;
use base64;

use errors::*;
use cluster::Node;
Expand Down Expand Up @@ -65,7 +63,7 @@ impl PartitionTokenizer {
loop {
match (parts.next(), parts.next()) {
(Some(ns), Some(part)) => {
let restore_buffer = try!(part.from_base64());
let restore_buffer = base64::decode(part)?;
match amap.entry(ns.to_string()) {
Vacant(entry) => {
entry.insert(vec![node.clone(); node::PARTITIONS]);
Expand Down
4 changes: 2 additions & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ error_chain! {
// Automatic conversions between this error chain and other error types not defined by the
// `error_chain!`.
foreign_links {
Base64(::rustc_serialize::base64::FromBase64Error)
#[doc = "Error deserializing a Base64 encoded value"];
Base64(::base64::DecodeError)
#[doc = "Error decoding Base64 encoded value"];
InvalidUtf8(::std::str::Utf8Error)
#[doc = "Error interpreting a sequence of u8 as a UTF-8 encoded string."];
Io(::std::io::Error)
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
extern crate log;
extern crate byteorder;
extern crate crypto;
extern crate rustc_serialize;
extern crate base64;
extern crate crossbeam;
extern crate rand;
extern crate pwhash;
Expand Down

0 comments on commit a62a61b

Please sign in to comment.