cassandra-driver 3.0.0.beta.1-java → 3.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +106 -39
  3. data/lib/cassandra.rb +396 -148
  4. data/lib/cassandra/address_resolution.rb +1 -1
  5. data/lib/cassandra/address_resolution/policies/ec2_multi_region.rb +1 -1
  6. data/lib/cassandra/address_resolution/policies/none.rb +1 -1
  7. data/lib/cassandra/aggregate.rb +21 -7
  8. data/lib/cassandra/argument.rb +2 -2
  9. data/lib/cassandra/attr_boolean.rb +33 -0
  10. data/lib/cassandra/auth.rb +6 -5
  11. data/lib/cassandra/auth/providers.rb +1 -1
  12. data/lib/cassandra/auth/providers/password.rb +5 -13
  13. data/lib/cassandra/cassandra_logger.rb +80 -0
  14. data/lib/cassandra/cluster.rb +49 -9
  15. data/lib/cassandra/cluster/client.rb +835 -209
  16. data/lib/cassandra/cluster/connection_pool.rb +2 -2
  17. data/lib/cassandra/cluster/connector.rb +86 -27
  18. data/lib/cassandra/cluster/control_connection.rb +222 -95
  19. data/lib/cassandra/cluster/failed_connection.rb +1 -1
  20. data/lib/cassandra/cluster/metadata.rb +14 -8
  21. data/lib/cassandra/cluster/options.rb +68 -22
  22. data/lib/cassandra/cluster/registry.rb +81 -17
  23. data/lib/cassandra/cluster/schema.rb +70 -8
  24. data/lib/cassandra/cluster/schema/cql_type_parser.rb +15 -10
  25. data/lib/cassandra/cluster/schema/fetchers.rb +601 -241
  26. data/lib/cassandra/cluster/schema/fqcn_type_parser.rb +39 -38
  27. data/lib/cassandra/cluster/schema/partitioners.rb +1 -1
  28. data/lib/cassandra/cluster/schema/partitioners/murmur3.rb +6 -8
  29. data/lib/cassandra/cluster/schema/partitioners/ordered.rb +1 -1
  30. data/lib/cassandra/cluster/schema/partitioners/random.rb +1 -1
  31. data/lib/cassandra/cluster/schema/replication_strategies.rb +1 -1
  32. data/lib/cassandra/cluster/schema/replication_strategies/network_topology.rb +19 -18
  33. data/lib/cassandra/cluster/schema/replication_strategies/none.rb +1 -1
  34. data/lib/cassandra/cluster/schema/replication_strategies/simple.rb +1 -1
  35. data/lib/cassandra/column.rb +4 -23
  36. data/lib/cassandra/column_container.rb +322 -0
  37. data/lib/cassandra/compression.rb +1 -1
  38. data/lib/cassandra/compression/compressors/lz4.rb +7 -8
  39. data/lib/cassandra/compression/compressors/snappy.rb +4 -3
  40. data/lib/cassandra/driver.rb +107 -46
  41. data/lib/cassandra/errors.rb +303 -52
  42. data/lib/cassandra/execution/info.rb +16 -5
  43. data/lib/cassandra/execution/options.rb +102 -55
  44. data/lib/cassandra/execution/trace.rb +16 -9
  45. data/lib/cassandra/executors.rb +1 -1
  46. data/lib/cassandra/function.rb +19 -13
  47. data/lib/cassandra/function_collection.rb +85 -0
  48. data/lib/cassandra/future.rb +101 -49
  49. data/lib/cassandra/host.rb +25 -5
  50. data/lib/cassandra/index.rb +118 -0
  51. data/lib/cassandra/keyspace.rb +169 -33
  52. data/lib/cassandra/listener.rb +1 -1
  53. data/lib/cassandra/load_balancing.rb +2 -2
  54. data/lib/cassandra/load_balancing/policies.rb +1 -1
  55. data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +39 -25
  56. data/lib/cassandra/load_balancing/policies/round_robin.rb +8 -1
  57. data/lib/cassandra/load_balancing/policies/token_aware.rb +22 -13
  58. data/lib/cassandra/load_balancing/policies/white_list.rb +18 -5
  59. data/lib/cassandra/materialized_view.rb +90 -0
  60. data/lib/cassandra/null_logger.rb +27 -6
  61. data/lib/cassandra/protocol.rb +1 -1
  62. data/lib/cassandra/protocol/coder.rb +81 -42
  63. data/lib/cassandra/protocol/cql_byte_buffer.rb +58 -44
  64. data/lib/cassandra/protocol/cql_protocol_handler.rb +57 -54
  65. data/lib/cassandra/protocol/request.rb +6 -7
  66. data/lib/cassandra/protocol/requests/auth_response_request.rb +3 -3
  67. data/lib/cassandra/protocol/requests/batch_request.rb +17 -8
  68. data/lib/cassandra/protocol/requests/credentials_request.rb +3 -3
  69. data/lib/cassandra/protocol/requests/execute_request.rb +39 -20
  70. data/lib/cassandra/protocol/requests/options_request.rb +1 -1
  71. data/lib/cassandra/protocol/requests/prepare_request.rb +5 -5
  72. data/lib/cassandra/protocol/requests/query_request.rb +28 -23
  73. data/lib/cassandra/protocol/requests/register_request.rb +2 -2
  74. data/lib/cassandra/protocol/requests/startup_request.rb +8 -8
  75. data/lib/cassandra/protocol/requests/void_query_request.rb +1 -1
  76. data/lib/cassandra/protocol/response.rb +3 -4
  77. data/lib/cassandra/protocol/responses/already_exists_error_response.rb +12 -2
  78. data/lib/cassandra/protocol/responses/auth_challenge_response.rb +4 -5
  79. data/lib/cassandra/protocol/responses/auth_success_response.rb +4 -5
  80. data/lib/cassandra/protocol/responses/authenticate_response.rb +4 -5
  81. data/lib/cassandra/protocol/responses/error_response.rb +104 -17
  82. data/lib/cassandra/protocol/responses/event_response.rb +3 -4
  83. data/lib/cassandra/protocol/responses/function_failure_error_response.rb +13 -2
  84. data/lib/cassandra/protocol/responses/prepared_result_response.rb +14 -9
  85. data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +14 -9
  86. data/lib/cassandra/protocol/responses/read_failure_error_response.rb +26 -4
  87. data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +22 -3
  88. data/lib/cassandra/protocol/responses/ready_response.rb +6 -7
  89. data/lib/cassandra/protocol/responses/result_response.rb +11 -10
  90. data/lib/cassandra/protocol/responses/rows_result_response.rb +8 -7
  91. data/lib/cassandra/protocol/responses/schema_change_event_response.rb +8 -8
  92. data/lib/cassandra/protocol/responses/schema_change_result_response.rb +19 -13
  93. data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +5 -6
  94. data/lib/cassandra/protocol/responses/status_change_event_response.rb +5 -6
  95. data/lib/cassandra/protocol/responses/supported_response.rb +4 -5
  96. data/lib/cassandra/protocol/responses/topology_change_event_response.rb +4 -5
  97. data/lib/cassandra/protocol/responses/unavailable_error_response.rb +20 -3
  98. data/lib/cassandra/protocol/responses/unprepared_error_response.rb +11 -2
  99. data/lib/cassandra/protocol/responses/void_result_response.rb +4 -5
  100. data/lib/cassandra/protocol/responses/write_failure_error_response.rb +26 -4
  101. data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +22 -3
  102. data/lib/cassandra/protocol/v1.rb +98 -37
  103. data/lib/cassandra/protocol/v3.rb +121 -50
  104. data/lib/cassandra/protocol/v4.rb +172 -68
  105. data/lib/cassandra/reconnection.rb +1 -1
  106. data/lib/cassandra/reconnection/policies.rb +1 -1
  107. data/lib/cassandra/reconnection/policies/constant.rb +2 -4
  108. data/lib/cassandra/reconnection/policies/exponential.rb +6 -6
  109. data/lib/cassandra/result.rb +55 -20
  110. data/lib/cassandra/retry.rb +8 -8
  111. data/lib/cassandra/retry/policies.rb +1 -1
  112. data/lib/cassandra/retry/policies/default.rb +1 -1
  113. data/lib/cassandra/retry/policies/downgrading_consistency.rb +4 -2
  114. data/lib/cassandra/retry/policies/fallthrough.rb +1 -1
  115. data/lib/cassandra/session.rb +24 -16
  116. data/lib/cassandra/statement.rb +1 -1
  117. data/lib/cassandra/statements.rb +1 -1
  118. data/lib/cassandra/statements/batch.rb +16 -10
  119. data/lib/cassandra/statements/bound.rb +10 -3
  120. data/lib/cassandra/statements/prepared.rb +62 -18
  121. data/lib/cassandra/statements/simple.rb +23 -10
  122. data/lib/cassandra/statements/void.rb +1 -1
  123. data/lib/cassandra/table.rb +53 -185
  124. data/lib/cassandra/time.rb +11 -6
  125. data/lib/cassandra/time_uuid.rb +12 -14
  126. data/lib/cassandra/timestamp_generator.rb +37 -0
  127. data/lib/cassandra/timestamp_generator/simple.rb +38 -0
  128. data/lib/cassandra/timestamp_generator/ticking_on_duplicate.rb +58 -0
  129. data/lib/cassandra/tuple.rb +4 -4
  130. data/lib/cassandra/types.rb +109 -71
  131. data/lib/cassandra/udt.rb +66 -50
  132. data/lib/cassandra/util.rb +155 -15
  133. data/lib/cassandra/uuid.rb +20 -21
  134. data/lib/cassandra/uuid/generator.rb +7 -5
  135. data/lib/cassandra/version.rb +2 -2
  136. data/lib/cassandra_murmur3.jar +0 -0
  137. data/lib/datastax/cassandra.rb +1 -1
  138. metadata +27 -16
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,17 +19,16 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class Request
22
- attr_reader :opcode, :trace
22
+ extend AttrBoolean
23
23
 
