aerospike 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +13 -9
  4. data/lib/aerospike/batch_attr.rb +292 -0
  5. data/lib/aerospike/batch_delete.rb +48 -0
  6. data/lib/aerospike/batch_read.rb +97 -0
  7. data/lib/aerospike/batch_record.rb +83 -0
  8. data/lib/aerospike/batch_results.rb +38 -0
  9. data/lib/aerospike/batch_udf.rb +76 -0
  10. data/lib/aerospike/batch_write.rb +79 -0
  11. data/lib/aerospike/cdt/bit_operation.rb +4 -5
  12. data/lib/aerospike/cdt/map_return_type.rb +8 -0
  13. data/lib/aerospike/client.rb +37 -51
  14. data/lib/aerospike/cluster.rb +50 -46
  15. data/lib/aerospike/command/batch_index_command.rb +6 -10
  16. data/lib/aerospike/command/batch_index_node.rb +3 -4
  17. data/lib/aerospike/command/batch_operate_command.rb +151 -0
  18. data/lib/aerospike/command/batch_operate_node.rb +51 -0
  19. data/lib/aerospike/command/command.rb +101 -87
  20. data/lib/aerospike/command/single_command.rb +1 -1
  21. data/lib/aerospike/exp/exp.rb +39 -41
  22. data/lib/aerospike/exp/exp_bit.rb +24 -24
  23. data/lib/aerospike/exp/exp_hll.rb +12 -12
  24. data/lib/aerospike/exp/exp_list.rb +101 -92
  25. data/lib/aerospike/exp/exp_map.rb +118 -121
  26. data/lib/aerospike/exp/operation.rb +2 -2
  27. data/lib/aerospike/info.rb +2 -4
  28. data/lib/aerospike/node.rb +7 -3
  29. data/lib/aerospike/operation.rb +38 -0
  30. data/lib/aerospike/policy/batch_delete_policy.rb +71 -0
  31. data/lib/aerospike/policy/batch_policy.rb +53 -4
  32. data/lib/aerospike/{command/batch_direct_node.rb → policy/batch_read_policy.rb} +17 -19
  33. data/lib/aerospike/policy/batch_udf_policy.rb +75 -0
  34. data/lib/aerospike/policy/batch_write_policy.rb +105 -0
  35. data/lib/aerospike/policy/policy.rb +3 -40
  36. data/lib/aerospike/query/server_command.rb +1 -0
  37. data/lib/aerospike/query/statement.rb +5 -21
  38. data/lib/aerospike/utils/buffer.rb +15 -15
  39. data/lib/aerospike/version.rb +1 -1
  40. data/lib/aerospike.rb +13 -12
  41. metadata +16 -14
  42. data/lib/aerospike/command/batch_direct_command.rb +0 -105
  43. data/lib/aerospike/command/batch_direct_exists_command.rb +0 -51
  44. data/lib/aerospike/query/pred_exp/and_or.rb +0 -32
  45. data/lib/aerospike/query/pred_exp/geo_json_value.rb +0 -41
  46. data/lib/aerospike/query/pred_exp/integer_value.rb +0 -32
  47. data/lib/aerospike/query/pred_exp/op.rb +0 -27
  48. data/lib/aerospike/query/pred_exp/regex.rb +0 -32
  49. data/lib/aerospike/query/pred_exp/regex_flags.rb +0 -23
  50. data/lib/aerospike/query/pred_exp/string_value.rb +0 -29
  51. data/lib/aerospike/query/pred_exp.rb +0 -192
