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,30 @@
|
|
|
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 EventResponse < ResultResponse
|
|
22
|
+
# @private
|
|
23
|
+
RESPONSE_TYPES[0x0c] = self
|
|
24
|
+
# @private
|
|
25
|
+
EVENT_TYPES = {
|
|
26
|
+
# populated by subclasses
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
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 FunctionFailureErrorResponse < ErrorResponse
|
|
22
|
+
attr_reader :keyspace, :name, :signature
|
|
23
|
+
|
|
24
|
+
def initialize(custom_payload, warnings, code, message, keyspace, name, signature)
|
|
25
|
+
super(custom_payload, warnings, code, message)
|
|
26
|
+
|
|
27
|
+
@keyspace = keyspace
|
|
28
|
+
@name = name
|
|
29
|
+
@signature = signature
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def to_error(keyspace, statement, options, hosts, consistency, retries)
|
|
33
|
+
Errors::FunctionCallError.new(@message,
|
|
34
|
+
@custom_payload,
|
|
35
|
+
@warnings,
|
|
36
|
+
keyspace,
|
|
37
|
+
statement,
|
|
38
|
+
options,
|
|
39
|
+
hosts,
|
|
40
|
+
consistency,
|
|
41
|
+
retries,
|
|
42
|
+
@keyspace,
|
|
43
|
+
@name,
|
|
44
|
+
@signature)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def to_s
|
|
48
|
+
"#{super} #{@keyspace} #{@name} #{@signature}"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
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 PreparedResultResponse < ResultResponse
|
|
22
|
+
# @private
|
|
23
|
+
RESULT_TYPES[0x04] = self
|
|
24
|
+
|
|
25
|
+
attr_reader :id, :metadata, :result_metadata, :pk_idx
|
|
26
|
+
|
|
27
|
+
def initialize(custom_payload,
|
|
28
|
+
warnings,
|
|
29
|
+
id,
|
|
30
|
+
metadata,
|
|
31
|
+
result_metadata,
|
|
32
|
+
pk_idx,
|
|
33
|
+
trace_id)
|
|
34
|
+
super(custom_payload, warnings, trace_id)
|
|
35
|
+
@id = id
|
|
36
|
+
@metadata = metadata
|
|
37
|
+
@result_metadata = result_metadata
|
|
38
|
+
@pk_idx = pk_idx
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def eql?(other)
|
|
42
|
+
id == other.id && metadata == other.metadata && trace_id == other.trace_id
|
|
43
|
+
end
|
|
44
|
+
alias == eql?
|
|
45
|
+
|
|
46
|
+
def hash
|
|
47
|
+
@h ||= begin
|
|
48
|
+
h = 17
|
|
49
|
+
h = 31 * h + @id.hash
|
|
50
|
+
h = 31 * h + @metadata.hash
|
|
51
|
+
h = 31 * h + @trace_id.hash
|
|
52
|
+
h
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def to_s
|
|
57
|
+
hex_id = @id.each_byte.map { |x| x.to_s(16).rjust(2, '0') }.join('')
|
|
58
|
+
%(RESULT PREPARED #{hex_id} #{@metadata})
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
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 RawRowsResultResponse < RowsResultResponse
|
|
22
|
+
def initialize(custom_payload,
|
|
23
|
+
warnings,
|
|
24
|
+
protocol_version,
|
|
25
|
+
raw_rows,
|
|
26
|
+
paging_state,
|
|
27
|
+
trace_id,
|
|
28
|
+
custom_type_handlers = nil)
|
|
29
|
+
super(custom_payload, warnings, nil, nil, paging_state, trace_id)
|
|
30
|
+
@protocol_version = protocol_version
|
|
31
|
+
@raw_rows = raw_rows
|
|
32
|
+
@custom_type_handlers = custom_type_handlers
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def materialize(metadata)
|
|
36
|
+
@metadata = metadata
|
|
37
|
+
|
|
38
|
+
@rows = if @protocol_version == 4
|
|
39
|
+
Coder.read_values_v4(@raw_rows, @metadata, @custom_type_handlers)
|
|
40
|
+
elsif @protocol_version == 3
|
|
41
|
+
Coder.read_values_v3(@raw_rows, @metadata)
|
|
42
|
+
else
|
|
43
|
+
Coder.read_values_v1(@raw_rows, @metadata)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
@rows
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def rows
|
|
50
|
+
raise Errors::DecodingError, 'Not materialized!' unless @rows
|
|
51
|
+
@rows
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def to_s
|
|
55
|
+
%(RESULT ROWS (raw))
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
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 ReadFailureErrorResponse < ErrorResponse
|
|
22
|
+
attr_reader :consistency, :received, :blockfor, :numfailures, :data_present, :failures_by_node
|
|
23
|
+
|
|
24
|
+
def initialize(custom_payload,
|
|
25
|
+
warnings,
|
|
26
|
+
code,
|
|
27
|
+
message,
|
|
28
|
+
consistency,
|
|
29
|
+
received,
|
|
30
|
+
blockfor,
|
|
31
|
+
numfailures,
|
|
32
|
+
data_present,
|
|
33
|
+
failures_by_node)
|
|
34
|
+
super(custom_payload, warnings, code, message)
|
|
35
|
+
|
|
36
|
+
@consistency = consistency
|
|
37
|
+
@received = received
|
|
38
|
+
@blockfor = blockfor
|
|
39
|
+
@data_present = data_present
|
|
40
|
+
@failures_by_node = failures_by_node
|
|
41
|
+
|
|
42
|
+
# If failures_by_node is set, numfailures isn't, and v.v. Set @numfailures to the size of the failure-map
|
|
43
|
+
# if numfailures is nil.
|
|
44
|
+
@numfailures = numfailures || @failures_by_node.size
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def to_error(keyspace, statement, options, hosts, consistency, retries)
|
|
48
|
+
Errors::ReadError.new(@message,
|
|
49
|
+
@custom_payload,
|
|
50
|
+
@warnings,
|
|
51
|
+
keyspace,
|
|
52
|
+
statement,
|
|
53
|
+
options,
|
|
54
|
+
hosts,
|
|
55
|
+
consistency,
|
|
56
|
+
retries,
|
|
57
|
+
@data_present,
|
|
58
|
+
@consistency,
|
|
59
|
+
@blockfor,
|
|
60
|
+
@numfailures,
|
|
61
|
+
@received,
|
|
62
|
+
@failures_by_node)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def to_s
|
|
66
|
+
"#{super} #{@consistency} #{@received} #{@blockfor} #{@numfailures} " \
|
|
67
|
+
"#{@data_present}"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
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 ReadTimeoutErrorResponse < ErrorResponse
|
|
22
|
+
attr_reader :consistency, :received, :blockfor, :data_present
|
|
23
|
+
|
|
24
|
+
def initialize(custom_payload,
|
|
25
|
+
warnings,
|
|
26
|
+
code,
|
|
27
|
+
message,
|
|
28
|
+
consistency,
|
|
29
|
+
received,
|
|
30
|
+
blockfor,
|
|
31
|
+
data_present)
|
|
32
|
+
super(custom_payload, warnings, code, message)
|
|
33
|
+
|
|
34
|
+
@consistency = consistency
|
|
35
|
+
@received = received
|
|
36
|
+
@blockfor = blockfor
|
|
37
|
+
@data_present = data_present
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def to_error(keyspace, statement, options, hosts, consistency, retries)
|
|
41
|
+
Errors::ReadTimeoutError.new(@message,
|
|
42
|
+
@custom_payload,
|
|
43
|
+
@warnings,
|
|
44
|
+
keyspace,
|
|
45
|
+
statement,
|
|
46
|
+
options,
|
|
47
|
+
hosts,
|
|
48
|
+
consistency,
|
|
49
|
+
retries,
|
|
50
|
+
@data_present,
|
|
51
|
+
@consistency,
|
|
52
|
+
@blockfor,
|
|
53
|
+
@received)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def to_s
|
|
57
|
+
"#{super} #{@consistency} #{@received} #{@blockfor} #{@data_present}"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
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 ReadyResponse < Response
|
|
22
|
+
# @private
|
|
23
|
+
RESPONSE_TYPES[0x02] = self
|
|
24
|
+
|
|
25
|
+
def eql?(rs)
|
|
26
|
+
rs.is_a?(self.class)
|
|
27
|
+
end
|
|
28
|
+
alias == eql?
|
|
29
|
+
|
|
30
|
+
def hash
|
|
31
|
+
@h ||= begin
|
|
32
|
+
h = 17
|
|
33
|
+
h = 31 * h + 'READY'.hash
|
|
34
|
+
h
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def to_s
|
|
39
|
+
'READY'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
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 ResultResponse < Response
|
|
22
|
+
# @private
|
|
23
|
+
RESPONSE_TYPES[0x08] = self
|
|
24
|
+
# @private
|
|
25
|
+
RESULT_TYPES = [
|
|
26
|
+
# populated by subclasses
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
attr_reader :custom_payload, :warnings, :trace_id
|
|
30
|
+
|
|
31
|
+
def initialize(custom_payload, warnings, trace_id)
|
|
32
|
+
@custom_payload = custom_payload
|
|
33
|
+
@warnings = warnings
|
|
34
|
+
@trace_id = trace_id
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def void?
|
|
38
|
+
false
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
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 RowsResultResponse < ResultResponse
|
|
22
|
+
# @private
|
|
23
|
+
RESULT_TYPES[0x02] = self
|
|
24
|
+
|
|
25
|
+
attr_reader :rows, :metadata, :paging_state
|
|
26
|
+
|
|
27
|
+
def initialize(custom_payload, warnings, rows, metadata, paging_state, trace_id)
|
|
28
|
+
super(custom_payload, warnings, trace_id)
|
|
29
|
+
@rows = rows
|
|
30
|
+
@metadata = metadata
|
|
31
|
+
@paging_state = paging_state
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def to_s
|
|
35
|
+
%(RESULT ROWS #{@metadata} #{@rows})
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|