Reduce probability name conflict: use "cb_" prefix

Change-Id: I312624b031fbfdb5b2d308b167c2cad3f13373a4
Reviewed-on: http://review.couchbase.org/22804
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Fix function prefixes

Change-Id: Idbddab7aea9a9ebb17c272518eaf4e4b2ddeb176
Reviewed-on: http://review.couchbase.org/22805
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Make error message about dependency more verbose

$ bundle exec rake compile
/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
(in /home/avsej/code/couchbase-sdk/ruby/client)
cd tmp/x86_64-linux/couchbase_ext/1.9.3
/usr/bin/ruby1.9.1 -I. ../../../../ext/couchbase_ext/extconf.rb
checking for lcb_verify_compiler_setup() in -lcouchbase... no

**********************************************************************
You must install libcouchbase >= 2.0.0beta3. See http://www.couchbase.com/develop/ for more details
**********************************************************************

*** ../../../../ext/couchbase_ext/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=../../../../ext/couchbase_ext
        --curdir
        --ruby=/usr/bin/ruby1.9.1
        --with-libcouchbase-dir
        --without-libcouchbase-dir
        --with-libcouchbase-include
        --without-libcouchbase-include=${libcouchbase-dir}/include
        --with-libcouchbase-lib
        --without-libcouchbase-lib=${libcouchbase-dir}/lib
        --with-couchbaselib
        --without-couchbaselib
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.9.1 -I. ../../../../ext/cou...]

(See full trace by running task with --trace)

Change-Id: I51f79f99fc7f5f18a1aa0f4b62af40985eaab32a
Reviewed-on: http://review.couchbase.org/22839
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Allow to setup default initial value for INCR/DECR

Now it is possible to make arithmetic ops less verbose

  conn = Couchbase.connect(:default_arithmetic_init => 1)
  conn.incr("missing_key")  #=> 1

Change-Id: I5e78f8b7fb17e357e7a70f9e13f0e2207516acd2
Reviewed-on: http://review.couchbase.org/22812
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Fix memory leaks: in async mode context wasn't freed

Change-Id: I2ff46be077117e2a6968f3727081fd5b4e2085d6
Reviewed-on: http://review.couchbase.org/22821
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
RCBC-95 Use response body to clarify Couchbase::Error::HTTP

Change-Id: Ic89eedff93c3677a728f35fc09b6d216606c0123
Reviewed-on: http://review.couchbase.org/22894
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Bump version 1.2.0.z.beta5

Change-Id: I7061160d1c27f44d08c3ae81c855234341a9e770
Reviewed-on: http://review.couchbase.org/22901
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Avoid using ruby memory allocators in extension code

Ruby doesn't expose analog for strdup(3), so the easiest solution will be to
use libc versions of allocators everywhere, because libcouchbase itself
doesn't provide means to override allocators and memory footprint in the
extension code is small enough to avoid checking GC each time

Change-Id: I866c35ac242397d47c84e75e6f41543dce983c30
Reviewed-on: http://review.couchbase.org/22941
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Use 'while true' instead of 'loop' for better performance

Change-Id: I2f89787c2210876dbd6cc94906e33135f4495446
Reviewed-on: http://review.couchbase.org/22938
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Юрий Соколов <funny.falcon@gmail.com>
Reviewed-by: Andrey Koleshko <ka8725@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Fix memory leak in authority getter

Change-Id: Ice74f8cc88b1e10c656ec8c107e7f002c39c668a
Reviewed-on: http://review.couchbase.org/22943
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Remove debugger development dependency

* Not all ruby versions support debugger (ruby-debug) library
* Conditional dependencies in .gemspec file isn't good idea
* There are other ways to load debugger (skip bundler, use ruby -r, etc)

Change-Id: Iecb45638c24b701931e74d9743221d526e832b83
Reviewed-on: http://review.couchbase.org/22968
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
RCBC-97 Store bucket->{hostname,authority} as Ruby String

Change-Id: Iecf4d0ede305b835c3add661c615108334ac4f6b
Reviewed-on: http://review.couchbase.org/23038
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sokolov Yura <funny.falcon@gmail.com>
RCBC-97 Store bucket->bucket in Ruby String

Change-Id: I32b141a0db98f8c71d93937079ca7868ace60714
Reviewed-on: http://review.couchbase.org/23039
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sokolov Yura <funny.falcon@gmail.com>
RCBC-97 Store bucket->pool in Ruby String

Change-Id: I041d1a6c92e7236f0563acbfb608d7ccdced42ad
Reviewed-on: http://review.couchbase.org/23040
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sokolov Yura <funny.falcon@gmail.com>
RCBC-97 Store bucket->{username,password} as Ruby String

Change-Id: Ia7a2d50946746e12f4288dcd78d1d2f49eb46c94
Reviewed-on: http://review.couchbase.org/23041
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sokolov Yura <funny.falcon@gmail.com>
RCBC-97 Store bucket->node_list as Ruby String

Change-Id: I10a2e2c828b8547f8e10d1c5608f503a07ba68d6
Reviewed-on: http://review.couchbase.org/23045
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sokolov Yura <funny.falcon@gmail.com>
RCBC-97 Remove unused bucket->key_prefix, use always bucket->key_prefix_val

Also make bucket->key_prefix frozen and clean it by setting to nil.

Change-Id: Icdf4b470d2a083551412f3982c03cb5f970e5848
Reviewed-on: http://review.couchbase.org/23042
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sokolov Yura <funny.falcon@gmail.com>
RCBC-98 Internalize empty string and "default"

Change-Id: Ia9887bc6e6b4607d8f9c002d8ebb19df6a9986b8
Reviewed-on: http://review.couchbase.org/23043
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sokolov Yura <funny.falcon@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
use rb_str_append when possible

Change-Id: I64ca4986f38e92ae60f7aa6efafb9fc0f9202004
Reviewed-on: http://review.couchbase.org/23044
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sokolov Yura <funny.falcon@gmail.com>
fix assignment for cmd.get.items_gr

Change-Id: Ida4fa762ea6ca99aa4b87717e598e5cb1e11f228
Reviewed-on: http://review.couchbase.org/23046
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sokolov Yura <funny.falcon@gmail.com>