aerospike 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 235bd4afc86f8bf263a458a22f7e13a247bdda6c
4
- data.tar.gz: 35e141ffb29702a9cf1ea046fe731a89e2de9bb5
3
+ metadata.gz: cb0b09f9246802aab13bc29789ab3745101d110b
4
+ data.tar.gz: 374cce797743de7a035133e8b2407ade713bd6d5
5
5
  SHA512:
6
- metadata.gz: e4e54c1051e29cf790f4df58ee1822c3e20fb8120f3d2aef61c69c0da516a6389d429a99d71ad8d1df8fd05b92f18c245b9e0bd2215610ee4c527dca36ae72ed
7
- data.tar.gz: be8ec2b6d0247dc6fdec77eba9269561970a6688d0a328cfda38cb7a822c9b9047cdb6ff34a101dfcf60b10de629daf9113cebfa3095bd4b3d2c3cb20e04bfca
6
+ metadata.gz: 8a14eef40cd28d4d510c9e283e835c33529442981626e335b9c040027cdfbc97ad11d9186afdeffd3f2d4098e4a2ce33a9462672c47c7112a88919dfc95afa1a
7
+ data.tar.gz: 703bf2bdf23479a7a8a101e38aa4fc613148ab01c5c5901006e1bf4b2a1873f888a41352f0893152df2fa61e19d930ac6202cfc515dea6eb07cca0d6a0ea9ef5
@@ -1,3 +1,15 @@
1
+ v2.1.0 / 2016-07-19
2
+ ===================
3
+
4
+ * **Fixes**
5
+ * Fix a typo in the `max_retries` policy parameter name. [PR #37](https://github.com/aerospike/aerospike-client-ruby/pull/37) Thanks to [@murphyslaw](https://github.com/murphyslaw)!
6
+ * Fix license identifier in gemspec.
7
+
8
+ * **Improvements**
9
+ * Support for queries on Lists and Maps (keys & values)
10
+ * Support for creating indexes on Lists and Maps
11
+ * Support GeoJSON values in Lists and Maps
12
+
1
13
  v2.0.0 / 2016-05-27
2
14
  ===================
3
15
 
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  An Aerospike library for Ruby.
9
9
 
10
- This library is compatible with Ruby 1.9.3+ and supports Linux, Mac OS X and various other BSDs. Rubinius is supported, but not JRuby - yet.
10
+ This library is compatible with Ruby 2.0+ and supports Linux, Mac OS X and various other BSDs. Rubinius is supported, but not JRuby - yet.
11
11
 
12
12
 
13
13
  - [Usage](#Usage)
@@ -63,7 +63,7 @@ Details about the API are available in the [`docs`](docs) directory.
63
63
  <a name="Prerequisites"></a>
64
64
  ## Prerequisites
65
65
 
66
- [Ruby](https://ruby-lang.org) version v1.9.3+ is required.
66
+ [Ruby](https://ruby-lang.org) version v2.0+ is required.
67
67
 
68
68
  Aerospike Ruby client implements the wire protocol, and does not depend on the C client.
69
69
  It is thread friendly.
@@ -81,7 +81,7 @@ Supported operating systems:
81
81
 
82
82
  ## Installation from source:
83
83
 
84
- 1. Install Ruby 1.9.3+
84
+ 1. Install Ruby 2.0+
85
85
  2. Install RubyGems
86
86
  3. Install Bundler: ```gem install bundler```
87
87
  4. Install dependencies: ```bundler install```
@@ -572,11 +572,17 @@ module Aerospike
572
572
  #
573
573
  # This method is only supported by Aerospike 3 servers.
574
574
  # index_type should be :string, :numeric or :geo2dsphere (requires server version 3.7 or later)
575
- def create_index(namespace, set_name, index_name, bin_name, index_type, options={})
575
+ # collection_type should be :list, :mapkeys or :mapvalues
576
+ def create_index(namespace, set_name, index_name, bin_name, index_type, collection_type=nil, options={})
577
+ if options.nil? && collection_type.is_a?(Hash)
578
+ options, collection_type = collection_type, nil
579
+ end
576
580
  policy = create_policy(options, WritePolicy)
577
581
  str_cmd = "sindex-create:ns=#{namespace}"
578
582
  str_cmd << ";set=#{set_name}" unless set_name.to_s.strip.empty?
579
- str_cmd << ";indexname=#{index_name};numbins=1;indexdata=#{bin_name},#{index_type.to_s.upcase}"
583
+ str_cmd << ";indexname=#{index_name};numbins=1"
584
+ str_cmd << ";indextype=#{collection_type.to_s.upcase}" if collection_type
585
+ str_cmd << ";indexdata=#{bin_name},#{index_type.to_s.upcase}"
580
586
  str_cmd << ";priority=normal"
581
587
 
582
588
  # Send index command to one node. That node will distribute the command to other nodes.
@@ -33,6 +33,7 @@ module Aerospike
33
33
  INDEX_FILTER = 23
34
34
  INDEX_LIMIT = 24
35
35
  INDEX_ORDER_BY = 25
36
+ INDEX_TYPE = 26
36
37
  UDF_PACKAGE_NAME = 30
37
38
  UDF_FUNCTION = 31
38
39
  UDF_ARGLIST = 32
@@ -47,7 +47,7 @@ module Aerospike
47
47
  # A retry is attempted when there is a network error other than timeout.
48
48
  # If max_retries is exceeded, the abort will occur even if the timeout
49
49
  # has not yet been exceeded.
50
- @max_retries = opt[:max_retiries] || 2
50
+ @max_retries = opt[:max_retries] || 2
51
51
 
52
52
  # Duration to sleep between retries if a transaction fails and the
53
53
  # timeout was not exceeded. Enter zero to skip sleep.
@@ -22,28 +22,32 @@ module Aerospike
22
22
  Filter.new(bin_name, value, value)
23
23
  end
24
24
 
25
- def self.Range(bin_name, from, to)
26
- Filter.new(bin_name, from, to)
25
+ def self.Contains(bin_name, value, col_type)
26
+ Filter.new(bin_name, value, value, nil, col_type)
27
27
  end
28
28
 
29
- def self.geoWithinGeoJSONRegion(bin_name, region)
29
+ def self.Range(bin_name, from, to, col_type = nil)
30
+ Filter.new(bin_name, from, to, nil, col_type)
31
+ end
32
+
33
+ def self.geoWithinGeoJSONRegion(bin_name, region, col_type = nil)
30
34
  region = region.to_json
31
- Filter.new(bin_name, region, region, ParticleType::GEOJSON)
35
+ Filter.new(bin_name, region, region, ParticleType::GEOJSON, col_type)
32
36
  end
33
37
 
34
- def self.geoWithinRadius(bin_name, lon, lat, radius_meter)
38
+ def self.geoWithinRadius(bin_name, lon, lat, radius_meter, col_type = nil)
35
39
  region = GeoJSON.new({type: "AeroCircle", coordinates: [[lon, lat], radius_meter]})
36
- geoWithinGeoJSONRegion(bin_name, region)
40
+ geoWithinGeoJSONRegion(bin_name, region, col_type)
37
41
  end
38
42
 
39
- def self.geoContainsGeoJSONPoint(bin_name, point)
43
+ def self.geoContainsGeoJSONPoint(bin_name, point, col_type = nil)
40
44
  point = point.to_json
41
- Filter.new(bin_name, point, point, ParticleType::GEOJSON)
45
+ Filter.new(bin_name, point, point, ParticleType::GEOJSON, col_type)
42
46
  end
43
47
 
44
- def self.geoContainsPoint(bin_name, lon, lat)
48
+ def self.geoContainsPoint(bin_name, lon, lat, col_type = nil)
45
49
  point = GeoJSON.new({type: "Point", coordinates: [lon, lat]})
46
- geoContainsGeoJSONPoint(bin_name, point)
50
+ geoContainsGeoJSONPoint(bin_name, point, col_type)
47
51
  end
48
52
 
49
53
  def estimate_size
@@ -73,6 +77,17 @@ module Aerospike
73
77
  offset
74
78
  end
75
79
 
80
+ # for internal use
81
+ def collection_type
82
+ case @col_type
83
+ when :default then 0
84
+ when :list then 1
85
+ when :mapkeys then 2
86
+ when :mapvalues then 3
87
+ else 0
88
+ end
89
+ end
90
+
76
91
  #
77
92
  # Show the filter as String. This is util to show filters in logs.
78
93
  #
@@ -83,7 +98,7 @@ module Aerospike
83
98
 
84
99
  private
85
100
 
86
- def initialize(bin_name, begin_value, end_value, val_type = nil)
101
+ def initialize(bin_name, begin_value, end_value, val_type = nil, col_type = nil)
87
102
  @name = bin_name
88
103
  @begin = Aerospike::Value.of(begin_value)
89
104
  @end = Aerospike::Value.of(end_value)
@@ -91,6 +106,7 @@ module Aerospike
91
106
  # The type of the filter values can usually be inferred automatically;
92
107
  # but in certain cases caller can override the type.
93
108
  @val_type = val_type || @begin.type
109
+ @col_type = col_type
94
110
  end
95
111
 
96
112
  end # class
@@ -54,6 +54,12 @@ module Aerospike
54
54
  end
55
55
 
56
56
  if @statement.filters && @statement.filters.length > 0
57
+ col_type = @statement.filters[0].collection_type
58
+ if col_type > 0
59
+ @data_offset += FIELD_HEADER_SIZE + 1
60
+ fieldCount += 1
61
+ end
62
+
57
63
  @data_offset += FIELD_HEADER_SIZE
58
64
  filterSize+=1 # num filters
59
65
 
@@ -128,6 +134,13 @@ module Aerospike
128
134
  end
129
135
 
130
136
  if @statement.filters && @statement.filters.length > 0
137
+ col_type = @statement.filters[0].collection_type
138
+ if col_type > 0
139
+ write_field_header(1, Aerospike::FieldType::INDEX_TYPE)
140
+ @data_buffer.write_byte(col_type, @data_offset)
141
+ @data_offset+=1
142
+ end
143
+
131
144
  write_field_header(filterSize, Aerospike::FieldType::INDEX_RANGE)
132
145
  @data_buffer.write_byte(@statement.filters.length, @data_offset)
133
146
  @data_offset+=1
@@ -392,7 +392,7 @@ module Aerospike
392
392
  end
393
393
 
394
394
  def pack(packer)
395
- raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::PARAMETER_ERROR, "Can't pack GeoJSON")
395
+ packer.write(Aerospike::ParticleType::GEOJSON.chr + @bytes)
396
396
  end
397
397
 
398
398
  def type
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Aerospike
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aerospike
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Khosrow Afroozeh
@@ -9,23 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-27 00:00:00.000000000 Z
12
+ date: 2016-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
15
20
  name: msgpack
16
21
  requirement: !ruby/object:Gem::Requirement
17
22
  requirements:
18
23
  - - "~>"
19
24
  - !ruby/object:Gem::Version
20
- version: '0.7'
25
+ version: '1.0'
21
26
  type: :runtime
22
27
  prerelease: false
28
+ - !ruby/object:Gem::Dependency
23
29
  version_requirements: !ruby/object:Gem::Requirement
24
30
  requirements:
25
31
  - - "~>"
26
32
  - !ruby/object:Gem::Version
27
- version: '0.7'
28
- - !ruby/object:Gem::Dependency
33
+ version: '3.1'
29
34
  name: bcrypt
30
35
  requirement: !ruby/object:Gem::Requirement
31
36
  requirements:
@@ -34,11 +39,6 @@ dependencies:
34
39
  version: '3.1'
35
40
  type: :runtime
36
41
  prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '3.1'
42
42
  description: Official Aerospike Client for ruby. Access your Aerospike cluster with
43
43
  ease of Ruby.
44
44
  email:
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  requirements: []
159
159
  rubyforge_project:
160
- rubygems_version: 2.5.1
160
+ rubygems_version: 2.6.2
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: An Aerospike driver for Ruby.