yugabyte-ycql-driver 3.2.3.1
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 +7 -0
- data/.yardopts +13 -0
- data/README.md +242 -0
- data/ext/cassandra_murmur3/cassandra_murmur3.c +178 -0
- data/ext/cassandra_murmur3/extconf.rb +2 -0
- data/lib/cassandra/address_resolution.rb +36 -0
- data/lib/cassandra/address_resolution/policies.rb +2 -0
- data/lib/cassandra/address_resolution/policies/ec2_multi_region.rb +56 -0
- data/lib/cassandra/address_resolution/policies/none.rb +35 -0
- data/lib/cassandra/aggregate.rb +123 -0
- data/lib/cassandra/argument.rb +51 -0
- data/lib/cassandra/attr_boolean.rb +33 -0
- data/lib/cassandra/auth.rb +100 -0
- data/lib/cassandra/auth/providers.rb +17 -0
- data/lib/cassandra/auth/providers/password.rb +65 -0
- data/lib/cassandra/cassandra_logger.rb +80 -0
- data/lib/cassandra/cluster.rb +331 -0
- data/lib/cassandra/cluster/client.rb +1612 -0
- data/lib/cassandra/cluster/connection_pool.rb +78 -0
- data/lib/cassandra/cluster/connector.rb +372 -0
- data/lib/cassandra/cluster/control_connection.rb +962 -0
- data/lib/cassandra/cluster/failed_connection.rb +35 -0
- data/lib/cassandra/cluster/metadata.rb +142 -0
- data/lib/cassandra/cluster/options.rb +145 -0
- data/lib/cassandra/cluster/registry.rb +284 -0
- data/lib/cassandra/cluster/schema.rb +405 -0
- data/lib/cassandra/cluster/schema/cql_type_parser.rb +112 -0
- data/lib/cassandra/cluster/schema/fetchers.rb +1627 -0
- data/lib/cassandra/cluster/schema/fqcn_type_parser.rb +175 -0
- data/lib/cassandra/cluster/schema/partitioners.rb +21 -0
- data/lib/cassandra/cluster/schema/partitioners/murmur3.rb +45 -0
- data/lib/cassandra/cluster/schema/partitioners/ordered.rb +37 -0
- data/lib/cassandra/cluster/schema/partitioners/random.rb +37 -0
- data/lib/cassandra/cluster/schema/replication_strategies.rb +21 -0
- data/lib/cassandra/cluster/schema/replication_strategies/network_topology.rb +102 -0
- data/lib/cassandra/cluster/schema/replication_strategies/none.rb +39 -0
- data/lib/cassandra/cluster/schema/replication_strategies/simple.rb +44 -0
- data/lib/cassandra/column.rb +66 -0
- data/lib/cassandra/column_container.rb +326 -0
- data/lib/cassandra/compression.rb +69 -0
- data/lib/cassandra/compression/compressors/lz4.rb +73 -0
- data/lib/cassandra/compression/compressors/snappy.rb +69 -0
- data/lib/cassandra/custom_data.rb +53 -0
- data/lib/cassandra/driver.rb +260 -0
- data/lib/cassandra/errors.rb +784 -0
- data/lib/cassandra/execution/info.rb +69 -0
- data/lib/cassandra/execution/options.rb +267 -0
- data/lib/cassandra/execution/profile.rb +153 -0
- data/lib/cassandra/execution/profile_manager.rb +71 -0
- data/lib/cassandra/execution/trace.rb +192 -0
- data/lib/cassandra/executors.rb +113 -0
- data/lib/cassandra/function.rb +156 -0
- data/lib/cassandra/function_collection.rb +85 -0
- data/lib/cassandra/future.rb +794 -0
- data/lib/cassandra/host.rb +102 -0
- data/lib/cassandra/index.rb +118 -0
- data/lib/cassandra/keyspace.rb +473 -0
- data/lib/cassandra/listener.rb +87 -0
- data/lib/cassandra/load_balancing.rb +121 -0
- data/lib/cassandra/load_balancing/policies.rb +20 -0
- data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +172 -0
- data/lib/cassandra/load_balancing/policies/round_robin.rb +141 -0
- data/lib/cassandra/load_balancing/policies/token_aware.rb +149 -0
- data/lib/cassandra/load_balancing/policies/white_list.rb +100 -0
- data/lib/cassandra/materialized_view.rb +92 -0
- data/lib/cassandra/null_logger.rb +56 -0
- data/lib/cassandra/protocol.rb +102 -0
- data/lib/cassandra/protocol/coder.rb +1085 -0
- data/lib/cassandra/protocol/cql_byte_buffer.rb +418 -0
- data/lib/cassandra/protocol/cql_protocol_handler.rb +448 -0
- data/lib/cassandra/protocol/request.rb +41 -0
- data/lib/cassandra/protocol/requests/auth_response_request.rb +51 -0
- data/lib/cassandra/protocol/requests/batch_request.rb +117 -0
- data/lib/cassandra/protocol/requests/credentials_request.rb +51 -0
- data/lib/cassandra/protocol/requests/execute_request.rb +122 -0
- data/lib/cassandra/protocol/requests/options_request.rb +39 -0
- data/lib/cassandra/protocol/requests/prepare_request.rb +59 -0
- data/lib/cassandra/protocol/requests/query_request.rb +112 -0
- data/lib/cassandra/protocol/requests/register_request.rb +38 -0
- data/lib/cassandra/protocol/requests/startup_request.rb +49 -0
- data/lib/cassandra/protocol/requests/void_query_request.rb +24 -0
- data/lib/cassandra/protocol/response.rb +28 -0
- data/lib/cassandra/protocol/responses/already_exists_error_response.rb +50 -0
- data/lib/cassandra/protocol/responses/auth_challenge_response.rb +36 -0
- data/lib/cassandra/protocol/responses/auth_success_response.rb +36 -0
- data/lib/cassandra/protocol/responses/authenticate_response.rb +36 -0
- data/lib/cassandra/protocol/responses/error_response.rb +142 -0
- data/lib/cassandra/protocol/responses/event_response.rb +30 -0
- data/lib/cassandra/protocol/responses/function_failure_error_response.rb +52 -0
- data/lib/cassandra/protocol/responses/prepared_result_response.rb +62 -0
- data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +59 -0
- data/lib/cassandra/protocol/responses/read_failure_error_response.rb +71 -0
- data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +61 -0
- data/lib/cassandra/protocol/responses/ready_response.rb +43 -0
- data/lib/cassandra/protocol/responses/result_response.rb +42 -0
- data/lib/cassandra/protocol/responses/rows_result_response.rb +39 -0
- data/lib/cassandra/protocol/responses/schema_change_event_response.rb +73 -0
- data/lib/cassandra/protocol/responses/schema_change_result_response.rb +70 -0
- data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +37 -0
- data/lib/cassandra/protocol/responses/status_change_event_response.rb +39 -0
- data/lib/cassandra/protocol/responses/supported_response.rb +36 -0
- data/lib/cassandra/protocol/responses/topology_change_event_response.rb +33 -0
- data/lib/cassandra/protocol/responses/unavailable_error_response.rb +58 -0
- data/lib/cassandra/protocol/responses/unprepared_error_response.rb +48 -0
- data/lib/cassandra/protocol/responses/void_result_response.rb +34 -0
- data/lib/cassandra/protocol/responses/write_failure_error_response.rb +73 -0
- data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +63 -0
- data/lib/cassandra/protocol/v1.rb +326 -0
- data/lib/cassandra/protocol/v3.rb +358 -0
- data/lib/cassandra/protocol/v4.rb +478 -0
- data/lib/cassandra/reconnection.rb +49 -0
- data/lib/cassandra/reconnection/policies.rb +20 -0
- data/lib/cassandra/reconnection/policies/constant.rb +46 -0
- data/lib/cassandra/reconnection/policies/exponential.rb +79 -0
- data/lib/cassandra/result.rb +276 -0
- data/lib/cassandra/retry.rb +154 -0
- data/lib/cassandra/retry/policies.rb +21 -0
- data/lib/cassandra/retry/policies/default.rb +53 -0
- data/lib/cassandra/retry/policies/downgrading_consistency.rb +73 -0
- data/lib/cassandra/retry/policies/fallthrough.rb +39 -0
- data/lib/cassandra/session.rb +270 -0
- data/lib/cassandra/statement.rb +32 -0
- data/lib/cassandra/statements.rb +23 -0
- data/lib/cassandra/statements/batch.rb +146 -0
- data/lib/cassandra/statements/bound.rb +65 -0
- data/lib/cassandra/statements/prepared.rb +235 -0
- data/lib/cassandra/statements/simple.rb +118 -0
- data/lib/cassandra/statements/void.rb +38 -0
- data/lib/cassandra/table.rb +240 -0
- data/lib/cassandra/time.rb +103 -0
- data/lib/cassandra/time_uuid.rb +78 -0
- data/lib/cassandra/timestamp_generator.rb +37 -0
- data/lib/cassandra/timestamp_generator/simple.rb +38 -0
- data/lib/cassandra/timestamp_generator/ticking_on_duplicate.rb +58 -0
- data/lib/cassandra/trigger.rb +67 -0
- data/lib/cassandra/tuple.rb +131 -0
- data/lib/cassandra/types.rb +1704 -0
- data/lib/cassandra/udt.rb +443 -0
- data/lib/cassandra/util.rb +464 -0
- data/lib/cassandra/uuid.rb +110 -0
- data/lib/cassandra/uuid/generator.rb +212 -0
- data/lib/cassandra/version.rb +21 -0
- data/lib/datastax/cassandra.rb +47 -0
- data/lib/ycql.rb +842 -0
- metadata +243 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class QueryRequest < Request
|
|
22
|
+
attr_reader :cql, :page_size, :paging_state, :payload, :serial_consistency,
|
|
23
|
+
:timestamp, :type_hints, :values
|
|
24
|
+
attr_accessor :consistency, :retries
|
|
25
|
+
|
|
26
|
+
def initialize(cql,
|
|
27
|
+
values,
|
|
28
|
+
type_hints,
|
|
29
|
+
consistency,
|
|
30
|
+
serial_consistency = nil,
|
|
31
|
+
page_size = nil,
|
|
32
|
+
paging_state = nil,
|
|
33
|
+
trace = false,
|
|
34
|
+
names = EMPTY_LIST,
|
|
35
|
+
timestamp = nil,
|
|
36
|
+
payload = nil)
|
|
37
|
+
super(7, trace)
|
|
38
|
+
@cql = cql
|
|
39
|
+
@values = values
|
|
40
|
+
@type_hints = type_hints
|
|
41
|
+
@consistency = consistency
|
|
42
|
+
@serial_consistency = serial_consistency
|
|
43
|
+
@page_size = page_size
|
|
44
|
+
@paging_state = paging_state
|
|
45
|
+
@names = names
|
|
46
|
+
@timestamp = timestamp
|
|
47
|
+
@payload = payload
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def payload?
|
|
51
|
+
!!@payload
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def write(buffer, protocol_version, encoder)
|
|
55
|
+
buffer.append_long_string(@cql)
|
|
56
|
+
buffer.append_consistency(@consistency)
|
|
57
|
+
if protocol_version > 1
|
|
58
|
+
flags = 0
|
|
59
|
+
flags |= 0x04 if @page_size
|
|
60
|
+
flags |= 0x08 if @paging_state
|
|
61
|
+
flags |= 0x10 if @serial_consistency
|
|
62
|
+
flags |= 0x20 if protocol_version > 2 && @timestamp
|
|
63
|
+
if @values && !@values.empty?
|
|
64
|
+
flags |= 0x01
|
|
65
|
+
flags |= 0x40 if protocol_version > 2 && !@names.empty?
|
|
66
|
+
buffer.append(flags.chr)
|
|
67
|
+
encoder.write_parameters(buffer, @values, @type_hints, @names)
|
|
68
|
+
else
|
|
69
|
+
buffer.append(flags.chr)
|
|
70
|
+
end
|
|
71
|
+
buffer.append_int(@page_size) if @page_size
|
|
72
|
+
buffer.append_bytes(@paging_state) if @paging_state
|
|
73
|
+
buffer.append_consistency(@serial_consistency) if @serial_consistency
|
|
74
|
+
buffer.append_long(@timestamp) if protocol_version > 2 && @timestamp
|
|
75
|
+
end
|
|
76
|
+
buffer
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def to_s
|
|
80
|
+
%(QUERY "#{@cql}" #{@consistency.to_s.upcase})
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def eql?(rq)
|
|
84
|
+
rq.is_a?(self.class) &&
|
|
85
|
+
rq.cql == cql &&
|
|
86
|
+
rq.values == values &&
|
|
87
|
+
rq.type_hints == type_hints &&
|
|
88
|
+
rq.consistency == consistency &&
|
|
89
|
+
rq.serial_consistency == serial_consistency &&
|
|
90
|
+
rq.page_size == page_size &&
|
|
91
|
+
rq.paging_state == paging_state
|
|
92
|
+
end
|
|
93
|
+
alias == eql?
|
|
94
|
+
|
|
95
|
+
def hash
|
|
96
|
+
@h ||= begin
|
|
97
|
+
h = 17
|
|
98
|
+
h = 31 * h + @cql.hash
|
|
99
|
+
h = 31 * h + @values.hash
|
|
100
|
+
h = 31 * h + @type_hints.hash
|
|
101
|
+
h = 31 * h + @consistency.hash
|
|
102
|
+
h = 31 * h + @serial_consistency.hash
|
|
103
|
+
h = 31 * h + @page_size.hash
|
|
104
|
+
h = 31 * h + @paging_state.hash
|
|
105
|
+
h = 31 * h + @names.hash
|
|
106
|
+
h = 31 * h + @timestamp.hash
|
|
107
|
+
h
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class RegisterRequest < Request
|
|
22
|
+
attr_reader :events
|
|
23
|
+
|
|
24
|
+
def initialize(*events)
|
|
25
|
+
super(11)
|
|
26
|
+
@events = events
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def write(buffer, protocol_version, encoder)
|
|
30
|
+
buffer.append_string_list(@events)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def to_s
|
|
34
|
+
%(REGISTER #{@events})
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class StartupRequest < Request
|
|
22
|
+
# @private
|
|
23
|
+
CQL_VERSION = 'CQL_VERSION'.freeze
|
|
24
|
+
# @private
|
|
25
|
+
COMPRESSION = 'COMPRESSION'.freeze
|
|
26
|
+
|
|
27
|
+
attr_reader :options
|
|
28
|
+
|
|
29
|
+
def initialize(cql_version, compression = nil)
|
|
30
|
+
super(1)
|
|
31
|
+
raise ArgumentError, "Invalid CQL version: #{cql_version.inspect}" unless cql_version
|
|
32
|
+
@options = {CQL_VERSION => cql_version}
|
|
33
|
+
@options[COMPRESSION] = compression if compression
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def compressable?
|
|
37
|
+
false
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def write(buffer, protocol_version, encoder)
|
|
41
|
+
buffer.append_string_map(@options)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def to_s
|
|
45
|
+
%(STARTUP #{@options})
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class VoidQueryRequest
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class Response
|
|
22
|
+
# @private
|
|
23
|
+
RESPONSE_TYPES = [
|
|
24
|
+
# populated by subclasses
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class AlreadyExistsErrorResponse < ErrorResponse
|
|
22
|
+
attr_reader :keyspace, :table
|
|
23
|
+
|
|
24
|
+
def initialize(custom_payload, warnings, code, message, keyspace, table)
|
|
25
|
+
super(custom_payload, warnings, code, message)
|
|
26
|
+
|
|
27
|
+
@keyspace = keyspace
|
|
28
|
+
@table = table
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def to_error(keyspace, statement, options, hosts, consistency, retries)
|
|
32
|
+
Errors::AlreadyExistsError.new(@message,
|
|
33
|
+
@custom_payload,
|
|
34
|
+
@warnings,
|
|
35
|
+
keyspace,
|
|
36
|
+
statement,
|
|
37
|
+
options,
|
|
38
|
+
hosts,
|
|
39
|
+
consistency,
|
|
40
|
+
retries,
|
|
41
|
+
@keyspace,
|
|
42
|
+
@table)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def to_s
|
|
46
|
+
"#{super} #{@keyspace} #{@table}"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class AuthChallengeResponse < Response
|
|
22
|
+
# @private
|
|
23
|
+
RESPONSE_TYPES[0x0e] = self
|
|
24
|
+
|
|
25
|
+
attr_reader :token
|
|
26
|
+
|
|
27
|
+
def initialize(token)
|
|
28
|
+
@token = token
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def to_s
|
|
32
|
+
%(AUTH_CHALLENGE #{@token.bytesize})
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class AuthSuccessResponse < Response
|
|
22
|
+
# @private
|
|
23
|
+
RESPONSE_TYPES[0x10] = self
|
|
24
|
+
|
|
25
|
+
attr_reader :token
|
|
26
|
+
|
|
27
|
+
def initialize(token)
|
|
28
|
+
@token = token
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def to_s
|
|
32
|
+
%(AUTH_SUCCESS #{@token && @token.bytesize})
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class AuthenticateResponse < Response
|
|
22
|
+
# @private
|
|
23
|
+
RESPONSE_TYPES[0x03] = self
|
|
24
|
+
|
|
25
|
+
attr_reader :authentication_class
|
|
26
|
+
|
|
27
|
+
def initialize(authentication_class)
|
|
28
|
+
@authentication_class = authentication_class
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def to_s
|
|
32
|
+
%(AUTHENTICATE #{authentication_class})
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright DataStax, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#++
|
|
18
|
+
|
|
19
|
+
module Cassandra
|
|
20
|
+
module Protocol
|
|
21
|
+
class ErrorResponse < Response
|
|
22
|
+
# @private
|
|
23
|
+
RESPONSE_TYPES[0x00] = self
|
|
24
|
+
|
|
25
|
+
attr_reader :code, :message, :custom_payload, :warnings
|
|
26
|
+
|
|
27
|
+
def initialize(*args)
|
|
28
|
+
@custom_payload, @warnings, @code, @message = args
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def to_s
|
|
32
|
+
hex_code = @code.to_s(16).rjust(4, '0').upcase
|
|
33
|
+
%(ERROR 0x#{hex_code} "#{@message}")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_error(keyspace, statement, options, hosts, consistency, retries)
|
|
37
|
+
case @code
|
|
38
|
+
when 0x0000 then Errors::ServerError.new(@message,
|
|
39
|
+
@custom_payload,
|
|
40
|
+
@warnings,
|
|
41
|
+
keyspace,
|
|
42
|
+
statement,
|
|
43
|
+
options,
|
|
44
|
+
hosts,
|
|
45
|
+
consistency,
|
|
46
|
+
retries)
|
|
47
|
+
when 0x000A then Errors::ProtocolError.new(@message,
|
|
48
|
+
@custom_payload,
|
|
49
|
+
@warnings,
|
|
50
|
+
keyspace,
|
|
51
|
+
statement,
|
|
52
|
+
options,
|
|
53
|
+
hosts,
|
|
54
|
+
consistency,
|
|
55
|
+
retries)
|
|
56
|
+
when 0x0100 then Errors::AuthenticationError.new(@message,
|
|
57
|
+
@custom_payload,
|
|
58
|
+
@warnings,
|
|
59
|
+
keyspace,
|
|
60
|
+
statement,
|
|
61
|
+
options,
|
|
62
|
+
hosts,
|
|
63
|
+
consistency,
|
|
64
|
+
retries)
|
|
65
|
+
when 0x1001 then Errors::OverloadedError.new(@message,
|
|
66
|
+
@custom_payload,
|
|
67
|
+
@warnings,
|
|
68
|
+
keyspace,
|
|
69
|
+
statement,
|
|
70
|
+
options,
|
|
71
|
+
hosts,
|
|
72
|
+
consistency,
|
|
73
|
+
retries)
|
|
74
|
+
when 0x1002 then Errors::IsBootstrappingError.new(@message,
|
|
75
|
+
@custom_payload,
|
|
76
|
+
@warnings,
|
|
77
|
+
keyspace,
|
|
78
|
+
statement,
|
|
79
|
+
options,
|
|
80
|
+
hosts,
|
|
81
|
+
consistency,
|
|
82
|
+
retries)
|
|
83
|
+
when 0x1003 then Errors::TruncateError.new(@message,
|
|
84
|
+
@custom_payload,
|
|
85
|
+
@warnings,
|
|
86
|
+
keyspace,
|
|
87
|
+
statement,
|
|
88
|
+
options,
|
|
89
|
+
hosts,
|
|
90
|
+
consistency,
|
|
91
|
+
retries)
|
|
92
|
+
when 0x2000 then Errors::SyntaxError.new(@message,
|
|
93
|
+
@custom_payload,
|
|
94
|
+
@warnings,
|
|
95
|
+
keyspace,
|
|
96
|
+
statement,
|
|
97
|
+
options,
|
|
98
|
+
hosts,
|
|
99
|
+
consistency,
|
|
100
|
+
retries)
|
|
101
|
+
when 0x2100 then Errors::UnauthorizedError.new(@message,
|
|
102
|
+
@custom_payload,
|
|
103
|
+
@warnings,
|
|
104
|
+
keyspace,
|
|
105
|
+
statement,
|
|
106
|
+
options,
|
|
107
|
+
hosts,
|
|
108
|
+
consistency,
|
|
109
|
+
retries)
|
|
110
|
+
when 0x2200 then Errors::InvalidError.new(@message,
|
|
111
|
+
@custom_payload,
|
|
112
|
+
@warnings,
|
|
113
|
+
keyspace,
|
|
114
|
+
statement,
|
|
115
|
+
options,
|
|
116
|
+
hosts,
|
|
117
|
+
consistency,
|
|
118
|
+
retries)
|
|
119
|
+
when 0x2300 then Errors::ConfigurationError.new(@message,
|
|
120
|
+
@custom_payload,
|
|
121
|
+
@warnings,
|
|
122
|
+
keyspace,
|
|
123
|
+
statement,
|
|
124
|
+
options,
|
|
125
|
+
hosts,
|
|
126
|
+
consistency,
|
|
127
|
+
retries)
|
|
128
|
+
else
|
|
129
|
+
Errors::ServerError.new(@message,
|
|
130
|
+
@custom_payload,
|
|
131
|
+
@warnings,
|
|
132
|
+
keyspace,
|
|
133
|
+
statement,
|
|
134
|
+
options,
|
|
135
|
+
hosts,
|
|
136
|
+
consistency,
|
|
137
|
+
retries)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|