aerospike 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +0 -0
- data/LICENSE +203 -0
- data/README.md +123 -0
- data/lib/aerospike.rb +69 -0
- data/lib/aerospike/aerospike_exception.rb +111 -0
- data/lib/aerospike/bin.rb +46 -0
- data/lib/aerospike/client.rb +649 -0
- data/lib/aerospike/cluster/cluster.rb +537 -0
- data/lib/aerospike/cluster/connection.rb +113 -0
- data/lib/aerospike/cluster/node.rb +248 -0
- data/lib/aerospike/cluster/node_validator.rb +85 -0
- data/lib/aerospike/cluster/partition.rb +54 -0
- data/lib/aerospike/cluster/partition_tokenizer_new.rb +128 -0
- data/lib/aerospike/cluster/partition_tokenizer_old.rb +135 -0
- data/lib/aerospike/command/batch_command.rb +120 -0
- data/lib/aerospike/command/batch_command_exists.rb +93 -0
- data/lib/aerospike/command/batch_command_get.rb +150 -0
- data/lib/aerospike/command/batch_item.rb +69 -0
- data/lib/aerospike/command/batch_node.rb +82 -0
- data/lib/aerospike/command/command.rb +680 -0
- data/lib/aerospike/command/delete_command.rb +57 -0
- data/lib/aerospike/command/execute_command.rb +42 -0
- data/lib/aerospike/command/exists_command.rb +57 -0
- data/lib/aerospike/command/field_type.rb +44 -0
- data/lib/aerospike/command/operate_command.rb +37 -0
- data/lib/aerospike/command/read_command.rb +174 -0
- data/lib/aerospike/command/read_header_command.rb +63 -0
- data/lib/aerospike/command/single_command.rb +60 -0
- data/lib/aerospike/command/touch_command.rb +50 -0
- data/lib/aerospike/command/write_command.rb +60 -0
- data/lib/aerospike/host.rb +43 -0
- data/lib/aerospike/info.rb +96 -0
- data/lib/aerospike/key.rb +99 -0
- data/lib/aerospike/language.rb +25 -0
- data/lib/aerospike/ldt/large.rb +69 -0
- data/lib/aerospike/ldt/large_list.rb +100 -0
- data/lib/aerospike/ldt/large_map.rb +82 -0
- data/lib/aerospike/ldt/large_set.rb +78 -0
- data/lib/aerospike/ldt/large_stack.rb +72 -0
- data/lib/aerospike/loggable.rb +55 -0
- data/lib/aerospike/operation.rb +70 -0
- data/lib/aerospike/policy/client_policy.rb +37 -0
- data/lib/aerospike/policy/generation_policy.rb +37 -0
- data/lib/aerospike/policy/policy.rb +54 -0
- data/lib/aerospike/policy/priority.rb +34 -0
- data/lib/aerospike/policy/record_exists_action.rb +45 -0
- data/lib/aerospike/policy/write_policy.rb +61 -0
- data/lib/aerospike/record.rb +42 -0
- data/lib/aerospike/result_code.rb +353 -0
- data/lib/aerospike/task/index_task.rb +59 -0
- data/lib/aerospike/task/task.rb +71 -0
- data/lib/aerospike/task/udf_register_task.rb +55 -0
- data/lib/aerospike/task/udf_remove_task.rb +55 -0
- data/lib/aerospike/udf.rb +24 -0
- data/lib/aerospike/utils/buffer.rb +139 -0
- data/lib/aerospike/utils/epoc.rb +28 -0
- data/lib/aerospike/utils/pool.rb +65 -0
- data/lib/aerospike/value/particle_type.rb +45 -0
- data/lib/aerospike/value/value.rb +380 -0
- data/lib/aerospike/version.rb +4 -0
- metadata +132 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2014 Aerospike, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http:#www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module Aerospike
|
17
|
+
|
18
|
+
# Container object for client policy command.
|
19
|
+
class ClientPolicy
|
20
|
+
|
21
|
+
attr_accessor :timeout, :connection_queue_size, :fail_if_not_connected
|
22
|
+
|
23
|
+
def initialize(timeout=nil, connection_queue_size=nil, fail_if_not_connected=nil)
|
24
|
+
# Initial host connection timeout in seconds. The timeout when opening a connection
|
25
|
+
# to the server host for the first time.
|
26
|
+
@timeout = timeout || 1.0 # 1 second
|
27
|
+
|
28
|
+
# Size of the Connection Queue cache.
|
29
|
+
@connection_queue_size = connection_queue_size || 64
|
30
|
+
|
31
|
+
# Throw exception if host connection fails during add_host.
|
32
|
+
@fail_if_not_connected = fail_if_not_connected || true
|
33
|
+
end
|
34
|
+
|
35
|
+
end # class
|
36
|
+
|
37
|
+
end # module
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2014 Aerospike, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http:#www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module Aerospike
|
17
|
+
|
18
|
+
module GenerationPolicy
|
19
|
+
|
20
|
+
# Do not use record generation to restrict writes.
|
21
|
+
NONE = 0
|
22
|
+
|
23
|
+
# Update/delete record if expected generation is equal to server generation. Otherwise, fail.
|
24
|
+
EXPECT_GEN_EQUAL = 1
|
25
|
+
|
26
|
+
# Update/delete record if expected generation greater than the server generation. Otherwise, fail.
|
27
|
+
# This is useful for restore after backup.
|
28
|
+
EXPECT_GEN_GT = 2
|
29
|
+
|
30
|
+
# Create duplicate record if expected generation is not equal to server generation.
|
31
|
+
# Duplicates are only created when the server configuration option "allow-versions"
|
32
|
+
# is true (default is false).
|
33
|
+
DUPLICATE = 3
|
34
|
+
|
35
|
+
end # module
|
36
|
+
|
37
|
+
end # module
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2014 Aerospike, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http:#www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'aerospike/policy/priority'
|
17
|
+
|
18
|
+
|
19
|
+
module Aerospike
|
20
|
+
|
21
|
+
# Container object for client policy command.
|
22
|
+
class Policy
|
23
|
+
|
24
|
+
attr_accessor :priority, :timeout, :max_retries, :sleep_between_retries
|
25
|
+
|
26
|
+
def initialize(priority=nil, timeout=nil, max_retiries=nil, sleep_between_retries=nil)
|
27
|
+
# Container object for transaction policy attributes used in all database
|
28
|
+
# operation calls.
|
29
|
+
|
30
|
+
# Priority of request relative to other transactions.
|
31
|
+
# Currently, only used for scans.
|
32
|
+
@priority = priority || Priority::DEFAULT
|
33
|
+
|
34
|
+
# Transaction timeout.
|
35
|
+
# This timeout is used to set the socket timeout and is also sent to the
|
36
|
+
# server along with the transaction in the wire protocol.
|
37
|
+
# Default to no timeout (0).
|
38
|
+
@timeout = timeout || 0
|
39
|
+
|
40
|
+
# Maximum number of retries before aborting the current transaction.
|
41
|
+
# A retry is attempted when there is a network error other than timeout.
|
42
|
+
# If max_retries is exceeded, the abort will occur even if the timeout
|
43
|
+
# has not yet been exceeded.
|
44
|
+
@max_retries = max_retiries || 2
|
45
|
+
|
46
|
+
# Duration to sleep between retries if a transaction fails and the
|
47
|
+
# timeout was not exceeded. Enter zero to skip sleep.
|
48
|
+
@sleep_between_retries = sleep_between_retries || 0.5
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
end # class
|
53
|
+
|
54
|
+
end # module
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2014 Aerospike, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http:#www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module Aerospike
|
17
|
+
|
18
|
+
module Priority
|
19
|
+
|
20
|
+
# The server defines the priority.
|
21
|
+
DEFAULT = 0
|
22
|
+
|
23
|
+
# Run the database operation in a background thread.
|
24
|
+
LOW = 1
|
25
|
+
|
26
|
+
# Run the database operation at medium priority.
|
27
|
+
MEDIUM = 2
|
28
|
+
|
29
|
+
# Run the database operation at the highest priority.
|
30
|
+
HIGH = 3
|
31
|
+
|
32
|
+
end # module
|
33
|
+
|
34
|
+
end # module
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2014 Aerospike, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http:#www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module Aerospike
|
17
|
+
|
18
|
+
module RecordExistsAction
|
19
|
+
|
20
|
+
# Create or update record.
|
21
|
+
# Merge write command bins with existing bins.
|
22
|
+
UPDATE = 0
|
23
|
+
|
24
|
+
# Update record only. Fail if record does not exist.
|
25
|
+
# Merge write command bins with existing bins.
|
26
|
+
UPDATE_ONLY = 1
|
27
|
+
|
28
|
+
# Create or replace record.
|
29
|
+
# Delete existing bins not referenced by write command bins.
|
30
|
+
# Supported by Aerospike 2 server versions >= 2.7.5 and
|
31
|
+
# Aerospike 3 server versions >= 3.1.6.
|
32
|
+
REPLACE = 2
|
33
|
+
|
34
|
+
# Replace record only. Fail if record does not exist.
|
35
|
+
# Delete existing bins not referenced by write command bins.
|
36
|
+
# Supported by Aerospike 2 server versions >= 2.7.5 and
|
37
|
+
# Aerospike 3 server versions >= 3.1.6.
|
38
|
+
REPLACE_ONLY = 3
|
39
|
+
|
40
|
+
# Create only. Fail if record exists.
|
41
|
+
CREATE_ONLY = 4
|
42
|
+
|
43
|
+
end # module
|
44
|
+
|
45
|
+
end # module
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2014 Aerospike, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http:#www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'aerospike/policy/policy'
|
17
|
+
require 'aerospike/policy/generation_policy'
|
18
|
+
require 'aerospike/policy/record_exists_action'
|
19
|
+
|
20
|
+
module Aerospike
|
21
|
+
|
22
|
+
# Container object for client policy command.
|
23
|
+
class WritePolicy < Policy
|
24
|
+
|
25
|
+
attr_accessor :record_exists_action, :generation_policy,
|
26
|
+
:generation, :expiration, :send_key
|
27
|
+
|
28
|
+
def initialize(record_exists_action=nil, gen_policy=nil, generation=nil, expiration=nil, send_key=nil)
|
29
|
+
super()
|
30
|
+
|
31
|
+
# Qualify how to handle writes where the record already exists.
|
32
|
+
@record_exists_action = record_exists_action || RecordExistsAction::UPDATE
|
33
|
+
|
34
|
+
# Qualify how to handle record writes based on record generation. The default (NONE)
|
35
|
+
# indicates that the generation is not used to restrict writes.
|
36
|
+
@generation_policy = gen_policy || GenerationPolicy::NONE
|
37
|
+
|
38
|
+
# Expected generation. Generation is the number of times a record has been modified
|
39
|
+
# (including creation) on the server. If a write operation is creating a record,
|
40
|
+
# the expected generation would be 0
|
41
|
+
@generation = generation || 0
|
42
|
+
|
43
|
+
# Record expiration. Also known as ttl (time to live).
|
44
|
+
# Seconds record will live before being removed by the server.
|
45
|
+
# Expiration values:
|
46
|
+
# -1: Never expire for Aerospike 2 server versions >= 2.7.2 and Aerospike 3 server
|
47
|
+
# versions >= 3.1.4. Do not use -1 for older servers.
|
48
|
+
# 0: Default to namespace configuration variable "default-ttl" on the server.
|
49
|
+
# > 0: Actual expiration in seconds.
|
50
|
+
@expiration = expiration || 0
|
51
|
+
|
52
|
+
# Send user defined key in addition to hash digest on a record put.
|
53
|
+
# The default is to send the user defined key.
|
54
|
+
@send_key = send_key.nil? ? true : send_key
|
55
|
+
|
56
|
+
self
|
57
|
+
end
|
58
|
+
|
59
|
+
end # class
|
60
|
+
|
61
|
+
end # module
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2014 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
|
+
module Aerospike
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
class Record
|
22
|
+
|
23
|
+
attr_reader :key, :bins, :generation, :expiration, :node, :dups
|
24
|
+
|
25
|
+
def initialize(node, rec_key, rec_bins, dups, rec_gen, rec_exp)
|
26
|
+
@key = rec_key
|
27
|
+
@bins = rec_bins
|
28
|
+
@generation = rec_gen
|
29
|
+
@expiration = rec_exp
|
30
|
+
@node = node
|
31
|
+
@dups = dups
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
'key: `' + key.to_s + '` ' +
|
36
|
+
'bins: `' + bins.to_s + '` ' +
|
37
|
+
'generation: `' + generation.to_s + '` ' +
|
38
|
+
'expiration: `' + expiration.to_s + '` '
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,353 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2014 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
|
+
module Aerospike
|
18
|
+
|
19
|
+
module ResultCode
|
20
|
+
|
21
|
+
attr_reader :code
|
22
|
+
|
23
|
+
# Asynchronous max concurrent database commands have been exceeded and therefore rejected.
|
24
|
+
COMMAND_REJECTED = -6
|
25
|
+
|
26
|
+
# Query was terminated by user.
|
27
|
+
QUERY_TERMINATED = -5
|
28
|
+
|
29
|
+
# Scan was terminated by user.
|
30
|
+
SCAN_TERMINATED = -4
|
31
|
+
|
32
|
+
# Chosen node is not currently active.
|
33
|
+
INVALID_NODE_ERROR = -3
|
34
|
+
|
35
|
+
# Client parse error.
|
36
|
+
|
37
|
+
PARSE_ERROR = -2
|
38
|
+
|
39
|
+
# Client serialization error.
|
40
|
+
SERIALIZE_ERROR = -1
|
41
|
+
|
42
|
+
# Operation was successful.
|
43
|
+
OK = 0
|
44
|
+
|
45
|
+
# Unknown server failure.
|
46
|
+
SERVER_ERROR = 1
|
47
|
+
|
48
|
+
# On retrieving, touching or replacing a record that doesn't exist.
|
49
|
+
KEY_NOT_FOUND_ERROR = 2
|
50
|
+
|
51
|
+
# On modifying a record with unexpected generation.
|
52
|
+
GENERATION_ERROR = 3
|
53
|
+
|
54
|
+
# Bad parameter(s) were passed in database operation call.
|
55
|
+
PARAMETER_ERROR = 4
|
56
|
+
|
57
|
+
# On create-only (write unique) operations on a record that already
|
58
|
+
# exists.
|
59
|
+
KEY_EXISTS_ERROR = 5
|
60
|
+
|
61
|
+
# On create-only (write unique) operations on a bin that already
|
62
|
+
# exists.
|
63
|
+
BIN_EXISTS_ERROR = 6
|
64
|
+
|
65
|
+
# Expected cluster ID was not received.
|
66
|
+
CLUSTER_KEY_MISMATCH = 7
|
67
|
+
|
68
|
+
# Server has run out of memory.
|
69
|
+
SERVER_MEM_ERROR = 8
|
70
|
+
|
71
|
+
# Client or server has timed out.
|
72
|
+
TIMEOUT = 9
|
73
|
+
|
74
|
+
# XDS product is not available.
|
75
|
+
NO_XDS = 10
|
76
|
+
|
77
|
+
# Server is not accepting requests.
|
78
|
+
SERVER_NOT_AVAILABLE = 11
|
79
|
+
|
80
|
+
# Operation is not supported with configured bin type (single-bin or
|
81
|
+
# multi-bin).
|
82
|
+
BIN_TYPE_ERROR = 12
|
83
|
+
|
84
|
+
# Record size exceeds limit.
|
85
|
+
RECORD_TOO_BIG = 13
|
86
|
+
|
87
|
+
# Too many concurrent operations on the same record.
|
88
|
+
KEY_BUSY = 14
|
89
|
+
|
90
|
+
# Scan aborted by server.
|
91
|
+
SCAN_ABORT = 15
|
92
|
+
|
93
|
+
# Unsupported Server Feature (e.g. Scan + UDF)
|
94
|
+
UNSUPPORTED_FEATURE = 16
|
95
|
+
|
96
|
+
# Specified bin name does not exist in record.
|
97
|
+
BIN_NOT_FOUND = 17
|
98
|
+
|
99
|
+
# Specified bin name does not exist in record.
|
100
|
+
DEVICE_OVERLOAD = 18
|
101
|
+
|
102
|
+
# Key type mismatch.
|
103
|
+
KEY_MISMATCH = 19
|
104
|
+
|
105
|
+
# There are no more records left for query.
|
106
|
+
QUERY_END = 50
|
107
|
+
|
108
|
+
SECURITY_NOT_SUPPORTED = 51
|
109
|
+
SECURITY_NOT_ENABLED = 52
|
110
|
+
SECURITY_SCHEME_NOT_SUPPORTED = 53
|
111
|
+
|
112
|
+
# Administration command is invalid.
|
113
|
+
INVALID_COMMAND = 54
|
114
|
+
|
115
|
+
# Administration field is invalid.
|
116
|
+
INVALID_FIELD = 55
|
117
|
+
|
118
|
+
ILLEGAL_STATE = 56
|
119
|
+
|
120
|
+
|
121
|
+
# User name is invalid.
|
122
|
+
INVALID_USER = 60
|
123
|
+
|
124
|
+
|
125
|
+
# User was previously created.
|
126
|
+
USER_ALREADY_EXISTS = 61
|
127
|
+
|
128
|
+
|
129
|
+
# Password is invalid.
|
130
|
+
INVALID_PASSWORD = 62
|
131
|
+
|
132
|
+
|
133
|
+
# Security credential is invalid.
|
134
|
+
INVALID_CREDENTIAL = 63
|
135
|
+
|
136
|
+
|
137
|
+
# Role name is invalid.
|
138
|
+
INVALID_ROLE = 70
|
139
|
+
|
140
|
+
INVALID_PRIVILEGE = 71
|
141
|
+
|
142
|
+
# User must be authentication before performing database operations.
|
143
|
+
NOT_AUTHENTICATED = 80
|
144
|
+
|
145
|
+
# User does not posses the required role to perform the database operation.
|
146
|
+
ROLE_VIOLATION = 81
|
147
|
+
|
148
|
+
# A user defined function returned an error code.
|
149
|
+
UDF_BAD_RESPONSE = 100
|
150
|
+
|
151
|
+
# Secondary index already exists.
|
152
|
+
INDEX_FOUND = 200
|
153
|
+
|
154
|
+
# Requested secondary index does not exist.
|
155
|
+
INDEX_NOTFOUND = 201
|
156
|
+
|
157
|
+
# Secondary index memory space exceeded.
|
158
|
+
INDEX_OOM = 202
|
159
|
+
|
160
|
+
# Secondary index not available.
|
161
|
+
INDEX_NOTREADABLE = 203
|
162
|
+
|
163
|
+
# Generic secondary index error.
|
164
|
+
INDEX_GENERIC = 204
|
165
|
+
|
166
|
+
# Index name maximum length exceeded.
|
167
|
+
INDEX_NAME_MAXLEN = 205
|
168
|
+
|
169
|
+
# Maximum number of indicies exceeded.
|
170
|
+
INDEX_MAXCOUNT = 206
|
171
|
+
|
172
|
+
# Secondary index query aborted.
|
173
|
+
QUERY_ABORTED = 210
|
174
|
+
|
175
|
+
# Secondary index queue full.
|
176
|
+
QUERY_QUEUEFULL = 211
|
177
|
+
|
178
|
+
# Secondary index query timed out on server.
|
179
|
+
QUERY_TIMEOUT = 212
|
180
|
+
|
181
|
+
# Generic query error.
|
182
|
+
QUERY_GENERIC = 213
|
183
|
+
|
184
|
+
def self.message(code)
|
185
|
+
case code
|
186
|
+
when COMMAND_REJECTED
|
187
|
+
"Command rejected"
|
188
|
+
|
189
|
+
when QUERY_TERMINATED
|
190
|
+
"Query terminated"
|
191
|
+
|
192
|
+
when SCAN_TERMINATED
|
193
|
+
"Scan terminated"
|
194
|
+
|
195
|
+
when INVALID_NODE_ERROR
|
196
|
+
"Invalid node"
|
197
|
+
|
198
|
+
when PARSE_ERROR
|
199
|
+
"Parse error"
|
200
|
+
|
201
|
+
when SERIALIZE_ERROR
|
202
|
+
"Serialize error"
|
203
|
+
|
204
|
+
when OK
|
205
|
+
"ok"
|
206
|
+
|
207
|
+
when SERVER_ERROR
|
208
|
+
"Server error"
|
209
|
+
|
210
|
+
when KEY_NOT_FOUND_ERROR
|
211
|
+
"Key not found"
|
212
|
+
|
213
|
+
when GENERATION_ERROR
|
214
|
+
"Generation error"
|
215
|
+
|
216
|
+
when PARAMETER_ERROR
|
217
|
+
"Parameter error"
|
218
|
+
|
219
|
+
when KEY_EXISTS_ERROR
|
220
|
+
"Key already exists"
|
221
|
+
|
222
|
+
when BIN_EXISTS_ERROR
|
223
|
+
"Bin already exists"
|
224
|
+
|
225
|
+
when CLUSTER_KEY_MISMATCH
|
226
|
+
"Cluster key mismatch"
|
227
|
+
|
228
|
+
when SERVER_MEM_ERROR
|
229
|
+
"Server memory error"
|
230
|
+
|
231
|
+
when TIMEOUT
|
232
|
+
"Timeout"
|
233
|
+
|
234
|
+
when NO_XDS
|
235
|
+
"XDS not available"
|
236
|
+
|
237
|
+
when SERVER_NOT_AVAILABLE
|
238
|
+
"Server not available"
|
239
|
+
|
240
|
+
when BIN_TYPE_ERROR
|
241
|
+
"Bin type error"
|
242
|
+
|
243
|
+
when RECORD_TOO_BIG
|
244
|
+
"Record too big"
|
245
|
+
|
246
|
+
when KEY_BUSY
|
247
|
+
"Hot key"
|
248
|
+
|
249
|
+
when SCAN_ABORT
|
250
|
+
"Scan aborted"
|
251
|
+
|
252
|
+
when UNSUPPORTED_FEATURE
|
253
|
+
"Unsupported Server Feature"
|
254
|
+
|
255
|
+
when BIN_NOT_FOUND
|
256
|
+
"Bin not found"
|
257
|
+
|
258
|
+
when DEVICE_OVERLOAD
|
259
|
+
"Device overload"
|
260
|
+
|
261
|
+
when KEY_MISMATCH
|
262
|
+
"Key mismatch"
|
263
|
+
|
264
|
+
when QUERY_END
|
265
|
+
"Query end"
|
266
|
+
|
267
|
+
when SECURITY_NOT_SUPPORTED
|
268
|
+
"Security not supported"
|
269
|
+
|
270
|
+
when SECURITY_NOT_ENABLED
|
271
|
+
"Security not enabled"
|
272
|
+
|
273
|
+
when SECURITY_SCHEME_NOT_SUPPORTED
|
274
|
+
"Security scheme not supported"
|
275
|
+
|
276
|
+
when INVALID_COMMAND
|
277
|
+
"Invalid command"
|
278
|
+
|
279
|
+
when INVALID_FIELD
|
280
|
+
"Invalid field"
|
281
|
+
|
282
|
+
when ILLEGAL_STATE
|
283
|
+
"Illegal state"
|
284
|
+
|
285
|
+
when INVALID_USER
|
286
|
+
"Invalid user"
|
287
|
+
|
288
|
+
when USER_ALREADY_EXISTS
|
289
|
+
"User already exists"
|
290
|
+
|
291
|
+
when INVALID_PASSWORD
|
292
|
+
"Invalid password"
|
293
|
+
|
294
|
+
when INVALID_CREDENTIAL
|
295
|
+
"Invalid credential"
|
296
|
+
|
297
|
+
when INVALID_ROLE
|
298
|
+
"Invalid role"
|
299
|
+
|
300
|
+
when INVALID_PRIVILEGE
|
301
|
+
"Invalid privilege"
|
302
|
+
|
303
|
+
when NOT_AUTHENTICATED
|
304
|
+
"Not authenticated"
|
305
|
+
|
306
|
+
when ROLE_VIOLATION
|
307
|
+
"Role violation"
|
308
|
+
|
309
|
+
when UDF_BAD_RESPONSE
|
310
|
+
"UDF d error"
|
311
|
+
|
312
|
+
when INDEX_FOUND
|
313
|
+
"Index already exists"
|
314
|
+
|
315
|
+
when INDEX_NOTFOUND
|
316
|
+
"Index not found"
|
317
|
+
|
318
|
+
when INDEX_OOM
|
319
|
+
"Index out of memory"
|
320
|
+
|
321
|
+
when INDEX_NOTREADABLE
|
322
|
+
"Index not readable"
|
323
|
+
|
324
|
+
when INDEX_GENERIC
|
325
|
+
"Index error"
|
326
|
+
|
327
|
+
when INDEX_NAME_MAXLEN
|
328
|
+
"Index name max length exceeded"
|
329
|
+
|
330
|
+
when INDEX_MAXCOUNT
|
331
|
+
"Index count exceeds max"
|
332
|
+
|
333
|
+
when QUERY_ABORTED
|
334
|
+
"Query aborted"
|
335
|
+
|
336
|
+
when QUERY_QUEUEFULL
|
337
|
+
"Query queue full"
|
338
|
+
|
339
|
+
when QUERY_TIMEOUT
|
340
|
+
"Query timeout"
|
341
|
+
|
342
|
+
when QUERY_GENERIC
|
343
|
+
"Query error"
|
344
|
+
|
345
|
+
else
|
346
|
+
"ResultCode #{code} unknown in the client. Please file a github issue."
|
347
|
+
end # case
|
348
|
+
|
349
|
+
end
|
350
|
+
|
351
|
+
end # class
|
352
|
+
|
353
|
+
end # module
|