aerospike 1.0.12 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,9 +14,6 @@
14
14
  # License for the specific language governing permissions and limitations under
15
15
  # the License.
16
16
 
17
- require 'msgpack'
18
-
19
- require 'aerospike/utils/pool'
20
17
 
21
18
  require 'aerospike/aerospike_exception'
22
19
 
@@ -27,19 +24,6 @@ module Aerospike
27
24
  # Polymorphic value classes used to efficiently serialize objects into the wire protocol.
28
25
  class Value #:nodoc:
29
26
 
30
- @@packer_pool = Pool.new
31
- @@packer_pool.create_block = Proc.new { MessagePack::Packer.new }
32
-
33
- def self.get_packer
34
- res = @@packer_pool.poll
35
- res.clear
36
- res
37
- end
38
-
39
- def self.put_packer(packer)
40
- @@packer_pool.offer(packer)
41
- end
42
-
43
27
  def self.of(value)
44
28
  case value
45
29
  when nil
@@ -230,7 +214,9 @@ module Aerospike
230
214
  end
231
215
 
232
216
  def to_bytes
233
- [@value].pack('Q<')
217
+ # Convert integer to big endian unsigned 64 bits.
218
+ # @see http://ruby-doc.org/core-2.3.0/Array.html#method-i-pack
219
+ [@value].pack('Q>')
234
220
  end
235
221
 
236
222
  def to_s
@@ -288,11 +274,10 @@ module Aerospike
288
274
 
289
275
  def initialize(list)
290
276
  @list = list || nil
291
- packer = Value.get_packer
292
- pack(packer)
293
- @bytes = packer.to_s.force_encoding('binary')
294
- Value.put_packer(packer)
295
-
277
+ Packer.use do |packer|
278
+ pack(packer)
279
+ @bytes = packer.bytes
280
+ end
296
281
  self
297
282
  end
298
283
 
@@ -339,10 +324,10 @@ module Aerospike
339
324
  def initialize(vmap)
340
325
  @vmap = vmap || {}
341
326
 
342
- packer = Value.get_packer
343
- pack(packer)
344
- @bytes = packer.to_s.force_encoding('binary')
345
- Value.put_packer(packer)
327
+ Packer.use do |packer|
328
+ pack(packer)
329
+ @bytes = packer.bytes
330
+ end
346
331
 
347
332
  self
348
333
  end
@@ -440,29 +425,6 @@ module Aerospike
440
425
 
441
426
  protected
442
427
 
443
- def self.normalize_elem(elem) # :nodoc:
444
- case elem
445
- when String
446
- elem[1..-1].encode(Aerospike.encoding)
447
- when Array
448
- normalize_strings_in_array(elem)
449
- when Hash
450
- normalize_strings_in_map(elem)
451
- else
452
- elem
453
- end
454
- end
455
-
456
- def self.normalize_strings_in_array(arr) # :nodoc:
457
- arr.map! { |elem| normalize_elem(elem) }
458
- end
459
-
460
- def self.normalize_strings_in_map(hash) # :nodoc:
461
- hash.inject({}) do |h, (k,v)|
462
- h.update({ normalize_elem(k) => normalize_elem(v) })
463
- end
464
- end
465
-
466
428
  def self.bytes_to_particle(type, buf, offset, length) # :nodoc:
467
429
 
468
430
  case type
@@ -480,10 +442,16 @@ module Aerospike
480
442
  buf.read(offset,length)
481
443
 
482
444
  when Aerospike::ParticleType::LIST
483
- normalize_strings_in_array(MessagePack.unpack(buf.read(offset, length)))
445
+ Unpacker.use do |unpacker|
446
+ data = buf.read(offset, length)
447
+ unpacker.unpack(data)
448
+ end
484
449
 
485
450
  when Aerospike::ParticleType::MAP
486
- normalize_strings_in_map(MessagePack.unpack(buf.read(offset, length)))
451
+ Unpacker.use do |unpacker|
452
+ data = buf.read(offset, length)
453
+ unpacker.unpack(data)
454
+ end
487
455
 
488
456
  when Aerospike::ParticleType::GEOJSON
489
457
  # ignore the flags for now
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Aerospike
3
- VERSION = "1.0.12"
3
+ VERSION = "2.0.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aerospike
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Khosrow Afroozeh
8
+ - Jan Hecking
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-02-11 00:00:00.000000000 Z
12
+ date: 2016-05-27 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: msgpack
@@ -16,14 +17,14 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '0.5'
20
+ version: '0.7'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '0.5'
27
+ version: '0.7'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: bcrypt
29
30
  requirement: !ruby/object:Gem::Requirement
@@ -42,6 +43,7 @@ description: Official Aerospike Client for ruby. Access your Aerospike cluster w
42
43
  ease of Ruby.
43
44
  email:
44
45
  - khosrow@aerospike.com
46
+ - jhecking@aerospike.com
45
47
  executables: []
46
48
  extensions: []
47
49
  extra_rdoc_files: []
@@ -53,6 +55,12 @@ files:
53
55
  - lib/aerospike/aerospike_exception.rb
54
56
  - lib/aerospike/atomic/atomic.rb
55
57
  - lib/aerospike/bin.rb
58
+ - lib/aerospike/cdt/list_operation.rb
59
+ - lib/aerospike/cdt/map_operation.rb
60
+ - lib/aerospike/cdt/map_order.rb
61
+ - lib/aerospike/cdt/map_policy.rb
62
+ - lib/aerospike/cdt/map_return_type.rb
63
+ - lib/aerospike/cdt/map_write_mode.rb
56
64
  - lib/aerospike/client.rb
57
65
  - lib/aerospike/cluster/cluster.rb
58
66
  - lib/aerospike/cluster/connection.rb
@@ -121,13 +129,15 @@ files:
121
129
  - lib/aerospike/user_role.rb
122
130
  - lib/aerospike/utils/buffer.rb
123
131
  - lib/aerospike/utils/epoc.rb
132
+ - lib/aerospike/utils/packer.rb
124
133
  - lib/aerospike/utils/pool.rb
134
+ - lib/aerospike/utils/unpacker.rb
125
135
  - lib/aerospike/value/particle_type.rb
126
136
  - lib/aerospike/value/value.rb
127
137
  - lib/aerospike/version.rb
128
138
  homepage: http://www.github.com/aerospike/aerospike-client-ruby
129
139
  licenses:
130
- - Apache2.0
140
+ - Apache-2.0
131
141
  metadata: {}
132
142
  post_install_message: |-
133
143
  Thank you for using Aerospike!
@@ -139,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
149
  requirements:
140
150
  - - ">="
141
151
  - !ruby/object:Gem::Version
142
- version: 1.9.3
152
+ version: 2.0.0
143
153
  required_rubygems_version: !ruby/object:Gem::Requirement
144
154
  requirements:
145
155
  - - ">="
@@ -147,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
157
  version: '0'
148
158
  requirements: []
149
159
  rubyforge_project:
150
- rubygems_version: 2.4.6
160
+ rubygems_version: 2.5.1
151
161
  signing_key:
152
162
  specification_version: 4
153
163
  summary: An Aerospike driver for Ruby.