diff --git a/riak_client/cxx/basic.hpp b/riak_client/cxx/basic.hpp index fe118ae..ad94951 100644 --- a/riak_client/cxx/basic.hpp +++ b/riak_client/cxx/basic.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/riak_client/cxx/basic/basic_client.hpp b/riak_client/cxx/basic/basic_client.hpp index ad9f99c..f4d325b 100644 --- a/riak_client/cxx/basic/basic_client.hpp +++ b/riak_client/cxx/basic/basic_client.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/riak_client/cxx/basic/bucket_properties.hpp b/riak_client/cxx/basic/bucket_properties.hpp index fb5e9f3..fecc2b2 100644 --- a/riak_client/cxx/basic/bucket_properties.hpp +++ b/riak_client/cxx/basic/bucket_properties.hpp @@ -22,15 +22,15 @@ #include -namespace riak { +namespace riak { /// Customizable properties of a Riak Bucket. -/// +/// /// @see http://wiki.basho.com/Basic-Riak-API-Operations.html class RIAKC_API bucket_properties { public: - bucket_properties() + bucket_properties() : allow_mult_(false), n_val_(-1) { } /// Return the value of the allow_mult bucket property. @@ -41,7 +41,7 @@ class RIAKC_API bucket_properties /// Return the n-val bucket property. /// - /// The n-value is the replication factor of a bucket. + /// The n-value is the replication factor of a bucket. int n_val() const { return n_val_; @@ -53,7 +53,7 @@ class RIAKC_API bucket_properties allow_mult_ = allow; } - /// Set the n_val bucket property. + /// Set the n_val bucket property. void n_val(int n) { n_val_ = n; diff --git a/riak_client/cxx/basic/quorum.hpp b/riak_client/cxx/basic/quorum.hpp index ab8e1fd..4023e90 100644 --- a/riak_client/cxx/basic/quorum.hpp +++ b/riak_client/cxx/basic/quorum.hpp @@ -19,9 +19,9 @@ #include -namespace riak { +namespace riak { - struct quora + struct quora { quora() : qval_(-1) {} quora(int val) : qval_(val) {} @@ -33,8 +33,8 @@ namespace riak { struct ONE : quora {}; struct ALL : quora {}; struct QUORUM : quora {}; - struct DEFAULT : quora {}; - + struct DEFAULT : quora {}; + } // :: riak #endif // include guard diff --git a/riak_client/cxx/basic/response.hpp b/riak_client/cxx/basic/response.hpp index 14ee01c..00404d0 100644 --- a/riak_client/cxx/basic/response.hpp +++ b/riak_client/cxx/basic/response.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +23,8 @@ namespace riak { template -class RIAKC_API response -{ +class RIAKC_API response +{ public: // constructors response(const riak_error& error) : error_(error), value_() { } @@ -34,11 +34,11 @@ class RIAKC_API response public: // accessors riak_error error() const { return error_; } - T value() { - if (error_) { + T value() { + if (error_) { throw exception(error_); } - return value_; + return value_; } operator T() { return value(); } operator const T() const { return value(); } diff --git a/riak_client/cxx/basic/riak_result.hpp b/riak_client/cxx/basic/riak_result.hpp index 8a03f61..94f24b4 100644 --- a/riak_client/cxx/basic/riak_result.hpp +++ b/riak_client/cxx/basic/riak_result.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ #include #include -namespace riak { +namespace riak { class RIAKC_API riak_result : public riak_version { @@ -45,17 +45,17 @@ class RIAKC_API riak_result : public riak_version bool not_found() const { return contents_.empty(); } std::size_t sibling_count() const { return contents_.size(); } const content_vector& contents() const { return contents_; } - operator object() + operator object() { - if (contents_.size() != 1) + if (contents_.size() != 1) { throw riak::exception("unresolved conflict"); } return object(*this, contents_[0]); } - operator const object() const - { - if (contents_.size() != 1) + operator const object() const + { + if (contents_.size() != 1) { throw riak::exception("unresolved conflict"); } diff --git a/riak_client/cxx/basic/server_info.hpp b/riak_client/cxx/basic/server_info.hpp index 3a00cd6..ee4e5ab 100644 --- a/riak_client/cxx/basic/server_info.hpp +++ b/riak_client/cxx/basic/server_info.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,7 @@ #include -namespace riak { +namespace riak { class RIAKC_API server_info { diff --git a/riak_client/cxx/basic/store_params.hpp b/riak_client/cxx/basic/store_params.hpp index 6b3c1d0..4eec927 100644 --- a/riak_client/cxx/basic/store_params.hpp +++ b/riak_client/cxx/basic/store_params.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,9 +19,9 @@ #include -namespace riak { +namespace riak { -class RIAKC_API store_params +class RIAKC_API store_params { public: store_params() @@ -35,9 +35,9 @@ class RIAKC_API store_params store_params& w(quora w) { w_ = w; return *this;} store_params& dw(quora dw) { dw_ = dw; return *this;} store_params& pw(quora pw) { pw_ = pw; return *this; } - store_params& return_body(bool returnbody) - { - return_body_ = returnbody; + store_params& return_body(bool returnbody) + { + return_body_ = returnbody; return *this; } private: // intentionally copyable diff --git a/riak_client/cxx/client.hpp b/riak_client/cxx/client.hpp index e67f610..8639ca5 100644 --- a/riak_client/cxx/client.hpp +++ b/riak_client/cxx/client.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/riak_client/cxx/client/bucket.hpp b/riak_client/cxx/client/bucket.hpp index 127ed7b..2cf3106 100644 --- a/riak_client/cxx/client/bucket.hpp +++ b/riak_client/cxx/client/bucket.hpp @@ -32,7 +32,7 @@ namespace riak { template -class RIAKC_API basic_bucket +class RIAKC_API basic_bucket { public: basic_bucket(const std::string& name, client_ptr c) @@ -40,7 +40,7 @@ class RIAKC_API basic_bucket public: const std::string& name() const { return name_; } string_vector keys() { return client_->list_keys(name_); } - fetch_object fetch(const std::string& key) + fetch_object fetch(const std::string& key) { return fetch_object(client_, name_, key); } @@ -48,10 +48,10 @@ class RIAKC_API basic_bucket { return store_object(client_, name_, key).with_value(value); } - store_object store(const std::string& key, const char* buf, + store_object store(const std::string& key, const char* buf, std::size_t len); - delete_object del(const std::string& key) + delete_object del(const std::string& key) { return delete_object(client_, name_, key); } diff --git a/riak_client/cxx/client/client.hpp b/riak_client/cxx/client/client.hpp index f9599a8..3dee42b 100644 --- a/riak_client/cxx/client/client.hpp +++ b/riak_client/cxx/client/client.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,7 @@ #include #include -namespace riak { +namespace riak { class RIAKC_API client { @@ -30,13 +30,13 @@ class RIAKC_API client client(const std::string& host, const std::string& port) : basic_client_(riak::new_client(host, port)) { } public: - template - basic_bucket bucket(const std::string& name) + template + basic_bucket bucket(const std::string& name) { return basic_bucket(name, basic_client_); } - uint32_t get_client_id() + uint32_t get_client_id() { return basic_client_->client_id(); } @@ -46,7 +46,7 @@ class RIAKC_API client basic_client_->client_id(client_id); } - string_vector list_buckets() + string_vector list_buckets() { return basic_client_->list_buckets(); } diff --git a/riak_client/cxx/client/cluster.hpp b/riak_client/cxx/client/cluster.hpp index 024e4c4..c286965 100644 --- a/riak_client/cxx/client/cluster.hpp +++ b/riak_client/cxx/client/cluster.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,19 +44,19 @@ class RIAKC_API cluster cluster(const node& seed_node) : seed_node_(seed_node) { } public: - client make_client() + client make_client() { return make_client(seed_node_.host(), seed_node_.port()); } - static client make_client(const std::string& host, const std::string& port) + static client make_client(const std::string& host, const std::string& port) { return client(host, port); } - + private: node seed_node_; std::vector nodes_; -}; +}; } // ::riak diff --git a/riak_client/cxx/client/mutation.hpp b/riak_client/cxx/client/mutation.hpp index 591b501..3253a1d 100644 --- a/riak_client/cxx/client/mutation.hpp +++ b/riak_client/cxx/client/mutation.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,8 +24,8 @@ class clobber_mutator { public: clobber_mutator(const T& new_value) - : new_value_(new_value) { } - T operator()(const T& old_value) { + : new_value_(new_value) { } + T operator()(const T& old_value) { return new_value_; } private: diff --git a/riak_client/cxx/client/resolver.hpp b/riak_client/cxx/client/resolver.hpp index 65e561c..2042eaf 100644 --- a/riak_client/cxx/client/resolver.hpp +++ b/riak_client/cxx/client/resolver.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ #include #include -namespace riak { +namespace riak { struct RIAKC_API default_resolver { diff --git a/riak_client/cxx/common.hpp b/riak_client/cxx/common.hpp index fae3ece..20371b6 100644 --- a/riak_client/cxx/common.hpp +++ b/riak_client/cxx/common.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,7 @@ #include #include "config.h" -namespace riak { +namespace riak { typedef std::vector string_vector; typedef std::map string_map; diff --git a/riak_client/cxx/error.hpp b/riak_client/cxx/error.hpp index c37f7c9..4dcac5a 100644 --- a/riak_client/cxx/error.hpp +++ b/riak_client/cxx/error.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,7 +20,7 @@ #include #include -namespace riak { +namespace riak { class RIAKC_API riak_error { diff --git a/riak_client/cxx/object.hpp b/riak_client/cxx/object.hpp index ad4bf99..505ce37 100644 --- a/riak_client/cxx/object.hpp +++ b/riak_client/cxx/object.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/riak_client/cxx/object/link.hpp b/riak_client/cxx/object/link.hpp index 88131fc..3b05751 100644 --- a/riak_client/cxx/object/link.hpp +++ b/riak_client/cxx/object/link.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,14 +22,14 @@ #include #include -namespace riak { +namespace riak { class RIAKC_API link { public: link(const std::string& bucket, const std::string& key) : bkey_(bucket, key) { } - link(const std::string& bucket, const std::string& key, + link(const std::string& bucket, const std::string& key, const std::string& tag) : bkey_(bucket, key), tag_(tag) { } public: diff --git a/riak_client/cxx/object/object.hpp b/riak_client/cxx/object/object.hpp index 00b7548..664de94 100644 --- a/riak_client/cxx/object/object.hpp +++ b/riak_client/cxx/object/object.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,7 @@ #include #include -namespace riak { +namespace riak { template @@ -33,7 +33,7 @@ struct basic_content typedef ValueType value_type; public: basic_content() : value_() { } - basic_content(const value_type& value) : value_(value) { } + basic_content(const value_type& value) : value_(value) { } public: const value_type value() const; operator const value_type() const { return value_; } diff --git a/riak_client/cxx/object/riak_content.hpp b/riak_client/cxx/object/riak_content.hpp index 29d0eaf..bd4b73e 100644 --- a/riak_client/cxx/object/riak_content.hpp +++ b/riak_client/cxx/object/riak_content.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,12 +23,12 @@ #include #include -namespace riak { +namespace riak { class RIAKC_API riak_content { public: // constructors explicit riak_content() { } - explicit riak_content(const std::string& value) + explicit riak_content(const std::string& value) : value_(value) { } riak_content(const riak_metadata& metadata, const std::string& value) : metadata_(metadata), value_(value) { } diff --git a/riak_client/cxx/object/riak_metadata.hpp b/riak_client/cxx/object/riak_metadata.hpp index 1ea432a..e757215 100644 --- a/riak_client/cxx/object/riak_metadata.hpp +++ b/riak_client/cxx/object/riak_metadata.hpp @@ -1,7 +1,7 @@ /** @file riak_metadata.hpp @brief Riak Object Metadata */ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -71,7 +71,7 @@ class RIAKC_API riak_metadata void lastmod(lastmod_time_t lastmod); void lastmod(uint32_t secs, uint32_t usecs); void debug_print() const; -private: +private: string_map usermeta_; std::string content_type_; std::string charset_; @@ -80,80 +80,80 @@ class RIAKC_API riak_metadata lastmod_time_t last_mod_; }; -inline const std::string& -riak_metadata::content_type() const -{ - return content_type_; +inline const std::string& +riak_metadata::content_type() const +{ + return content_type_; } -inline const std::string& -riak_metadata::charset() const -{ - return charset_; +inline const std::string& +riak_metadata::charset() const +{ + return charset_; } -inline const std::string& -riak_metadata::encoding() const -{ - return encoding_; +inline const std::string& +riak_metadata::encoding() const +{ + return encoding_; } -inline const std::string& -riak_metadata::vtag() const -{ - return vtag_; -} +inline const std::string& +riak_metadata::vtag() const +{ + return vtag_; +} -inline const lastmod_time_t -riak_metadata::lastmod() const -{ - return last_mod_; -} +inline const lastmod_time_t +riak_metadata::lastmod() const +{ + return last_mod_; +} -inline const string_map& +inline const string_map& riak_metadata::usermeta() const { return usermeta_; } -inline void -riak_metadata::content_type(const std::string& content_type) -{ - content_type_ = content_type; +inline void +riak_metadata::content_type(const std::string& content_type) +{ + content_type_ = content_type; } -inline void -riak_metadata::charset(const std::string& charset) -{ - charset_ = charset; +inline void +riak_metadata::charset(const std::string& charset) +{ + charset_ = charset; } -inline void -riak_metadata::encoding(const std::string& encoding) -{ - encoding_ = encoding; +inline void +riak_metadata::encoding(const std::string& encoding) +{ + encoding_ = encoding; } -inline void +inline void riak_metadata::usermeta(const string_map& usermeta) { usermeta_ = usermeta; } -inline void -riak_metadata::vtag(const std::string& vtag) -{ - vtag_ = vtag; +inline void +riak_metadata::vtag(const std::string& vtag) +{ + vtag_ = vtag; } -inline void -riak_metadata::lastmod(lastmod_time_t lastmod) +inline void +riak_metadata::lastmod(lastmod_time_t lastmod) { last_mod_ = lastmod; } -inline void -riak_metadata::lastmod(uint32_t secs, uint32_t usecs) +inline void +riak_metadata::lastmod(uint32_t secs, uint32_t usecs) { last_mod_ = lastmod_time_t(secs, usecs); } diff --git a/riak_client/cxx/object/riak_object.hpp b/riak_client/cxx/object/riak_object.hpp index 1f469f6..de2c47d 100644 --- a/riak_client/cxx/object/riak_object.hpp +++ b/riak_client/cxx/object/riak_object.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,7 @@ #include #include -namespace riak { +namespace riak { class RIAKC_API object : public riak_version { @@ -32,7 +32,7 @@ class RIAKC_API object : public riak_version object(const riak_version& version, const riak_content& content) : riak_version(version), content_(content), update_content_(content) { } public: // accessors - const riak_content& content() const { return content_; } + const riak_content& content() const { return content_; } const std::string& value() const { return content_.value(); } const riak_metadata& metadata() const { return content_.metadata(); } const riak_metadata& update_metadata() const { return update_content_.metadata(); } @@ -43,7 +43,7 @@ class RIAKC_API object : public riak_version void debug_print() const; private: // intentionally copyable riak_content content_; - riak_content update_content_; + riak_content update_content_; }; inline object_ptr make_object(const std::string& bucket,const std::string& key) @@ -51,7 +51,7 @@ inline object_ptr make_object(const std::string& bucket,const std::string& key) return object_ptr(new object(riak_bkey(bucket, key))); } -inline object_ptr make_object(const std::string& bucket,const std::string& key, +inline object_ptr make_object(const std::string& bucket,const std::string& key, const std::string& value) { riak_version version(riak_bkey(bucket, key)); @@ -61,14 +61,14 @@ inline object_ptr make_object(const std::string& bucket,const std::string& key, template -T riak_object_cast(object_ptr p); +T riak_object_cast(object_ptr p); template <> -inline std::string riak_object_cast(object_ptr p) -{ +inline std::string riak_object_cast(object_ptr p) +{ if (!p) return ""; - return p->value(); + return p->value(); } } // ::riak diff --git a/riak_client/cxx/object/riak_version.hpp b/riak_client/cxx/object/riak_version.hpp index 8bfc24f..28431b7 100644 --- a/riak_client/cxx/object/riak_version.hpp +++ b/riak_client/cxx/object/riak_version.hpp @@ -1,7 +1,7 @@ /** @file riak_version.hpp @brief Riak Keys and Object Versions */ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,8 +22,8 @@ #include #include -namespace riak { - +namespace riak { + class RIAKC_API riak_bkey { public: // constructors @@ -41,7 +41,7 @@ class RIAKC_API riak_version { public: // constructors riak_version(const riak_bkey& bkey) - : bkey_(bkey) { } + : bkey_(bkey) { } riak_version(const riak_bkey& bkey, const std::string& vclock) : bkey_(bkey), vclock_(vclock) { } public: // accessors diff --git a/riak_client/cxx/operations.hpp b/riak_client/cxx/operations.hpp index e8264ab..efd36bd 100644 --- a/riak_client/cxx/operations.hpp +++ b/riak_client/cxx/operations.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/riak_client/cxx/operations/delete_object.hpp b/riak_client/cxx/operations/delete_object.hpp index cf83e36..5659a22 100644 --- a/riak_client/cxx/operations/delete_object.hpp +++ b/riak_client/cxx/operations/delete_object.hpp @@ -27,17 +27,17 @@ namespace riak { class RIAKC_API delete_object { public: - delete_object(client_ptr client, const std::string& bucket, + delete_object(client_ptr client, const std::string& bucket, const std::string& key) : client_(client), bucket_(bucket), key_(key) {} public: - delete_object& rw(int rw) + delete_object& rw(int rw) { rw_ = rw; return *this; } - - response operator()() { + + response operator()() { response result(client_->del(bucket_, key_, rw_)); if (result.error()) throw; return true; @@ -47,7 +47,7 @@ class RIAKC_API delete_object std::string bucket_; std::string key_; int rw_; - + }; } // ::riak diff --git a/riak_client/cxx/operations/fetch_object.hpp b/riak_client/cxx/operations/fetch_object.hpp index eb0a2e6..3aba9e8 100644 --- a/riak_client/cxx/operations/fetch_object.hpp +++ b/riak_client/cxx/operations/fetch_object.hpp @@ -23,7 +23,7 @@ #include #include -namespace riak { +namespace riak { template struct RIAKC_API fetch_object @@ -32,19 +32,19 @@ struct RIAKC_API fetch_object const std::string& key) : client_(client), bucket_(bucket), key_(key), r_(-1) {} public: - fetch_object r(int r) + fetch_object r(int r) { r_ = r; return *this; } - - response operator()() { + + response operator()() { response result(client_->fetch(bucket_, key_, r_)); if (result.error()) return result.error(); riak::object_ptr o(resolver().resolve(result)); return riak_object_cast(o); } - + private: client_ptr client_; std::string bucket_; diff --git a/riak_client/cxx/operations/store_object.hpp b/riak_client/cxx/operations/store_object.hpp index b51ab7b..f2af521 100644 --- a/riak_client/cxx/operations/store_object.hpp +++ b/riak_client/cxx/operations/store_object.hpp @@ -26,7 +26,7 @@ namespace riak { template , class resolver=default_resolver> -class RIAKC_API store_object +class RIAKC_API store_object { public: store_object(client_ptr c, const std::string& bucket, @@ -39,7 +39,7 @@ class RIAKC_API store_object store_object& return_body(bool val) { sp_.return_body(val); return *this; } store_object& with_value(const T& value) { val_ = value; return *this; } public: - response operator()() { + response operator()() { response fr = client_->fetch(bkey_.bucket(), bkey_.key(), r_); if (fr.error()) return fr.error(); riak::object_ptr obj = resolver().resolve(fr.value()); diff --git a/riak_client/cxx/riak_client.hpp b/riak_client/cxx/riak_client.hpp index 84d9245..1ee9630 100644 --- a/riak_client/cxx/riak_client.hpp +++ b/riak_client/cxx/riak_client.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/riak_client/cxx/riak_client_fwd.hpp b/riak_client/cxx/riak_client_fwd.hpp index c80aeb0..7c49980 100644 --- a/riak_client/cxx/riak_client_fwd.hpp +++ b/riak_client/cxx/riak_client_fwd.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,7 +20,7 @@ #include #include -namespace riak { +namespace riak { class connection; typedef shared_ptr connection_ptr; @@ -30,7 +30,7 @@ namespace riak { class object; typedef shared_ptr object_ptr; - + } // ::riak #endif // include guard diff --git a/riak_client/cxx/util.hpp b/riak_client/cxx/util.hpp index 6471437..afe7c8c 100644 --- a/riak_client/cxx/util.hpp +++ b/riak_client/cxx/util.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/riak_client/cxx/util/noncopyable.hpp b/riak_client/cxx/util/noncopyable.hpp index 42d9a33..c2fdd5b 100644 --- a/riak_client/cxx/util/noncopyable.hpp +++ b/riak_client/cxx/util/noncopyable.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,7 @@ #ifndef RIAKCXX_NONCOPYABLE_HPP_ #define RIAKCXX_NONCOPYABLE_HPP_ -namespace riak { +namespace riak { class noncopyable { diff --git a/riak_client/cxx/util/shared_ptr.hpp b/riak_client/cxx/util/shared_ptr.hpp index 349e32b..963fe96 100644 --- a/riak_client/cxx/util/shared_ptr.hpp +++ b/riak_client/cxx/util/shared_ptr.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,12 +20,12 @@ #if defined(HAVE_BOOST_SHARED_PTR) && defined(RIAKC_USE_BOOST_SHARED_PTR) #include -namespace riak { +namespace riak { using boost::shared_ptr; } #elif defined(HAVE_TR1_SHARED_PTR) #include -namespace riak { +namespace riak { using std::tr1::shared_ptr; } #else diff --git a/riak_client/cxx/util/url.hpp b/riak_client/cxx/util/url.hpp index bdaded0..de587df 100644 --- a/riak_client/cxx/util/url.hpp +++ b/riak_client/cxx/util/url.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,7 +20,7 @@ #include #include -namespace riak { +namespace riak { class RIAKC_API url { public: diff --git a/src/client.cpp b/src/client.cpp index bee46e2..f306429 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,11 +37,11 @@ struct riak_object_t riak_client riak_client_new(const char* host, const char *port) { riak_client_t* c = (riak_client_t*)malloc(sizeof(riak_client)); - try - { + try + { c->p = riak::new_client(host, port); } - catch (riak::exception& e) + catch (riak::exception& e) { free(c); errno = e.error_code(); @@ -56,7 +56,7 @@ riak_client riak_client_new(const char* host, const char *port) return c; } -void riak_client_free(riak_client c) { +void riak_client_free(riak_client c) { c->p.reset(); free(c); } @@ -64,7 +64,7 @@ void riak_client_free(riak_client c) { int riak_ping(riak_client c) { riak::response response = c->p->ping(); - if (response.error()) + if (response.error()) { errno = response.error().code(); return -1; @@ -76,7 +76,7 @@ int riak_ping(riak_client c) int riak_set_client_id(riak_client c, uint32_t id) { riak::response response = c->p->client_id(id); - if (response.error()) + if (response.error()) { errno = response.error().code(); return -1; @@ -89,7 +89,7 @@ int riak_set_client_id(riak_client c, uint32_t id) uint32_t riak_get_client_id(riak_client c) { riak::response response = c->p->client_id(); - if (response.error()) + if (response.error()) { errno = response.error().code(); return -1; @@ -158,7 +158,7 @@ const vclock riak_object_get_vclock(riak_object o) { riak::result_ptr obj(o->p); std::string vstr(obj->vclock()); - if (vstr.empty()) + if (vstr.empty()) return 0; size_t vclen = vstr.size(); vclock vc = (vclock)(malloc(sizeof(size_t)+vclen)); diff --git a/src/cxx/asio.hpp b/src/cxx/asio.hpp index a15dc9f..edffdf3 100644 --- a/src/cxx/asio.hpp +++ b/src/cxx/asio.hpp @@ -6,7 +6,7 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,8 +23,8 @@ #include -namespace riak { - namespace io { +namespace riak { + namespace io { using riakboost::asio::buffer; using riakboost::asio::read; using riakboost::asio::write; diff --git a/src/cxx/basic_client.cpp b/src/cxx/basic_client.cpp index 128024c..ef2c622 100644 --- a/src/cxx/basic_client.cpp +++ b/src/cxx/basic_client.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,7 @@ namespace riak { -uint32_t tss_client_id() +uint32_t tss_client_id() { std::stringstream ostr; ostr << boost::this_thread::get_id(); diff --git a/src/cxx/connection.cpp b/src/cxx/connection.cpp index d4a8660..0edbed7 100644 --- a/src/cxx/connection.cpp +++ b/src/cxx/connection.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,7 @@ #include "connection.hpp" #include -namespace riak { +namespace riak { namespace error = riakboost::asio::error; using boost::system::error_code; @@ -30,7 +30,7 @@ connection::connection(const std::string& host, const std::string& port) { } -connection::~connection() +connection::~connection() { socket_.close(); io_service_.stop(); @@ -43,8 +43,8 @@ connection::start() io::ip::tcp::resolver::query q(host_, port_); io::ip::tcp::resolver::iterator end; error_code ec = error::host_not_found; - io::ip::tcp::resolver::iterator it = r.resolve(q); - while (ec && it != end) { + io::ip::tcp::resolver::iterator it = r.resolve(q); + while (ec && it != end) { socket_.close(); socket_.connect(*it++, ec); } @@ -53,7 +53,7 @@ connection::start() return true; } -std::size_t +std::size_t connection::write(io::const_buffer buf) { error_code ec; std::size_t n = io::write(socket_, io::buffer(buf), @@ -63,10 +63,10 @@ connection::write(io::const_buffer buf) { return n; } -std::size_t +std::size_t connection::read(io::mutable_buffer buf) { error_code ec; - std::size_t n = io::read(socket_, io::buffer(buf), + std::size_t n = io::read(socket_, io::buffer(buf), io::transfer_all(), ec); if (ec) throw riak::exception(riak_error(ec.value(), ec.message())); diff --git a/src/cxx/connection.hpp b/src/cxx/connection.hpp index 6542613..dc740ab 100644 --- a/src/cxx/connection.hpp +++ b/src/cxx/connection.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,8 +25,8 @@ namespace riak { -class connection : private noncopyable -{ +class connection : private noncopyable +{ public: connection(const std::string& host, const std::string& port); ~connection(); diff --git a/src/cxx/pbc_client.cpp b/src/cxx/pbc_client.cpp index e6d0349..3790dbc 100644 --- a/src/cxx/pbc_client.cpp +++ b/src/cxx/pbc_client.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -64,7 +64,7 @@ void decode_contents(const T& response, content_vector& contents) { RpbContent content = response.content(i); string_map usermeta; - for (int j=0;jread(io::buffer(&header_buf[0], 5)); header.deserialize(header_buf, pbc_header::HEADER_SIZE); - if (header.code() == ERROR) + if (header.code() == ERROR) { pbc_storage storage(header.size()); error_resp err; - c->read(io::buffer(storage.data(), storage.size())); - err.deserialize(storage); + c->read(io::buffer(storage.data(), storage.size())); + err.deserialize(storage); error.code(err.errcode()); error.message(err.errmsg()); } @@ -119,7 +119,7 @@ std::size_t pbc_recv(connection_ptr c, Message& m) m.deserialize(storage); return riak_error(); } - + template riak_error execute(connection_ptr c, Operation& op) @@ -142,9 +142,9 @@ pbc_client::pbc_client(const string& host, const string& port) pbc_client::~pbc_client() { } - + response -pbc_client::ping() +pbc_client::ping() { ops::ping operation; riak_error error = execute(connection_, operation); @@ -152,18 +152,18 @@ pbc_client::ping() return true; } -response +response pbc_client::get_server_info() { ops::get_server_info operation; riak_error error = execute(connection_, operation); if (error) return error; - server_info s(operation.response().node(), + server_info s(operation.response().node(), operation.response().server_version()); return s; } -response +response pbc_client::del(const string& bucket, const string& key, int dw) { ops::del operation; @@ -176,7 +176,7 @@ pbc_client::del(const string& bucket, const string& key, int dw) } -response +response pbc_client::fetch(const string& bucket, const string& key, int r) { ops::get operation; @@ -216,7 +216,7 @@ pbc_client::fetch_bucket(const string& bucket) return bprops; } -response +response pbc_client::client_id() { ops::get_client_id operation; @@ -227,8 +227,8 @@ pbc_client::client_id() return *id; } -response -pbc_client::client_id(uint32_t client_id) +response +pbc_client::client_id(uint32_t client_id) { client_id_ = client_id; ops::set_client_id operation; @@ -275,7 +275,7 @@ pbc_client::list_keys(const string& bucket) riak_error error = execute(connection_, operation); if (error) return error; do { - for (int i=0;i #include -namespace riak { namespace pbc { +namespace riak { namespace pbc { class pbc_client : public riak::basic_client -{ +{ public: pbc_client(const std::string& host, const std::string& port); virtual ~pbc_client(); public: response ping(); response get_server_info(); - response del(const std::string& bucket, const std::string& key, + response del(const std::string& bucket, const std::string& key, int dw); - response set_bucket(const std::string& bucket, + response set_bucket(const std::string& bucket, const bucket_properties& properties); response client_id(uint32_t client_id); response client_id(); - response fetch(const std::string& bucket, + response fetch(const std::string& bucket, const std::string& key, int r); response store(object_ptr object, const store_params& params); response list_buckets(); diff --git a/src/cxx/pbc_fwd.hpp b/src/cxx/pbc_fwd.hpp index 7c93d1d..f5387f4 100644 --- a/src/cxx/pbc_fwd.hpp +++ b/src/cxx/pbc_fwd.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ namespace google { namespace protobuf { class MessageLite; }} // :: ::google::protobuf; -namespace riak { namespace pbc { +namespace riak { namespace pbc { typedef unsigned char msgcode_t; diff --git a/src/cxx/pbc_header.cpp b/src/cxx/pbc_header.cpp index e256190..e51bed5 100644 --- a/src/cxx/pbc_header.cpp +++ b/src/cxx/pbc_header.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,7 @@ #include #include -namespace riak { namespace pbc { +namespace riak { namespace pbc { void pbc_header::serialize(char* buf, std::size_t len) const @@ -30,7 +30,7 @@ pbc_header::serialize(char* buf, std::size_t len) const } void -pbc_header::deserialize(const char *buf, std::size_t len) +pbc_header::deserialize(const char *buf, std::size_t len) { assert(len >= 5); uint32_t *s = (uint32_t *)buf; diff --git a/src/cxx/pbc_header.hpp b/src/cxx/pbc_header.hpp index 200373b..61d8616 100644 --- a/src/cxx/pbc_header.hpp +++ b/src/cxx/pbc_header.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ #include #include "pbc_fwd.hpp" -namespace riak { namespace pbc { +namespace riak { namespace pbc { class pbc_header { diff --git a/src/cxx/pbc_message.cpp b/src/cxx/pbc_message.cpp index 1ce5503..2738cce 100644 --- a/src/cxx/pbc_message.cpp +++ b/src/cxx/pbc_message.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,15 +18,15 @@ #include "pbc_header.hpp" #include -namespace riak { namespace pbc { +namespace riak { namespace pbc { bool pbc_serialize(msgcode_t code, pbc_storage& storage, const MessageLite* message) { pbc_header header(code, sizeof(code)); - if (message) + if (message) { header.size(header.size()+message->ByteSize()); - message->SerializeToArray(storage.data()+pbc_header::HEADER_SIZE, + message->SerializeToArray(storage.data()+pbc_header::HEADER_SIZE, storage.size()); } header.serialize(storage.data(), pbc_header::HEADER_SIZE); @@ -34,7 +34,7 @@ bool pbc_serialize(msgcode_t code, pbc_storage& storage, const MessageLite* mess } -bool pbc_deserialize(msgcode_t code, const pbc_storage& storage, MessageLite* message) +bool pbc_deserialize(msgcode_t code, const pbc_storage& storage, MessageLite* message) { if (message) { diff --git a/src/cxx/pbc_message.hpp b/src/cxx/pbc_message.hpp index 41b7b44..4d989b3 100644 --- a/src/cxx/pbc_message.hpp +++ b/src/cxx/pbc_message.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,8 +20,8 @@ #include #include "pbc_fwd.hpp" #include "pbc_storage.hpp" - -namespace riak { namespace pbc { + +namespace riak { namespace pbc { typedef unsigned char msgcode_t; @@ -68,7 +68,7 @@ struct pbc_message : public P std::size_t size() const { return P::ByteSize(); } - bool serialize(pbc_storage& storage) const { + bool serialize(pbc_storage& storage) const { return pbc_serialize(code, storage, this); } @@ -84,7 +84,7 @@ struct pbc_message std::size_t size() const { return 0; } - bool serialize(pbc_storage& storage) const { + bool serialize(pbc_storage& storage) const { return pbc_serialize(code, storage); } diff --git a/src/cxx/pbc_operations.hpp b/src/cxx/pbc_operations.hpp index 8528204..22f891f 100644 --- a/src/cxx/pbc_operations.hpp +++ b/src/cxx/pbc_operations.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,7 @@ #include "pbc_message.hpp" #include "src/cxx/riakclient.pb.h" -namespace riak { namespace pbc { +namespace riak { namespace pbc { template diff --git a/src/cxx/pbc_storage.hpp b/src/cxx/pbc_storage.hpp index 7153c87..6bec623 100644 --- a/src/cxx/pbc_storage.hpp +++ b/src/cxx/pbc_storage.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,7 @@ #include #include -namespace riak { +namespace riak { template class auto_buffer : private noncopyable @@ -39,9 +39,9 @@ class auto_buffer : private noncopyable explicit auto_buffer(size_type size) : buffer_((space < size) ? (T*)malloc(size*sizeof(T)) : &internal_[0]), size_((buffer_ != 0) ? size : 0) {} - ~auto_buffer() + ~auto_buffer() { - if (space < size_) + if (space < size_) { assert(buffer_ != 0); assert(&internal_[0] != buffer_); @@ -58,7 +58,7 @@ class auto_buffer : private noncopyable const_pointer data() const { return buffer_; } size_type size() const { return size_; } bool empty() const { return size_ == 0; } -private: +private: value_type* buffer_; size_type size_; value_type internal_[SIZE]; diff --git a/src/cxx/riak_object.cpp b/src/cxx/riak_object.cpp index f093240..69177ea 100644 --- a/src/cxx/riak_object.cpp +++ b/src/cxx/riak_object.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,16 +22,16 @@ namespace riak { -riak_metadata::riak_metadata() +riak_metadata::riak_metadata() { } riak_metadata::riak_metadata(const string_map& usermeta) - : usermeta_(usermeta) + : usermeta_(usermeta) { } -void riak_metadata::debug_print() const +void riak_metadata::debug_print() const { std::cout << "content type: " << content_type() << std::endl; std::cout << "charset : " << charset() << std::endl; diff --git a/src/cxx/url.cpp b/src/cxx/url.cpp index 39faca8..0ea6d14 100644 --- a/src/cxx/url.cpp +++ b/src/cxx/url.cpp @@ -6,7 +6,7 @@ using namespace std; -namespace riak { +namespace riak { url::url(const string& url_str) { @@ -37,7 +37,7 @@ void url::parse(const string& url_s) ptr_fun(tolower)); port_.assign(++port_i, path_i); } - else + else { host_.reserve(distance(prot_i, path_i)); transform(prot_i, path_i, diff --git a/src/riakc/riakc.cpp b/src/riakc/riakc.cpp index b4717e3..56e61f9 100644 --- a/src/riakc/riakc.cpp +++ b/src/riakc/riakc.cpp @@ -50,7 +50,7 @@ void get_command(riak_console& client, const riak::string_vector& tokens) cout << endl; if (result->not_found()) cout << "not found." << endl; - else + else { cout << endl; result->choose_sibling(0)->debug_print(); @@ -69,7 +69,7 @@ void put_command(riak_console& client, const riak::string_vector& tokens) ifstream input_file(arg.c_str(),ios::binary); if (!input_file.is_open()) value = arg; - else + else { stringstream buffer; buffer << input_file.rdbuf(); @@ -83,7 +83,7 @@ void put_command(riak_console& client, const riak::string_vector& tokens) { o = riak::make_object(client.context().bucket, key, value); } - else + else { o = result->choose_sibling(0); o->update_value(value); @@ -116,7 +116,7 @@ void list_command(riak_console& client, const riak::string_vector& tokens) cout << "---------------" << endl; cout << buckets.size() << " buckets found\n" << endl; } - else + else { riak::string_vector keys = client.client()->list_keys(client.context().bucket); cout << endl; @@ -129,7 +129,7 @@ void list_command(riak_console& client, const riak::string_vector& tokens) cout << *it << endl; } cout << "---------------" << endl; - cout << keys.size() << " keys found\n" << endl; + cout << keys.size() << " keys found\n" << endl; } } @@ -195,11 +195,11 @@ void print_help() cout << "get,set,server-info,help" << endl; } -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { string command; string urlstr = DEFAULT_URL; - if (argc == 1) + if (argc == 1) { command = "help"; } @@ -214,7 +214,7 @@ int main(int argc, char *argv[]) } if (command == "console") { -#ifdef HAS_READLINE +#ifdef HAS_READLINE riak_console console(urlstr, make_client(urlstr)); return console.run(); #else @@ -224,6 +224,6 @@ int main(int argc, char *argv[]) riak::client_ptr client(make_client(urlstr)); if (command == "server-info") print_server_info(client); - if (command == "get") + if (command == "get") do_get(client); } diff --git a/src/riakc/riakc_console.hpp b/src/riakc/riakc_console.hpp index 5cb4a1f..1ac107c 100644 --- a/src/riakc/riakc_console.hpp +++ b/src/riakc/riakc_console.hpp @@ -30,7 +30,7 @@ struct path_context struct command : public element { - command(const string& a1, func a2) + command(const string& a1, func a2) : element(a1, a2) { } operator string() const { return first; } void operator()(const riak::string_vector& tokens); @@ -72,7 +72,7 @@ class riak_console void info(const riak::string_vector& args) { - + //info_command(*this, args); } @@ -87,7 +87,7 @@ class riak_console { set_context("", ""); return; - } + } if (context_.bucket.empty()) context_.bucket = args[1]; else @@ -111,7 +111,7 @@ class riak_console { // put_command(*this, args); } - + template void add_command(const std::string& name, F f) @@ -153,7 +153,7 @@ class riak_console context_.object = o; } - int stop() + int stop() { cout << "exiting." << endl; done_ = true; @@ -163,20 +163,20 @@ class riak_console const std::string& prompt() { prompt_ = "<" + urlstr_ + "/" + context_.bucket; - if (!context_.key.empty()) + if (!context_.key.empty()) prompt_ += "/" + context_.key; prompt_ += "> "; return prompt_; } - - int run_once() + + int run_once() { reader_.GetLine(prompt(), tokens_, eoi_); if (eoi_) return stop(); if (tokens_.empty()) { return 0; } if (*tokens_.begin() == "exit") { return stop(); } command_ = find_if(commands_.begin(), commands_.end(), lookup(tokens_)); - if (command_ == commands_.end()) + if (command_ == commands_.end()) { cout << "Unknown command. Type 'help' for a list of commands" << endl; return 0; @@ -185,7 +185,7 @@ class riak_console return 0; } - int run() + int run() { cout << "riakc version 1.0" << endl; cout << "Type 'help' for more information, Ctrl+D to exit." << endl; @@ -212,4 +212,4 @@ class riak_console }; -#endif +#endif diff --git a/src/string_list.cpp b/src/string_list.cpp index 90c5eba..2a56488 100644 --- a/src/string_list.cpp +++ b/src/string_list.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/test_basic.cpp b/test/test_basic.cpp index 94dc8a7..b9755fe 100644 --- a/test/test_basic.cpp +++ b/test/test_basic.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -62,14 +62,14 @@ BOOST_AUTO_TEST_CASE (test_put) sp.w(3).dw(3).return_body(true); riak::result_ptr fetch_result = c->fetch(TEST_BUCKET, TEST_KEY, 2); riak::object_ptr o; - if (fetch_result->not_found()) - { + if (fetch_result->not_found()) + { o = riak::make_object(TEST_BUCKET, TEST_KEY, TEST_KEY); riak::link_vector v = o->update_content().links(); v.push_back(riak::link("foo", "bar", "baz")); o->update_content().links(v); } - else + else o = fetch_result->choose_sibling(0); riak::string_map usermeta(o->update_metadata().usermeta()); usermeta["foo"] = "bar"; diff --git a/test/test_bucket.cpp b/test/test_bucket.cpp index 6bf9bd4..8981eb3 100644 --- a/test/test_bucket.cpp +++ b/test/test_bucket.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,7 @@ -bool test_bucket() +bool test_bucket() { riak::client client("127.0.0.1", "8087"); std::string bucket_name("mybucket"); diff --git a/test/test_common.hpp b/test/test_common.hpp index f5208ab..57f0f3d 100644 --- a/test/test_common.hpp +++ b/test/test_common.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2011 Basho Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,9 +20,9 @@ #include #include -struct TEST_INIT +struct TEST_INIT { - TEST_INIT(const char *test_name, const char *file, int line) + TEST_INIT(const char *test_name, const char *file, int line) { printf("[%s:%s:%d]\n", test_name, file, line); } diff --git a/test/test_server.cpp b/test/test_server.cpp index 1a0adfc..c92da5a 100644 --- a/test/test_server.cpp +++ b/test/test_server.cpp @@ -16,7 +16,7 @@ struct test_object RpbPutReq obj; }; -struct test_bucket +struct test_bucket { std::string name; bool allow_mult; @@ -24,11 +24,11 @@ struct test_bucket std::map objects; }; -class test_server +class test_server { public: test_server() - : sock_(), client_id_(0) {} + : sock_(), client_id_(0) {} template void receive_request(Operation& op) @@ -50,7 +50,7 @@ class test_server r::pbc_storage storage(op.response().size()+pbc::pbc_header::HEADER_SIZE); op.response().serialize(storage); std::size_t n = boost::asio::write(*sock_, boost::asio::buffer(storage.data(), storage.size()), - boost::asio::transfer_all(), error_); + boost::asio::transfer_all(), error_); } template @@ -62,13 +62,13 @@ class test_server handle_operation(op); send_response(op); maybe_throw(); - return r::riak_error(); + return r::riak_error(); } void recv_header() { error_.clear(); - size_t length = boost::asio::read(*sock_, boost::asio::buffer(header_buf_), + size_t length = boost::asio::read(*sock_, boost::asio::buffer(header_buf_), boost::asio::transfer_all(), error_); if (error_) return; @@ -81,14 +81,14 @@ class test_server throw r::exception(r::riak_error(error_.value(), error_.message())); } - void start(socket_ptr sock) + void start(socket_ptr sock) { sock_ = sock; while (true) { recv_header(); maybe_throw(); - switch (header_.code()) + switch (header_.code()) { case pbc::PING: handle_request(); @@ -103,13 +103,13 @@ class test_server handle_request(); break; case pbc::SET_BUCKET: - handle_request(); - break; + handle_request(); + break; case pbc::LIST_BUCKETS: handle_request(); - break; + break; case pbc::LIST_KEYS: - handle_request(); + handle_request(); break; case pbc::PUT: handle_request(); @@ -181,7 +181,7 @@ void test_server::handle_operation(pbc::ops::list_bucket { for (std::map::iterator it=data_.begin(); it != data_.end(); - ++it) + ++it) op.response().add_buckets(it->first); } @@ -189,11 +189,11 @@ template <> void test_server::handle_operation(pbc::ops::list_keys& op) { std::map::iterator it = data_.find(op.request().bucket()); - if (it != data_.end()) + if (it != data_.end()) { for (std::map::iterator it2=it->second.objects.begin(); it2 != it->second.objects.end(); - ++it2) + ++it2) { std::string key(it2->first); op.response().add_keys(key); @@ -256,8 +256,8 @@ void server_loop(short port) { socket_ptr sock(new tcp::socket(io_service)); a.accept(*sock); - try - { + try + { server.start(sock); } catch (...) { }