aerospike 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +3 -3
- data/lib/aerospike.rb +0 -5
- data/lib/aerospike/cdt/list_operation.rb +13 -0
- data/lib/aerospike/client.rb +0 -43
- data/lib/aerospike/policy/query_policy.rb +5 -1
- data/lib/aerospike/query/query_command.rb +1 -1
- data/lib/aerospike/version.rb +1 -1
- metadata +3 -8
- data/lib/aerospike/ldt/large.rb +0 -57
- data/lib/aerospike/ldt/large_list.rb +0 -101
- data/lib/aerospike/ldt/large_map.rb +0 -91
- data/lib/aerospike/ldt/large_set.rb +0 -86
- data/lib/aerospike/ldt/large_stack.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d49c7d62bc7171c98eac791bf1ff48bc19eed19e
|
4
|
+
data.tar.gz: 10b103d7857eff070e3a4dbf23d03df2a4f73009
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45ecde047634d1a23464184a27abaa701f742c9a6b4a29797e66d351fd1b080e3d205c797865e85dd9f70c1c239412de5214b4adfbdacaa6f5ac17048ee25a78
|
7
|
+
data.tar.gz: a19481a42cba1e64845a7bc98812c9ef73ff22d835a76fa3b0e815904de0574a080ae9dbcf09adbd57ca78606ac6e1743d3f56498a702e788b244f2cc6134932
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
v2.5.0 / 2017-10-10
|
2
|
+
===================
|
3
|
+
|
4
|
+
* **New Features**
|
5
|
+
* Support nobins flag on query operations
|
6
|
+
* Support CDT List Increment operation. Requires Aerospike server version 3.15 or later.
|
7
|
+
|
8
|
+
* **Updates**
|
9
|
+
* The deprecated Large Data Types(LDT) feature has been removed.
|
10
|
+
* Ruby 2.1 has been removed from the client's test matrix as [official support for Ruby 2.1 has ended in Apr 2017](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/). Nothing has changed in the client that would break compatibility with Ruby 2.1 yet. But compatibility is not guaranteed for future client releases.
|
11
|
+
|
1
12
|
v2.4.0 / 2017-04-06
|
2
13
|
===================
|
3
14
|
|
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 2.
|
10
|
+
This library is compatible with Ruby 2.2+ and supports Linux, Mac OS X and various other BSDs. Rubinius is supported, but not JRuby.
|
11
11
|
|
12
12
|
- [Usage](#Usage)
|
13
13
|
- [Prerequisites](#Prerequisites)
|
@@ -61,7 +61,7 @@ Details about the API are available in the [`docs`](docs) directory.
|
|
61
61
|
<a name="Prerequisites"></a>
|
62
62
|
## Prerequisites
|
63
63
|
|
64
|
-
[Ruby](https://ruby-lang.org) version v2.
|
64
|
+
[Ruby](https://ruby-lang.org) version v2.2+ is required.
|
65
65
|
|
66
66
|
Aerospike Ruby client implements the wire protocol, and does not depend on the C client.
|
67
67
|
It is thread friendly.
|
@@ -81,7 +81,7 @@ Supported operating systems:
|
|
81
81
|
|
82
82
|
### Installation from source
|
83
83
|
|
84
|
-
1. Install Ruby 2.
|
84
|
+
1. Install Ruby 2.2+
|
85
85
|
2. Install RubyGems
|
86
86
|
3. Install Bundler: ```gem install bundler```
|
87
87
|
4. Install dependencies: ```bundler install```
|
data/lib/aerospike.rb
CHANGED
@@ -84,11 +84,6 @@ require 'aerospike/cluster/partition'
|
|
84
84
|
require 'aerospike/cluster/node'
|
85
85
|
require 'aerospike/cluster/partition_tokenizer_new'
|
86
86
|
require 'aerospike/cluster/partition_tokenizer_old'
|
87
|
-
require 'aerospike/ldt/large_map'
|
88
|
-
require 'aerospike/ldt/large_set'
|
89
|
-
require 'aerospike/ldt/large_stack'
|
90
|
-
require 'aerospike/ldt/large'
|
91
|
-
require 'aerospike/ldt/large_list'
|
92
87
|
require 'aerospike/info'
|
93
88
|
require 'aerospike/udf'
|
94
89
|
require 'aerospike/bin'
|
@@ -49,6 +49,7 @@ module Aerospike
|
|
49
49
|
SET = 9
|
50
50
|
TRIM = 10
|
51
51
|
CLEAR = 11
|
52
|
+
INCREMENT = 12
|
52
53
|
SIZE = 16
|
53
54
|
GET = 17
|
54
55
|
GET_RANGE = 18
|
@@ -150,6 +151,18 @@ module Aerospike
|
|
150
151
|
create_operation(Operation::CDT_MODIFY, CLEAR, bin_name)
|
151
152
|
end
|
152
153
|
|
154
|
+
##
|
155
|
+
# Create list increment operation.
|
156
|
+
# Server increments list[index] by value. If not specified, value defaults to 1.
|
157
|
+
# Server returns the value of list[index] after the operation.
|
158
|
+
def self.increment(bin_name, index, value = nil)
|
159
|
+
if value
|
160
|
+
create_operation(Operation::CDT_MODIFY, INCREMENT, bin_name, index, value)
|
161
|
+
else
|
162
|
+
create_operation(Operation::CDT_MODIFY, INCREMENT, bin_name, index)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
153
166
|
##
|
154
167
|
# Create list size operation.
|
155
168
|
# Server returns size of list.
|
data/lib/aerospike/client.rb
CHANGED
@@ -371,49 +371,6 @@ module Aerospike
|
|
371
371
|
command.record
|
372
372
|
end
|
373
373
|
|
374
|
-
#-------------------------------------------------------------------
|
375
|
-
# Large collection functions (Supported by Aerospike 3 servers only)
|
376
|
-
#-------------------------------------------------------------------
|
377
|
-
|
378
|
-
# Initialize large list operator. This operator can be used to create and manage a list
|
379
|
-
# within a single bin.
|
380
|
-
#
|
381
|
-
# This method is only supported by Aerospike 3 servers.
|
382
|
-
def get_large_list(key, bin_name, user_module=nil, options={})
|
383
|
-
policy = create_policy(options, WritePolicy)
|
384
|
-
LargeList.new(self, policy, key, bin_name, user_module)
|
385
|
-
end
|
386
|
-
|
387
|
-
# Initialize large map operator. This operator can be used to create and manage a map
|
388
|
-
# within a single bin.
|
389
|
-
#
|
390
|
-
# This method is only supported by Aerospike 3 servers.
|
391
|
-
# DEPRECATED. This method will be removed from the client in the future.
|
392
|
-
def get_large_map(key, bin_name, user_module=nil, options={})
|
393
|
-
policy = create_policy(options, WritePolicy)
|
394
|
-
LargeMap.new(self, policy, key, bin_name, user_module)
|
395
|
-
end
|
396
|
-
|
397
|
-
# Initialize large set operator. This operator can be used to create and manage a set
|
398
|
-
# within a single bin.
|
399
|
-
#
|
400
|
-
# This method is only supported by Aerospike 3 servers.
|
401
|
-
# DEPRECATED. This method will be removed from the client in the future.
|
402
|
-
def get_large_set(key, bin_name, user_module=nil, options={})
|
403
|
-
policy = create_policy(options, WritePolicy)
|
404
|
-
LargeSet.new(self, policy, key, bin_name, user_module)
|
405
|
-
end
|
406
|
-
|
407
|
-
# Initialize large stack operator. This operator can be used to create and manage a stack
|
408
|
-
# within a single bin.
|
409
|
-
#
|
410
|
-
# This method is only supported by Aerospike 3 servers.
|
411
|
-
# DEPRECATED. This method will be removed from the client in the future.
|
412
|
-
def get_large_stack(key, bin_name, user_module=nil, options={})
|
413
|
-
policy = create_policy(options, WritePolicy)
|
414
|
-
LargeStack.new(self, policy, key, bin_name, user_module)
|
415
|
-
end
|
416
|
-
|
417
374
|
#---------------------------------------------------------------
|
418
375
|
# User defined functions (Supported by Aerospike 3 servers only)
|
419
376
|
#---------------------------------------------------------------
|
@@ -17,14 +17,18 @@ require 'aerospike/policy/batch_policy'
|
|
17
17
|
|
18
18
|
module Aerospike
|
19
19
|
|
20
|
-
# Container object for
|
20
|
+
# Container object for query policy command.
|
21
21
|
class QueryPolicy < BatchPolicy
|
22
22
|
|
23
|
+
attr_accessor :include_bin_data
|
24
|
+
|
23
25
|
def initialize(opt={})
|
24
26
|
super(opt)
|
25
27
|
|
26
28
|
@max_retries = 0
|
27
29
|
|
30
|
+
@include_bin_data = opt.fetch(:include_bin_data, true)
|
31
|
+
|
28
32
|
self
|
29
33
|
end
|
30
34
|
|
@@ -116,7 +116,7 @@ module Aerospike
|
|
116
116
|
|
117
117
|
size_buffer
|
118
118
|
|
119
|
-
readAttr = INFO1_READ
|
119
|
+
readAttr = @policy.include_bin_data ? INFO1_READ : INFO1_READ | INFO1_NOBINDATA
|
120
120
|
operation_count = (@statement.filters.to_a.length == 0 && @statement.bin_names.to_a.length == 0) ? @statement.bin_names.length : 0
|
121
121
|
|
122
122
|
write_header(@policy, readAttr, 0, fieldCount, operation_count)
|
data/lib/aerospike/version.rb
CHANGED
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.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Khosrow Afroozeh
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
@@ -93,11 +93,6 @@ files:
|
|
93
93
|
- lib/aerospike/info.rb
|
94
94
|
- lib/aerospike/key.rb
|
95
95
|
- lib/aerospike/language.rb
|
96
|
-
- lib/aerospike/ldt/large.rb
|
97
|
-
- lib/aerospike/ldt/large_list.rb
|
98
|
-
- lib/aerospike/ldt/large_map.rb
|
99
|
-
- lib/aerospike/ldt/large_set.rb
|
100
|
-
- lib/aerospike/ldt/large_stack.rb
|
101
96
|
- lib/aerospike/loggable.rb
|
102
97
|
- lib/aerospike/operation.rb
|
103
98
|
- lib/aerospike/policy/admin_policy.rb
|
@@ -151,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
146
|
requirements:
|
152
147
|
- - ">="
|
153
148
|
- !ruby/object:Gem::Version
|
154
|
-
version: 2.
|
149
|
+
version: 2.2.0
|
155
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
151
|
requirements:
|
157
152
|
- - ">="
|
data/lib/aerospike/ldt/large.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Copyright 2014-2017 Aerospike, Inc.
|
3
|
-
#
|
4
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
|
-
# license agreements.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the 'License'); you may not
|
8
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
9
|
-
# the License at http:#www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
|
13
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
-
# License for the specific language governing permissions and limitations under
|
15
|
-
# the License.
|
16
|
-
|
17
|
-
require 'aerospike/value/particle_type'
|
18
|
-
|
19
|
-
module Aerospike
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
class Large
|
24
|
-
|
25
|
-
def initialize(client, policy, key, bin_name, user_module=nil)
|
26
|
-
@client = client
|
27
|
-
@policy = policy
|
28
|
-
@key = key
|
29
|
-
@bin_name = bin_name
|
30
|
-
@user_module = user_module unless user_module.nil?
|
31
|
-
|
32
|
-
self
|
33
|
-
end
|
34
|
-
|
35
|
-
# Delete bin containing the object.
|
36
|
-
def destroy
|
37
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'destroy', [@bin_name], @policy)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Return size of object.
|
41
|
-
def size
|
42
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'size', [@bin_name], @policy)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Return map of object configuration parameters.
|
46
|
-
def config
|
47
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'get_config', [@bin_name], @policy)
|
48
|
-
end
|
49
|
-
|
50
|
-
# Return list of all objects on the stack.
|
51
|
-
def scan
|
52
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'scan', [@bin_name], @policy)
|
53
|
-
end
|
54
|
-
|
55
|
-
end # class
|
56
|
-
|
57
|
-
end #class
|
@@ -1,101 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Copyright 2014-2017 Aerospike, Inc.
|
3
|
-
#
|
4
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
|
-
# license agreements.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the 'License'); you may not
|
8
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
9
|
-
# the License at http:#www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
|
13
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
-
# License for the specific language governing permissions and limitations under
|
15
|
-
# the License.
|
16
|
-
|
17
|
-
require 'aerospike/ldt/large'
|
18
|
-
|
19
|
-
module Aerospike
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
class LargeList < Large
|
24
|
-
|
25
|
-
def initialize(client, policy, key, bin_name, user_module=nil)
|
26
|
-
@PACKAGE_NAME = 'llist'
|
27
|
-
|
28
|
-
super(client, policy, key, bin_name, user_module)
|
29
|
-
|
30
|
-
self
|
31
|
-
end
|
32
|
-
|
33
|
-
# Add values to the list. If the list does not exist, create it using specified user_module configuration.
|
34
|
-
#
|
35
|
-
# values values to add
|
36
|
-
def add(*values)
|
37
|
-
if values.length == 1
|
38
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'add', [@bin_name, values[0], @user_module], @policy)
|
39
|
-
else
|
40
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'add_all', [@bin_name, values, @user_module], @policy)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# Update/Add each value in array depending if key exists or not.
|
45
|
-
# If value is a map, the key is identified by "key" entry. Otherwise, the value is the key.
|
46
|
-
# If large list does not exist, create it using specified user_module configuration.
|
47
|
-
#
|
48
|
-
# values values to update
|
49
|
-
def update(*values)
|
50
|
-
if values.length == 1
|
51
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'update', [@bin_name, values[0], @user_module], @policy)
|
52
|
-
else
|
53
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'update_all', [@bin_name, values, @user_module], @policy)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# Delete value from list.
|
58
|
-
#
|
59
|
-
# value value to delete
|
60
|
-
def remove(value)
|
61
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'remove', [@bin_name, value], @policy)
|
62
|
-
end
|
63
|
-
|
64
|
-
# Select values from list.
|
65
|
-
#
|
66
|
-
# value value to select
|
67
|
-
# returns list of entries selected
|
68
|
-
def find(value)
|
69
|
-
begin
|
70
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'find', [@bin_name, value], @policy)
|
71
|
-
rescue Aerospike::Exceptions::Aerospike => e
|
72
|
-
unless e.result_code == Aerospike::ResultCode::UDF_BAD_RESPONSE && e.message.index("Item Not Found")
|
73
|
-
Aerospike.logger.error(e)
|
74
|
-
raise e
|
75
|
-
end
|
76
|
-
nil
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
# Select values from list and apply specified Lua filter.
|
81
|
-
#
|
82
|
-
# value value to select
|
83
|
-
# filter_name Lua function name which applies filter to returned list
|
84
|
-
# filter_args arguments to Lua function name
|
85
|
-
# returns list of entries selected
|
86
|
-
def find_then_filter(value, filter_name, *filter_args)
|
87
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'find_then_filter', [@bin_name, value, @user_module, filter_name, filter_args], @policy)
|
88
|
-
end
|
89
|
-
|
90
|
-
# Select values from list and apply specified Lua filter.
|
91
|
-
#
|
92
|
-
# filter_name Lua function name which applies filter to returned list
|
93
|
-
# filter_args arguments to Lua function name
|
94
|
-
# returns list of entries selected
|
95
|
-
def filter(filter_name, *filter_args)
|
96
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'filter', [@bin_name, @user_module, filter_name, filter_args], @policy)
|
97
|
-
end
|
98
|
-
|
99
|
-
end # class
|
100
|
-
|
101
|
-
end #class
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Copyright 2014-2017 Aerospike, Inc.
|
3
|
-
#
|
4
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
|
-
# license agreements.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the 'License'); you may not
|
8
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
9
|
-
# the License at http:#www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
|
13
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
-
# License for the specific language governing permissions and limitations under
|
15
|
-
# the License.
|
16
|
-
|
17
|
-
##############################################################
|
18
|
-
#
|
19
|
-
# NOTICE:
|
20
|
-
# THIS FEATURE HAS BEEN DEPRECATED ON SERVER.
|
21
|
-
# THE API WILL BE REMOVED FROM THE CLIENT IN THE FUTURE.
|
22
|
-
#
|
23
|
-
##############################################################
|
24
|
-
|
25
|
-
require 'aerospike/ldt/large'
|
26
|
-
|
27
|
-
module Aerospike
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
class LargeMap < Large
|
32
|
-
|
33
|
-
def initialize(client, policy, key, bin_name, user_module=nil)
|
34
|
-
@PACKAGE_NAME = 'lmap'
|
35
|
-
|
36
|
-
super(client, policy, key, bin_name, user_module)
|
37
|
-
|
38
|
-
self
|
39
|
-
end
|
40
|
-
|
41
|
-
# Add entry to map. If the map does not exist, create it using specified user_module configuration.
|
42
|
-
#
|
43
|
-
# name entry key
|
44
|
-
# value entry value
|
45
|
-
def put(name, value)
|
46
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'put', [@bin_name, name, value, @user_module], @policy)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Add map values to map. If the map does not exist, create it using specified user_module configuration.
|
50
|
-
#
|
51
|
-
# map map values to push
|
52
|
-
def put_map(the_map)
|
53
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'put_all', [@bin_name, the_map, @user_module], @policy)
|
54
|
-
end
|
55
|
-
|
56
|
-
# Get value from map given name key.
|
57
|
-
#
|
58
|
-
# name key.
|
59
|
-
# return map of items selected
|
60
|
-
def get(name)
|
61
|
-
begin
|
62
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'get', [@bin_name, name, @user_module], @policy)
|
63
|
-
rescue Aerospike::Exceptions::Aerospike => e
|
64
|
-
unless e.result_code == Aerospike::ResultCode::UDF_BAD_RESPONSE && e.message.index("Item Not Found")
|
65
|
-
Aerospike.logger.error(e)
|
66
|
-
raise e
|
67
|
-
end
|
68
|
-
nil
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# Get value from map given name key.
|
73
|
-
#
|
74
|
-
# name key.
|
75
|
-
# return map of items selected
|
76
|
-
def remove(name)
|
77
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'remove', [@bin_name, name, @user_module], @policy)
|
78
|
-
end
|
79
|
-
|
80
|
-
# Select items from map.
|
81
|
-
#
|
82
|
-
# filter_name Lua function name which applies filter to returned list
|
83
|
-
# filter_args arguments to Lua function name
|
84
|
-
# return list of items selected
|
85
|
-
def filter(filter_name, *filter_args)
|
86
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'filter', [@bin_name, @user_module, filter_name, filter_args], @policy)
|
87
|
-
end
|
88
|
-
|
89
|
-
end # class
|
90
|
-
|
91
|
-
end #class
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Copyright 2014-2017 Aerospike, Inc.
|
3
|
-
#
|
4
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
|
-
# license agreements.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the 'License'); you may not
|
8
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
9
|
-
# the License at http:#www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
|
13
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
-
# License for the specific language governing permissions and limitations under
|
15
|
-
# the License.
|
16
|
-
|
17
|
-
##############################################################
|
18
|
-
#
|
19
|
-
# NOTICE:
|
20
|
-
# THIS FEATURE HAS BEEN DEPRECATED ON SERVER.
|
21
|
-
# THE API WILL BE REMOVED FROM THE CLIENT IN THE FUTURE.
|
22
|
-
#
|
23
|
-
##############################################################
|
24
|
-
|
25
|
-
require 'aerospike/ldt/large'
|
26
|
-
|
27
|
-
module Aerospike
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
class LargeSet < Large
|
32
|
-
|
33
|
-
def initialize(client, policy, key, bin_name, user_module=nil)
|
34
|
-
@PACKAGE_NAME = 'lset'
|
35
|
-
|
36
|
-
super(client, policy, key, bin_name, user_module)
|
37
|
-
|
38
|
-
self
|
39
|
-
end
|
40
|
-
|
41
|
-
# Add values to the list. If the list does not exist, create it using specified user_module configuration.
|
42
|
-
#
|
43
|
-
# values values to add
|
44
|
-
def add(*values)
|
45
|
-
if values.length == 1
|
46
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'add', [@bin_name, values[0], @user_module], @policy)
|
47
|
-
else
|
48
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'add_all', [@bin_name, values, @user_module], @policy)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# Delete value from list.
|
53
|
-
#
|
54
|
-
# value value to delete
|
55
|
-
def remove(value)
|
56
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'remove', [@bin_name, value], @policy)
|
57
|
-
end
|
58
|
-
|
59
|
-
# Select values from list.
|
60
|
-
#
|
61
|
-
# value value to select
|
62
|
-
# returns list of entries selected
|
63
|
-
def get(value)
|
64
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'get', [@bin_name, value], @policy)
|
65
|
-
end
|
66
|
-
|
67
|
-
# Check existence of value in the set.
|
68
|
-
#
|
69
|
-
# value value to check
|
70
|
-
# returns true if found, otherwise false
|
71
|
-
def exists(value)
|
72
|
-
1 == @client.execute_udf(@key, @PACKAGE_NAME, 'exists', [@bin_name, value], @policy)
|
73
|
-
end
|
74
|
-
|
75
|
-
# Select values from list and apply specified Lua filter.
|
76
|
-
#
|
77
|
-
# filter_name Lua function name which applies filter to returned list
|
78
|
-
# filter_args arguments to Lua function name
|
79
|
-
# returns list of entries selected
|
80
|
-
def filter(filter_name, *filter_args)
|
81
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'filter', [@bin_name, @user_module, filter_name, filter_args], @policy)
|
82
|
-
end
|
83
|
-
|
84
|
-
end # class
|
85
|
-
|
86
|
-
end #class
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Copyright 2014-2017 Aerospike, Inc.
|
3
|
-
#
|
4
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
|
-
# license agreements.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the 'License'); you may not
|
8
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
9
|
-
# the License at http:#www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
|
13
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
-
# License for the specific language governing permissions and limitations under
|
15
|
-
# the License.
|
16
|
-
|
17
|
-
##############################################################
|
18
|
-
#
|
19
|
-
# NOTICE:
|
20
|
-
# THIS FEATURE HAS BEEN DEPRECATED ON SERVER.
|
21
|
-
# THE API WILL BE REMOVED FROM THE CLIENT IN THE FUTURE.
|
22
|
-
#
|
23
|
-
##############################################################
|
24
|
-
|
25
|
-
require 'aerospike/ldt/large'
|
26
|
-
|
27
|
-
module Aerospike
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
class LargeStack < Large
|
32
|
-
|
33
|
-
def initialize(client, policy, key, bin_name, user_module=nil)
|
34
|
-
@PACKAGE_NAME = 'lstack'
|
35
|
-
|
36
|
-
super(client, policy, key, bin_name, user_module)
|
37
|
-
|
38
|
-
self
|
39
|
-
end
|
40
|
-
|
41
|
-
# Push values onto stack. If the stack does not exist, create it using specified user_module configuration.
|
42
|
-
#
|
43
|
-
# values values to push
|
44
|
-
def push(*values)
|
45
|
-
if values.length == 1
|
46
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'push', [@bin_name, values[0], @user_module], @policy)
|
47
|
-
else
|
48
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'push_all', [@bin_name, values, @user_module], @policy)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# Select items from top of stack.
|
53
|
-
#
|
54
|
-
# peek_count number of items to select.
|
55
|
-
# returns list of items selected
|
56
|
-
def peek(peek_count)
|
57
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'peek', [@bin_name, peek_count], @policy)
|
58
|
-
end
|
59
|
-
|
60
|
-
# Select items from top of stack.
|
61
|
-
#
|
62
|
-
# peek_count number of items to select.
|
63
|
-
# returns list of items selected
|
64
|
-
def pop(count)
|
65
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'pop', [@bin_name, count], @policy)
|
66
|
-
end
|
67
|
-
|
68
|
-
# Select items from top of stack.
|
69
|
-
#
|
70
|
-
# peek_count number of items to select.
|
71
|
-
# filter_name Lua function name which applies filter to returned list
|
72
|
-
# filter_args arguments to Lua function name
|
73
|
-
# returns list of items selected
|
74
|
-
def filter(peek_count, filter_name, *filter_args)
|
75
|
-
@client.execute_udf(@key, @PACKAGE_NAME, 'filter', [@bin_name, peek_count, @user_module, filter_name, filter_args], @policy)
|
76
|
-
end
|
77
|
-
|
78
|
-
end # class
|
79
|
-
|
80
|
-
end #class
|