@@ -1,192 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Aerospike
4
- class PredExp
5
- AND = 1
6
- OR = 2
7
- NOT = 3
8
- INTEGER_VALUE = 10
9
- STRING_VALUE = 11
10
- GEOJSON_VALUE = 12
11
- INTEGER_BIN = 100
12
- STRING_BIN = 101
13
- GEOJSON_BIN = 102
14
- LIST_BIN = 103
15
- MAP_BIN = 104
16
- INTEGER_VAR = 120
17
- STRING_VAR = 121
18
- GEOJSON_VAR = 122
19
- RECSIZE = 150
20
- LAST_UPDATE = 151
21
- VOID_TIME = 152
22
- INTEGER_EQUAL = 200
23
- INTEGER_UNEQUAL = 201
24
- INTEGER_GREATER = 202
25
- INTEGER_GREATEREQ = 203
26
- INTEGER_LESS = 204
27
- INTEGER_LESSEQ = 205
28
- STRING_EQUAL = 210
29
- STRING_UNEQUAL = 211
30
- STRING_REGEX = 212
31
- GEOJSON_WITHIN = 220
32
- GEOJSON_CONTAINS = 221
33
- LIST_ITERATE_OR = 250
34
- MAPKEY_ITERATE_OR = 251
35
- MAPVAL_ITERATE_OR = 252
36
- LIST_ITERATE_AND = 253
37
- MAPKEY_ITERATE_AND = 254
38
- MAPVAL_ITERATE_AND = 255
39
-
40
- def self.and(nexp)
41
- AndOr.new(AND, nexp)
42
- end
43
-
44
- def self.or(nexp)
45
- AndOr.new(OR, nexp)
46
- end
47
-
48
- def self.not
49
- Op.new(NOT)
50
- end
51
-
52
- def self.integer_value(value)
53
- IntegerValue.new(value, INTEGER_VALUE)
54
- end
55
-
56
- def self.string_value(value)
57
- StringValue.new(value, STRING_VALUE)
58
- end
59
-
60
- def self.geojson_value(value)
61
- raise(ArgumentError, "value must be a GeoJSON object!") unless value.is_a?(Aerospike::GeoJSON)
62
- GeoJsonValue.new(value.to_s, GEOJSON_VALUE)
63
- end
64
-
65
- def self.integer_bin(name)
66
- StringValue.new(name, INTEGER_BIN)
67
- end
68
-
69
- def self.string_bin(name)
70
- StringValue.new(name, STRING_BIN)
71
- end
72
-
73
- def self.geojson_bin(name)
74
- StringValue.new(name, GEOJSON_BIN)
75
- end
76
-
77
- def self.list_bin(name)
78
- StringValue.new(name, LIST_BIN)
79
- end
80
-
81
- def self.map_bin(name)
82
- StringValue.new(name, MAP_BIN)
83
- end
84
-
85
- def self.integer_var(name)
86
- StringValue.new(name, INTEGER_VAR)
87
- end
88
-
89
- def self.string_var(name)
90
- StringValue.new(name, STRING_VAR)
91
- end
92
-
93
- def self.geojson_var(name)
94
- StringValue.new(name, GEOJSON_VAR)
95
- end
96
-
97
- def self.record_size
98
- Op.new(RECSIZE)
99
- end
100
-
101
- def self.last_update
102
- Op.new(LAST_UPDATE)
103
- end
104
-
105
- def self.void_time
106
- Op.new(VOID_TIME)
107
- end
108
-
109
- def self.integer_equal
110
- Op.new(INTEGER_EQUAL)
111
- end
112
-
113
- def self.integer_unequal
114
- Op.new(INTEGER_UNEQUAL)
115
- end
116
-
117
- def self.integer_greater
118
- Op.new(INTEGER_GREATER)
119
- end
120
-
121
- def self.integer_greater_eq
122
- Op.new(INTEGER_GREATEREQ)
123
- end
124
-
125
- def self.integer_less
126
- Op.new(INTEGER_LESS)
127
- end
128
-
129
- def self.integer_less_eq
130
- Op.new(INTEGER_LESSEQ)
131
- end
132
-
133
- def self.string_equal
134
- Op.new(STRING_EQUAL)
135
- end
136
-
137
- def self.string_unequal
138
- Op.new(STRING_UNEQUAL)
139
- end
140
-
141
- def self.string_regex(flags)
142
- Regex.new(STRING_REGEX, flags)
143
- end
144
-
145
- def self.geojson_within
146
- Op.new(GEOJSON_WITHIN)
147
- end
148
-
149
- def self.geojson_contains
150
- Op.new(GEOJSON_CONTAINS)
151
- end
152
-
153
- def self.list_iterate_or(var_name)
154
- StringValue.new(var_name, LIST_ITERATE_OR)
155
- end
156
-
157
- def self.list_iterate_and(var_name)
158
- StringValue.new(var_name, LIST_ITERATE_AND)
159
- end
160
-
161
- def self.mapkey_iterate_or(var_name)
162
- StringValue.new(var_name, MAPKEY_ITERATE_OR)
163
- end
164
-
165
- def self.mapkey_iterate_and(var_name)
166
- StringValue.new(var_name, MAPKEY_ITERATE_AND)
167
- end
168
-
169
- def self.mapval_iterate_or(var_name)
170
- StringValue.new(var_name, MAPVAL_ITERATE_OR)
171
- end
172
-
173
- def self.mapval_iterate_and(var_name)
174
- StringValue.new(var_name, MAPVAL_ITERATE_AND)
175
- end
176
-
177
-
178
-
179
- def self.estimate_size(predexp)
180
- return 0 unless predexp
181
- predexp.map(&:estimate_size).inject { |sum, size| sum + size }
182
- end
183
-
184
- def self.write(predexp, buffer, offset)
185
- predexp.each do |p|
186
- offset = p.write(buffer, offset)
187
- end
188
-
189
- offset
190
- end
191
- end
192
- end