couchbase 1.2.0.z.beta5 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,5 +17,5 @@
17
17
 
18
18
  # Couchbase ruby client
19
19
  module Couchbase
20
- VERSION = "1.2.0.z.beta5"
20
+ VERSION = "1.2.0"
21
21
  end
@@ -44,7 +44,11 @@ module Couchbase
44
44
  end
45
45
 
46
46
  def to_s
47
- super.sub(/ \(/, ": #{@type}: #{@reason} (")
47
+ str = super
48
+ if @type || @reason
49
+ str.sub(/ \(/, ": #{[@type, @reason].compact.join(": ")} (")
50
+ end
51
+ str
48
52
  end
49
53
  end
50
54
  end
@@ -312,7 +316,7 @@ module Couchbase
312
316
  # run event loop until the terminating chunk will be found
313
317
  # last_res variable keeps latest known chunk of the result
314
318
  last_res = nil
315
- loop do
319
+ while true
316
320
  # feed response received chunks to the parser
317
321
  while r = res.shift
318
322
  if r.error
@@ -38,6 +38,9 @@ if multi_json_engine.name =~ /JsonGem$/
38
38
  class << multi_json_engine
39
39
  alias _load_object load
40
40
  def load(string, options = {})
41
+ if string.is_a?(StringIO)
42
+ string = string.read
43
+ end
41
44
  if string =~ /\A\s*[{\[]/
42
45
  _load_object(string, options)
43
46
  else
@@ -33,16 +33,19 @@ module Rack
33
33
  #
34
34
  # require 'rack/session/couchbase'
35
35
  # use Rack::Session::Couchbase, :expire_after => 5.minutes,
36
- # :couchbase => {:bucket => "sessions", :default_format => :marshal}
36
+ # :couchbase => {:bucket => "sessions", :default_format => :document}
37
37
  #
38
- # By default sessions will be serialized to JSON, to allow analyse them
39
- # using Map/Reduce.
38
+ # By default sessions will be serialized using Marshal class. But
39
+ # you can store them as JSON (+:default_format => :document+), to
40
+ # allow analyse them using Map/Reduce. In this case you should
41
+ # care about serialization of all custom objects like
42
+ # ActionDispatch::Flash::FlashHash
40
43
  #
41
44
  class Couchbase < Abstract::ID
42
45
  attr_reader :mutex, :pool
43
46
 
44
47
  DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge(
45
- :couchbase => {:quiet => true, :default_format => :document,
48
+ :couchbase => {:quiet => true, :default_format => :marshal,
46
49
  :key_prefix => 'rack:session:'})
47
50
 
48
51
  def initialize(app, options = {})
@@ -58,7 +61,7 @@ module Rack
58
61
  end
59
62
 
60
63
  def generate_sid
61
- loop do
64
+ while true
62
65
  sid = super
63
66
  break sid unless @pool.get(sid)
64
67
  end
data/tasks/compile.rake CHANGED
@@ -84,7 +84,7 @@ namespace :ports do
84
84
  directory "ports"
85
85
 
86
86
  task :libcouchbase => ["ports"] do
87
- recipe = MiniPortile.new "libcouchbase", "2.0.0"
87
+ recipe = MiniPortile.new "libcouchbase", "2.0.1"
88
88
  recipe.files << "http://packages.couchbase.com/clients/c/libcouchbase-#{recipe.version}.tar.gz"
89
89
  recipe.configure_options.push("--disable-debug",
90
90
  "--disable-dependency-tracking",
data/tasks/test.rake CHANGED
@@ -41,7 +41,6 @@ end
41
41
 
42
42
  Rake::TestTask.new do |test|
43
43
  test.libs << "test" << "."
44
- test.ruby_opts << "-rruby-debug" if ENV['DEBUG']
45
44
  test.pattern = 'test/test_*.rb'
46
45
  test.options = '--verbose'
47
46
  end
data/tasks/util.rake CHANGED
@@ -17,5 +17,5 @@
17
17
 
18
18
  desc 'Start an irb session and load the library.'
19
19
  task :console => :compile do
20
- exec "irb -I lib -r#{RUBY_VERSION =~ /^1\.9/ ? 'debugger' : 'ruby-debug'} -rcouchbase"
20
+ exec "irb -I lib -rcouchbase"
21
21
  end
data/test/setup.rb CHANGED
@@ -55,7 +55,7 @@ class CouchbaseServer
55
55
  rescue Couchbase::Error::NotSupported
56
56
  # on recent server flush is disabled
57
57
  end
58
- end
58
+ end if ENV['COUCHBASE_FLUSH_BUCKETS']
59
59
  end
60
60
  def stop; end
61
61
  end
@@ -166,7 +166,10 @@ class MiniTest::Unit::TestCase
166
166
  end
167
167
 
168
168
  def uniq_id(*suffixes)
169
- [caller.first[/.*[` ](.*)'/, 1], suffixes].join("_")
169
+ test_id = [caller.first[/.*[` ](.*)'/, 1], suffixes].compact.join("_")
170
+ @ids ||= {}
171
+ @ids[test_id] ||= Time.now.to_f
172
+ [test_id, @ids[test_id]].join("_")
170
173
  end
171
174
 
172
175
  def after_teardown
data/test/test_async.rb CHANGED
@@ -124,7 +124,7 @@ class TestAsync < MiniTest::Unit::TestCase
124
124
  connection.run do |conn|
125
125
  conn.delete(uniq_id, :cas => cas) do |res1|
126
126
  success = res1.success?
127
- conn.get(uniq_id) do |res2|
127
+ conn.get(uniq_id, :quiet => true) do |res2|
128
128
  val = res2.value
129
129
  end
130
130
  end
@@ -161,7 +161,7 @@ class TestAsync < MiniTest::Unit::TestCase
161
161
 
162
162
  connection.run do |conn|
163
163
  conn.flush do |res1|
164
- assert res1.success?
164
+ assert res1.success?, "Expected: successful status code.\nActual: #{res1.error.inspect}"
165
165
  id = uniq_id(res1.node)
166
166
  res[id] = false
167
167
  conn.set(id, true) do |res2|
metadata CHANGED
@@ -1,16 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchbase
3
3
  version: !ruby/object:Gem::Version
4
- hash: -6450534404
5
- prerelease: 6
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
9
  - 0
10
- - z
11
- - beta
12
- - 5
13
- version: 1.2.0.z.beta5
10
+ version: 1.2.0
14
11
  platform: ruby
15
12
  authors:
16
13
  - Couchbase
@@ -18,7 +15,7 @@ autorequire:
18
15
  bindir: bin
19
16
  cert_chain: []
20
17
 
21
- date: 2012-11-29 00:00:00 +03:00
18
+ date: 2012-12-12 00:00:00 +03:00
22
19
  default_executable:
23
20
  dependencies:
24
21
  - !ruby/object:Gem::Dependency
@@ -181,22 +178,8 @@ dependencies:
181
178
  segments:
182
179
  - 0
183
180
  version: "0"
184
- name: ruby-debug
185
- version_requirements: *id011
186
- prerelease: false
187
- - !ruby/object:Gem::Dependency
188
- type: :development
189
- requirement: &id012 !ruby/object:Gem::Requirement
190
- none: false
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- hash: 3
195
- segments:
196
- - 0
197
- version: "0"
198
181
  name: active_support
199
- version_requirements: *id012
182
+ version_requirements: *id011
200
183
  prerelease: false
201
184
  description: The official client library for use with Couchbase Server.
202
185
  email: support@couchbase.com
@@ -211,10 +194,10 @@ files:
211
194
  - .travis.yml
212
195
  - .yardopts
213
196
  - Gemfile
214
- - HISTORY.markdown
215
197
  - LICENSE
216
198
  - Makefile
217
199
  - README.markdown
200
+ - RELEASE_NOTES.markdown
218
201
  - Rakefile
219
202
  - couchbase.gemspec
220
203
  - ext/couchbase_ext/.gitignore
@@ -228,6 +211,7 @@ files:
228
211
  - ext/couchbase_ext/get.c
229
212
  - ext/couchbase_ext/gethrtime.c
230
213
  - ext/couchbase_ext/http.c
214
+ - ext/couchbase_ext/multithread_plugin.c
231
215
  - ext/couchbase_ext/observe.c
232
216
  - ext/couchbase_ext/result.c
233
217
  - ext/couchbase_ext/stats.c
@@ -296,14 +280,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
296
280
  required_rubygems_version: !ruby/object:Gem::Requirement
297
281
  none: false
298
282
  requirements:
299
- - - ">"
283
+ - - ">="
300
284
  - !ruby/object:Gem::Version
301
- hash: 25
285
+ hash: 3
302
286
  segments:
303
- - 1
304
- - 3
305
- - 1
306
- version: 1.3.1
287
+ - 0
288
+ version: "0"
307
289
  requirements: []
308
290
 
309
291
  rubyforge_project:
data/HISTORY.markdown DELETED
@@ -1,268 +0,0 @@
1
- ## 1.2.0.z.beta5 / 2012-11-29
2
-
3
- * Reduce probability name conflict: use "cb_" prefix
4
- * Fix function prefixes
5
- * Make error message about dependency more verbose
6
- * Allow to setup default initial value for INCR/DECR
7
- * Fix memory leaks: in async mode context wasn't freed
8
- * RCBC-95 Use response body to clarify Couchbase::Error::HTTP
9
-
10
- ## 1.2.0.z.beta4 / 2012-11-21
11
-
12
- * Do not hide ValueFormat reason
13
- * Adjust version check for MultiJson monkeypatch
14
- * Update error codes
15
- * Remove mentions of LCB_LIBEVENT_ERROR in utils.c
16
- * Add Makefile for easier build with repo layout
17
- * Check HTTP error code when building exception object
18
- * Remove debug output in tests
19
- * Make rack session store adapter quiet
20
- * RCBC-90 Update documentation about session store
21
- * Protect against non string values in :plain mode
22
- * RCBC-89 Fetch documents using binary protocol by default
23
- * Deserialize Base64 value from view
24
- * Remove all_docs mentions
25
- * RCBC-92 Use more portable version of rb_sprintf()
26
- * Do not expose docs embedded in HTTP response
27
- * RCBC-94 Reset global exception after usage
28
- * Fix number of arguments to Kernel#sprintf
29
- * Increase default connection timeout
30
-
31
- ## 1.2.0.z.beta3 / 2012-10-12
32
-
33
- * Update view API
34
- * Mention couchbase-model and em-couchbase in README
35
- * Use global scope to find Error classes (thanks to @wr0ngway)
36
- * RCBC-87 Fix build error on macos
37
- * Use lcb_breakout()
38
- * Propogate status code for HTTP responses
39
- * Extract params encoding for easier reusage
40
- * Destory IO operations struct (fix memleak)
41
- * Don't try to convert error to number, it is exception object
42
- * Update error codes
43
- * Implement bucket create/delete operations
44
- * Fixup FLUSH tests
45
-
46
- ## 1.2.0.z.beta2 / 2012-09-19
47
-
48
- * RCBC-82 Fix extconf.rb for RVM/MacOS. (Not all rubies are fat on MacOS)
49
-
50
- ## 1.2.0.z.beta / 2012-09-18
51
-
52
- * Fix version ordering by using ".z" prefix before .beta
53
-
54
- ## 1.2.0.beta / 2012-09-18
55
-
56
- * RCBC-70 return binary keys using Encoding.external value (thanks to Alex Leverington)
57
- * Create new key object only if it is necessary
58
- * Switch to rbenv because RVM doesn't work with tclsh
59
- * [backport] RCBC-37 Bootstrapping using multiple nodes
60
- * React on HTTP level errors in view request
61
- * Fix typo: check for MultiJson.decode
62
- * Use unified HTTP function from the latest libcouchbase
63
- * Expose HTTP headers
64
- * Update views to meet latest server changes
65
- * Add support for spatial views
66
- * Use updated libcouchbase_cancel_http_request()
67
- * Workaround query issue on group=false&reduce=false
68
- * Update windows build
69
- * Bump version 1.1.4
70
- * Refactor the C extension
71
- * Fix CAS conversion for Bucket#delete method for 32-bit systems
72
- * RCBC-28 Implement Bucket#unlock
73
- * CCBC-98 Expose client temporary failure error
74
- * Fix warnings in doc generator and specify return values
75
- * Fix -Wreturn-type warning
76
- * Add attribute reader for Error::Base status code
77
- * Unset RUBYOPT to avoid issues with bundler
78
- * Ignore shared object on macos
79
- * RCBC-79 Use RESTful flush
80
- * Fix build under bundler on MacOS
81
- * RCBC-81 Protect against NoMethodError
82
- * Fixup MAKEFILE_CONFIG which is copy of the CONFIG
83
- * RCBC-81 Protect against NoMethodError
84
- * Update windows build
85
-
86
- ## 1.2.0.dp6 / 2012-07-28
87
-
88
- * Inherit StandardError instead RuntimeError for errors
89
- * Use renamed functions for view requests
90
- * Depend on yard-xml plugin to dump docs into single XML
91
- * No need to check for NULL before deallocating memory
92
- * RCBC-37 Bootstrapping using multiple nodes
93
- * More docs and examples on views (fixes RCBC-43)
94
- * RCBC-40 Fix Bucket#cas operation behaviour in async mode
95
- * RCBC-39 Allow to specify delta for incr/decr in options
96
- * Update README
97
- * Apply timeout value before connection
98
- * Clarify connection exceptions
99
- * Remove seqno kludge
100
- * rb_hash_delete() function could incorrectly detect block presence
101
- * Add example with in-URL credentials
102
- * RCBC-57 Expose timers API from libcouchbase
103
- * RCBC-50 Allow to read keys from replica
104
- * RCBC-6 Implement OBSERVE command
105
- * Expose number of replicas to the user
106
- * Notify about observe batch finish in async mode
107
- * Separate memory errors for client and server
108
- * Prefix error message from views with "SERVER: "
109
- * Remove timeout hack
110
- * RCBC-49 Bucket#observe_and_wait primitive
111
- * RCBC-47 Allow to skip username for protected buckets
112
- * Use allocators instead of singleton methods
113
- * Check RDATA()->dfree to ensure object type
114
- * Fix observe_and_wait in async mode
115
- * Fill 'operation' in observe_and_wait Result object
116
- * Fix extraction Hash with keys in observe_and_wait
117
- * RCBC-49 :observe option for storage functions
118
- * Fix timeout test
119
- * Mention couchbase.com in install errors
120
- * Make Bucket#observe_and_wait more 1.8.7 friendly
121
-
122
- ## 1.2.0.dp5 / 2012-06-15
123
-
124
- * Allow to force assembling result Hash for multi-get
125
- * Fix documentation for :ttl option in Bucket#cas
126
- * Implement key prefix (simple namespacing)
127
- * Implement cache store adapter for Rails
128
- * Integrate with Rack and Rails session store
129
-
130
- ## 1.2.0.dp4 / 2012-06-07
131
-
132
- * RCBC-36 Fix segfault
133
- * Comment out unpredictable test
134
- * Update replace documentation: it accepts :cas option
135
-
136
- ## 1.2.0.dp3 / 2012-06-06
137
-
138
- * Fix for multi_json < 1.3.3
139
- * Break out from event loop for non-chunked responses (fix creating
140
- design create)
141
-
142
- ## 1.2.0.dp2 / 2012-06-05
143
-
144
- * RCBC-31 Make Bucket#get more consistent
145
- * Use monotonic high resolution clock
146
- * Implement threshold for outgoing commands
147
- * Allow to stop event loop from ruby
148
- * RCBC-35 Fix the params escaping
149
- * RCBC-34 Use multi_json gem
150
- * Allow to block and wait for part of the requests
151
- * Fix view iterator. It doesn't lock event loop anymore
152
- * Specify HTTP method when body is set for View request
153
- * Define views only if "views" key presented
154
- * Use plain structs instead of typedefs
155
- * Use debugger gem for 1.9.x rubies
156
- * Use latest stable build of libcouchbase for travis-ci
157
- * Require yajl as development dependency
158
- * Implement get with lock operation
159
- * Update docs
160
-
161
- ## 1.2.0.dp / 2012-04-06
162
-
163
- * Properly handle hashes as Couchbase.connection_options
164
- * Implement views
165
- * Use verbose mode by default throwing exceptions on NOT_FOUND errors.
166
- This means that quiet attribute is false now on new connections.
167
- * Doc fixes
168
-
169
- ## 1.1.4 / 2012-08-30
170
-
171
- * RCBC-70 return binary keys using Encoding.external value (thanks to Alex Leverington)
172
- * Switch to rbenv because RVM doesn't work with tclsh
173
- * [backport] RCBC-37 Bootstrapping using multiple nodes
174
-
175
- ## 1.1.3 / 2012-07-27
176
-
177
- * RCBC-59 Replicate flags in Bucket#cas operation
178
- * calloc -> xcalloc, free -> xfree
179
- * RCBC-64 Fix Couchbase::Bucket#dup
180
- * Make object_space GC protector per-bucket object
181
- * RCBC-60 Protect exceptions from GC
182
-
183
- ## 1.1.2 / 2012-06-05
184
-
185
- * Upgrade libcouchbase dependency up to 1.0.4
186
- * Backport debugger patch
187
-
188
- ## 1.1.1 / 2012-03-19
189
-
190
- * Allow to force format for get operation (thanks to Darian Shimy)
191
- * Use all arguments if receiver arity is -1 (couchbase_ext.c)
192
- * Doc fixes
193
-
194
- ## 1.1.0 / 2012-03-07
195
-
196
- * Timeout support (CCBC-20)
197
- * Implement disconnect/reconnect interface
198
- * Improve error handling code
199
- * Use URI parser from stdlib
200
- * Improve the documentation and the tests
201
- * Remove direct dependency on libevent
202
- * Remove sasl dependency
203
- * Fix storing empty line and nil
204
- * Allow running tests on real cluster
205
- * Cross-build for windows
206
- * Keep connections in thread local storage
207
- * Add block execution time to timeout
208
- * Implement VERSION command
209
- * Configure Travis-CI
210
-
211
- ## 1.0.0 / 2011-12-23
212
-
213
- * Implement all operations using libcouchbase as backend
214
- * Remove views code. It will be re-added in 1.1 version
215
-
216
- ## 0.9.8 / 2011-12-16
217
-
218
- * Fix RCBC-10: It was impossible to store data in non-default buckets
219
-
220
- ## 0.9.7 / 2011-10-04
221
-
222
- * Fix design doc removing
223
- * Fix 'set' method signature: add missing options argument
224
- * Rename gem to 'couchbase' for easy of use. The github project still
225
- is 'couchbase-ruby-client'
226
-
227
- ## 0.9.6 / 2011-10-04
228
-
229
- * Fix bug with decoding multiget result
230
- * Allow create design documents from IO and String
231
- * Rename json format to document, and describe possible formats
232
- * Allow to handle errors in view result stream
233
- * Remove dependency on libyajl library: it bundled with yaji now
234
- * Update rake tasks: create zip- and tar-balls
235
-
236
- ## 0.9.5 / 2011-08-24
237
-
238
- * Update installation notes in README
239
-
240
- ## 0.9.4 / 2011-08-24
241
-
242
- * Use streaming json parser to iterate over view results
243
- * Update memcached gem dependency to v1.3
244
- * Proxy TOUCH command to memcached client
245
- * Fix minor bugs in RestClient and Document classes
246
- * Disable CouchDB API for nodes without 'couchApiBase' key provided.
247
- * Fix bug with unicode parsing in config listener
248
- * Add more unit tests
249
-
250
- ## 0.9.3 / 2011-07-29
251
-
252
- * Use Latch (via Mutex and ConditionVariable) to wait until initial
253
- setup will be finished.
254
- * Update prefix for development views (from '$dev_' to 'dev_')
255
-
256
- ## 0.9.2 / 2011-07-29
257
-
258
- * Use zero TTL by default to store records forever
259
- * Update documentation
260
- * Sleep if setup isn't done
261
-
262
- ## 0.9.1 / 2011-07-25
263
-
264
- * Minor bugfix for RestClient initialization
265
-
266
- ## 0.9.0 / 2011-07-25
267
-
268
- * Initial public release