24
- def initialize(opcode, trace=false)
24
+ attr_reader :opcode
25
+ attr_boolean :trace
26
+
27
+ def initialize(opcode, trace = false)
25
28
  @opcode = opcode
26
29
  @trace = trace
27
30
  end
28
31
 
29
- def trace?
30
- @trace
31
- end
32
-
33
32
  def compressable?
34
33
  true
35
34
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -35,9 +35,9 @@ module Cassandra
35
35
  end
36
36
 
37
37
  def eql?(other)
38
- self.token == other.token
38
+ token == other.token
39
39
  end
40
- alias_method :==, :eql?
40
+ alias == eql?
41
41
 
42
42
  def hash
43
43
  @h ||= begin
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -26,7 +26,12 @@ module Cassandra
26
26
  attr_reader :type, :timestamp, :payload
27
27
  attr_accessor :consistency, :retries
28
28
 
29
- def initialize(type, consistency, trace=false, serial_consistency = nil, timestamp = nil, payload = nil)
29
+ def initialize(type,
30
+ consistency,
31
+ trace = false,
32
+ serial_consistency = nil,
33
+ timestamp = nil,
34
+ payload = nil)
30
35
  super(0x0D, trace)
31
36
  @type = type
32
37
  @parts = []
@@ -60,7 +65,11 @@ module Cassandra
60
65
  buffer.append_short(@parts.size)
61
66
 
62
67
  @parts.each do |(statement_kind, *arguments)|
63
- __send__(:"write_#{statement_kind}", buffer, protocol_version, encoder, *arguments)
68
+ __send__(:"write_#{statement_kind}",
69
+ buffer,
70
+ protocol_version,
71
+ encoder,
72
+ *arguments)
64
73
  end
65
74
 
66
75
  buffer.append_consistency(@consistency)
@@ -72,7 +81,7 @@ module Cassandra
72
81
 
73
82
  buffer.append(flags.chr)
74
83
  buffer.append_consistency(@serial_consistency) if @serial_consistency
75
- buffer.append_timestamp(@timestamp) if @timestamp
84
+ buffer.append_long(@timestamp) if @timestamp
76
85
  end
77
86
 
78
87
  buffer
@@ -80,10 +89,10 @@ module Cassandra
80
89
 
81
90
  def to_s
82
91
  type_str = case @type
83
- when LOGGED_TYPE then 'LOGGED'
84
- when UNLOGGED_TYPE then 'UNLOGGED'
85
- when COUNTER_TYPE then 'COUNTER'
86
- end
92
+ when LOGGED_TYPE then 'LOGGED'
93
+ when UNLOGGED_TYPE then 'UNLOGGED'
94
+ when COUNTER_TYPE then 'COUNTER'
95
+ end
87
96
  %(BATCH #{type_str} #{@parts.size} #{@consistency.to_s.upcase})
88
97
  end
89
98
 
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -35,9 +35,9 @@ module Cassandra
35
35
  end
36
36
 
37
37
  def eql?(rq)
38
- self.class === rq && rq.credentials.eql?(@credentials)
38
+ rq.is_a?(self.class) && rq.credentials.eql?(@credentials)
39
39
  end
40
- alias_method :==, :eql?
40
+ alias == eql?
41
41
 
42
42
  def hash
43
43
  @h ||= begin
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,13 +19,31 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class ExecuteRequest < Request
22
- attr_reader :metadata, :values, :request_metadata, :serial_consistency, :page_size, :paging_state, :timestamp, :payload
23
- attr_accessor :consistency, :retries, :id
22
+ attr_reader :metadata, :request_metadata, :page_size, :paging_state, :payload,
23
+ :serial_consistency, :timestamp, :values
24
+ attr_accessor :consistency, :id, :retries
24
25
 
25
- def initialize(id, metadata, values, request_metadata, consistency, serial_consistency=nil, page_size=nil, paging_state=nil, trace=false, timestamp = nil, payload = nil)
26
- raise ArgumentError, "Metadata for #{metadata.size} columns, but #{values.size} values given" if metadata.size != values.size
27
- raise ArgumentError, %(No such consistency: #{consistency.inspect}) if consistency.nil? || !CONSISTENCIES.include?(consistency)
28
- raise ArgumentError, %(No such consistency: #{serial_consistency.inspect}) unless serial_consistency.nil? || CONSISTENCIES.include?(serial_consistency)
26
+ def initialize(id,
27
+ metadata,
28
+ values,
29
+ request_metadata,
30
+ consistency,
31
+ serial_consistency = nil,
32
+ page_size = nil,
33
+ paging_state = nil,
34
+ trace = false,
35
+ timestamp = nil,
36
+ payload = nil)
37
+ if metadata.size != values.size
38
+ raise ArgumentError, "Metadata for #{metadata.size} columns, but " \
39
+ "#{values.size} values given"
40
+ end
41
+ if consistency.nil? || !CONSISTENCIES.include?(consistency)
42
+ raise ArgumentError, %(No such consistency: #{consistency.inspect})
43
+ end
44
+ unless serial_consistency.nil? || CONSISTENCIES.include?(serial_consistency)
45
+ raise ArgumentError, %(No such consistency: #{serial_consistency.inspect})
46
+ end
29
47
  raise ArgumentError, %(Paging state given but no page size) if paging_state && !page_size
30
48
  super(10, trace)
31
49
  @id = id
@@ -49,24 +67,18 @@ module Cassandra
49
67
  if protocol_version > 1
50
68
  buffer.append_consistency(@consistency)
51
69
  flags = 0
52
- flags |= 0x01 if @values.size > 0
70
+ flags |= 0x01 unless @values.empty?
53
71
  flags |= 0x02 unless @request_metadata
54
72
  flags |= 0x04 if @page_size
55
73
  flags |= 0x08 if @paging_state
56
74
  flags |= 0x10 if @serial_consistency
57
- if protocol_version > 2
58
- flags |= 0x20 if @timestamp
59
- end
75
+ flags |= 0x20 if protocol_version > 2 && @timestamp
60
76
  buffer.append(flags.chr)
61
- if @values.size > 0
62
- encoder.write_parameters(buffer, @values, @metadata)
63
- end
77
+ encoder.write_parameters(buffer, @values, @metadata) unless @values.empty?
64
78
  buffer.append_int(@page_size) if @page_size
65
79
  buffer.append_bytes(@paging_state) if @paging_state
66
80
  buffer.append_consistency(@serial_consistency) if @serial_consistency
67
- if protocol_version > 2
68
- buffer.append_timestamp(@timestamp) if @timestamp
69
- end
81
+ buffer.append_long(@timestamp) if protocol_version > 2 && @timestamp
70
82
  else
71
83
  encoder.write_parameters(buffer, @values, @metadata)
72
84
  buffer.append_consistency(@consistency)
@@ -76,13 +88,20 @@ module Cassandra
76
88
 
77
89
  def to_s
78
90
  id = @id.each_byte.map { |x| x.to_s(16) }.join('')
79
- %(EXECUTE #{id} #@values #{@consistency.to_s.upcase})
91
+ %(EXECUTE #{id} #{@values} #{@consistency.to_s.upcase})
80
92
  end
81
93
 
82
94
  def eql?(rq)
83
- self.class === rq && rq.id == self.id && rq.metadata == self.metadata && rq.values == self.values && rq.consistency == self.consistency && rq.serial_consistency == self.serial_consistency && rq.page_size == self.page_size && rq.paging_state == self.paging_state
95
+ rq.is_a?(self.class) &&
96
+ rq.id == id &&
97
+ rq.metadata == metadata &&
98
+ rq.values == values &&
99
+ rq.consistency == consistency &&
100
+ rq.serial_consistency == serial_consistency &&
101
+ rq.page_size == page_size &&
102
+ rq.paging_state == paging_state
84
103
  end
85
- alias_method :==, :eql?
104
+ alias == eql?
86
105
 
87
106
  def hash
88
107
  @h ||= begin
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ module Cassandra
22
22
  attr_reader :cql, :payload
23
23
  attr_accessor :consistency, :retries
24
24
 
25
- def initialize(cql, trace=false, payload = nil)
25
+ def initialize(cql, trace = false, payload = nil)
26
26
  raise ArgumentError, 'No CQL given!' unless cql
27
27
  super(9, trace)
28
28
  @cql = cql
@@ -39,13 +39,13 @@ module Cassandra
39
39
  end
40
40
 
41
41
  def to_s
42
- %(PREPARE "#@cql")
42
+ %(PREPARE "#{@cql}")
43
43
  end
44
44
 
45
45
  def eql?(rq)
46
- self.class === rq && rq.cql == self.cql
46
+ rq.is_a?(self.class) && rq.cql == cql
47
47
  end
48
- alias_method :==, :eql?
48
+ alias == eql?
49
49
 
50
50
  def hash
51
51
  @h ||= begin
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,10 +19,21 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class QueryRequest < Request
22
- attr_reader :cql, :values, :type_hints, :serial_consistency, :page_size, :paging_state, :timestamp, :payload
22
+ attr_reader :cql, :page_size, :paging_state, :payload, :serial_consistency,
23
+ :timestamp, :type_hints, :values
23
24
  attr_accessor :consistency, :retries
24
25
 
25
- def initialize(cql, values, type_hints, consistency, serial_consistency = nil, page_size = nil, paging_state = nil, trace = false, names = EMPTY_LIST, timestamp = nil, payload = nil)
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)
26
37
  super(7, trace)
27
38
  @cql = cql
28
39
  @values = values
@@ -48,14 +59,10 @@ module Cassandra
48
59
  flags |= 0x04 if @page_size
49
60
  flags |= 0x08 if @paging_state
50
61
  flags |= 0x10 if @serial_consistency
51
- if protocol_version > 2
52
- flags |= 0x20 if @timestamp
53
- end
54
- if @values && @values.size > 0
62
+ flags |= 0x20 if protocol_version > 2 && @timestamp
63
+ if @values && !@values.empty?
55
64
  flags |= 0x01
56
- if protocol_version > 2
57
- flags |= 0x40 unless @names.empty?
58
- end
65
+ flags |= 0x40 if protocol_version > 2 && !@names.empty?
59
66
  buffer.append(flags.chr)
60
67
  encoder.write_parameters(buffer, @values, @type_hints, @names)
61
68
  else
@@ -64,28 +71,26 @@ module Cassandra
64
71
  buffer.append_int(@page_size) if @page_size
65
72
  buffer.append_bytes(@paging_state) if @paging_state
66
73
  buffer.append_consistency(@serial_consistency) if @serial_consistency
67
- if protocol_version > 2
68
- buffer.append_timestamp(@timestamp) if @timestamp
69
- end
74
+ buffer.append_long(@timestamp) if protocol_version > 2 && @timestamp
70
75
  end
71
76
  buffer
72
77
  end
73
78
 
74
79
  def to_s
75
- %(QUERY "#@cql" #{@consistency.to_s.upcase})
80
+ %(QUERY "#{@cql}" #{@consistency.to_s.upcase})
76
81
  end
77
82
 
78
83
  def eql?(rq)
79
- self.class === rq &&
80
- rq.cql == self.cql &&
81
- rq.values == self.values &&
82
- rq.type_hints == self.type_hints &&
83
- rq.consistency == self.consistency &&
84
- rq.serial_consistency == self.serial_consistency &&
85
- rq.page_size == self.page_size &&
86
- rq.paging_state == self.paging_state
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
87
92
  end
88
- alias_method :==, :eql?
93
+ alias == eql?
89
94
 
90
95
  def hash
91
96
  @h ||= begin
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ module Cassandra
31
31
  end
32
32
 
33
33
  def to_s
34
- %(REGISTER #@events)
34
+ %(REGISTER #{@events})
35
35
  end
36
36
  end
37
37
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,9 +19,14 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class StartupRequest < Request
22
+ # @private
23
+ CQL_VERSION = 'CQL_VERSION'.freeze
24
+ # @private
25
+ COMPRESSION = 'COMPRESSION'.freeze
26
+
22
27
  attr_reader :options
23
28
 
24
- def initialize(cql_version, compression=nil)
29
+ def initialize(cql_version, compression = nil)
25
30
  super(1)
26
31
  raise ArgumentError, "Invalid CQL version: #{cql_version.inspect}" unless cql_version
27
32
  @options = {CQL_VERSION => cql_version}
@@ -37,13 +42,8 @@ module Cassandra
37
42
  end
38
43
 
39
44
  def to_s
40
- %(STARTUP #@options)
45
+ %(STARTUP #{@options})
41
46
  end
42
-
43
- private
44
-
45
- CQL_VERSION = 'CQL_VERSION'.freeze
46
- COMPRESSION = 'COMPRESSION'.freeze
47
47
  end
48
48
  end
49
49
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,11 +19,10 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class Response
22
- private
23
-
22
+ # @private
24
23
  RESPONSE_TYPES = [
25
24
  # populated by subclasses
26
25
  ]
27
26
  end
28
27
  end
29
- end
28
+ end