cassandra-driver 3.0.0.beta.1-java → 3.0.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +106 -39
 - data/lib/cassandra.rb +396 -148
 - data/lib/cassandra/address_resolution.rb +1 -1
 - data/lib/cassandra/address_resolution/policies/ec2_multi_region.rb +1 -1
 - data/lib/cassandra/address_resolution/policies/none.rb +1 -1
 - data/lib/cassandra/aggregate.rb +21 -7
 - data/lib/cassandra/argument.rb +2 -2
 - data/lib/cassandra/attr_boolean.rb +33 -0
 - data/lib/cassandra/auth.rb +6 -5
 - data/lib/cassandra/auth/providers.rb +1 -1
 - data/lib/cassandra/auth/providers/password.rb +5 -13
 - data/lib/cassandra/cassandra_logger.rb +80 -0
 - data/lib/cassandra/cluster.rb +49 -9
 - data/lib/cassandra/cluster/client.rb +835 -209
 - data/lib/cassandra/cluster/connection_pool.rb +2 -2
 - data/lib/cassandra/cluster/connector.rb +86 -27
 - data/lib/cassandra/cluster/control_connection.rb +222 -95
 - data/lib/cassandra/cluster/failed_connection.rb +1 -1
 - data/lib/cassandra/cluster/metadata.rb +14 -8
 - data/lib/cassandra/cluster/options.rb +68 -22
 - data/lib/cassandra/cluster/registry.rb +81 -17
 - data/lib/cassandra/cluster/schema.rb +70 -8
 - data/lib/cassandra/cluster/schema/cql_type_parser.rb +15 -10
 - data/lib/cassandra/cluster/schema/fetchers.rb +601 -241
 - data/lib/cassandra/cluster/schema/fqcn_type_parser.rb +39 -38
 - data/lib/cassandra/cluster/schema/partitioners.rb +1 -1
 - data/lib/cassandra/cluster/schema/partitioners/murmur3.rb +6 -8
 - data/lib/cassandra/cluster/schema/partitioners/ordered.rb +1 -1
 - data/lib/cassandra/cluster/schema/partitioners/random.rb +1 -1
 - data/lib/cassandra/cluster/schema/replication_strategies.rb +1 -1
 - data/lib/cassandra/cluster/schema/replication_strategies/network_topology.rb +19 -18
 - data/lib/cassandra/cluster/schema/replication_strategies/none.rb +1 -1
 - data/lib/cassandra/cluster/schema/replication_strategies/simple.rb +1 -1
 - data/lib/cassandra/column.rb +4 -23
 - data/lib/cassandra/column_container.rb +322 -0
 - data/lib/cassandra/compression.rb +1 -1
 - data/lib/cassandra/compression/compressors/lz4.rb +7 -8
 - data/lib/cassandra/compression/compressors/snappy.rb +4 -3
 - data/lib/cassandra/driver.rb +107 -46
 - data/lib/cassandra/errors.rb +303 -52
 - data/lib/cassandra/execution/info.rb +16 -5
 - data/lib/cassandra/execution/options.rb +102 -55
 - data/lib/cassandra/execution/trace.rb +16 -9
 - data/lib/cassandra/executors.rb +1 -1
 - data/lib/cassandra/function.rb +19 -13
 - data/lib/cassandra/function_collection.rb +85 -0
 - data/lib/cassandra/future.rb +101 -49
 - data/lib/cassandra/host.rb +25 -5
 - data/lib/cassandra/index.rb +118 -0
 - data/lib/cassandra/keyspace.rb +169 -33
 - data/lib/cassandra/listener.rb +1 -1
 - data/lib/cassandra/load_balancing.rb +2 -2
 - data/lib/cassandra/load_balancing/policies.rb +1 -1
 - data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +39 -25
 - data/lib/cassandra/load_balancing/policies/round_robin.rb +8 -1
 - data/lib/cassandra/load_balancing/policies/token_aware.rb +22 -13
 - data/lib/cassandra/load_balancing/policies/white_list.rb +18 -5
 - data/lib/cassandra/materialized_view.rb +90 -0
 - data/lib/cassandra/null_logger.rb +27 -6
 - data/lib/cassandra/protocol.rb +1 -1
 - data/lib/cassandra/protocol/coder.rb +81 -42
 - data/lib/cassandra/protocol/cql_byte_buffer.rb +58 -44
 - data/lib/cassandra/protocol/cql_protocol_handler.rb +57 -54
 - data/lib/cassandra/protocol/request.rb +6 -7
 - data/lib/cassandra/protocol/requests/auth_response_request.rb +3 -3
 - data/lib/cassandra/protocol/requests/batch_request.rb +17 -8
 - data/lib/cassandra/protocol/requests/credentials_request.rb +3 -3
 - data/lib/cassandra/protocol/requests/execute_request.rb +39 -20
 - data/lib/cassandra/protocol/requests/options_request.rb +1 -1
 - data/lib/cassandra/protocol/requests/prepare_request.rb +5 -5
 - data/lib/cassandra/protocol/requests/query_request.rb +28 -23
 - data/lib/cassandra/protocol/requests/register_request.rb +2 -2
 - data/lib/cassandra/protocol/requests/startup_request.rb +8 -8
 - data/lib/cassandra/protocol/requests/void_query_request.rb +1 -1
 - data/lib/cassandra/protocol/response.rb +3 -4
 - data/lib/cassandra/protocol/responses/already_exists_error_response.rb +12 -2
 - data/lib/cassandra/protocol/responses/auth_challenge_response.rb +4 -5
 - data/lib/cassandra/protocol/responses/auth_success_response.rb +4 -5
 - data/lib/cassandra/protocol/responses/authenticate_response.rb +4 -5
 - data/lib/cassandra/protocol/responses/error_response.rb +104 -17
 - data/lib/cassandra/protocol/responses/event_response.rb +3 -4
 - data/lib/cassandra/protocol/responses/function_failure_error_response.rb +13 -2
 - data/lib/cassandra/protocol/responses/prepared_result_response.rb +14 -9
 - data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +14 -9
 - data/lib/cassandra/protocol/responses/read_failure_error_response.rb +26 -4
 - data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +22 -3
 - data/lib/cassandra/protocol/responses/ready_response.rb +6 -7
 - data/lib/cassandra/protocol/responses/result_response.rb +11 -10
 - data/lib/cassandra/protocol/responses/rows_result_response.rb +8 -7
 - data/lib/cassandra/protocol/responses/schema_change_event_response.rb +8 -8
 - data/lib/cassandra/protocol/responses/schema_change_result_response.rb +19 -13
 - data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +5 -6
 - data/lib/cassandra/protocol/responses/status_change_event_response.rb +5 -6
 - data/lib/cassandra/protocol/responses/supported_response.rb +4 -5
 - data/lib/cassandra/protocol/responses/topology_change_event_response.rb +4 -5
 - data/lib/cassandra/protocol/responses/unavailable_error_response.rb +20 -3
 - data/lib/cassandra/protocol/responses/unprepared_error_response.rb +11 -2
 - data/lib/cassandra/protocol/responses/void_result_response.rb +4 -5
 - data/lib/cassandra/protocol/responses/write_failure_error_response.rb +26 -4
 - data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +22 -3
 - data/lib/cassandra/protocol/v1.rb +98 -37
 - data/lib/cassandra/protocol/v3.rb +121 -50
 - data/lib/cassandra/protocol/v4.rb +172 -68
 - data/lib/cassandra/reconnection.rb +1 -1
 - data/lib/cassandra/reconnection/policies.rb +1 -1
 - data/lib/cassandra/reconnection/policies/constant.rb +2 -4
 - data/lib/cassandra/reconnection/policies/exponential.rb +6 -6
 - data/lib/cassandra/result.rb +55 -20
 - data/lib/cassandra/retry.rb +8 -8
 - data/lib/cassandra/retry/policies.rb +1 -1
 - data/lib/cassandra/retry/policies/default.rb +1 -1
 - data/lib/cassandra/retry/policies/downgrading_consistency.rb +4 -2
 - data/lib/cassandra/retry/policies/fallthrough.rb +1 -1
 - data/lib/cassandra/session.rb +24 -16
 - data/lib/cassandra/statement.rb +1 -1
 - data/lib/cassandra/statements.rb +1 -1
 - data/lib/cassandra/statements/batch.rb +16 -10
 - data/lib/cassandra/statements/bound.rb +10 -3
 - data/lib/cassandra/statements/prepared.rb +62 -18
 - data/lib/cassandra/statements/simple.rb +23 -10
 - data/lib/cassandra/statements/void.rb +1 -1
 - data/lib/cassandra/table.rb +53 -185
 - data/lib/cassandra/time.rb +11 -6
 - data/lib/cassandra/time_uuid.rb +12 -14
 - 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/tuple.rb +4 -4
 - data/lib/cassandra/types.rb +109 -71
 - data/lib/cassandra/udt.rb +66 -50
 - data/lib/cassandra/util.rb +155 -15
 - data/lib/cassandra/uuid.rb +20 -21
 - data/lib/cassandra/uuid/generator.rb +7 -5
 - data/lib/cassandra/version.rb +2 -2
 - data/lib/cassandra_murmur3.jar +0 -0
 - data/lib/datastax/cassandra.rb +1 -1
 - metadata +27 -16
 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: utf-8
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright 2013- 
     | 
| 
      
 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.
         
     | 
| 
         @@ -46,7 +46,7 @@ module Cassandra 
     | 
|
| 
       46 
46 
     | 
    
         
             
                        body   = @compressor.compress(body)
         
     | 
| 
       47 
47 
     | 
    
         
             
                      end
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                      header 
     | 
| 
      
 49 
     | 
    
         
            +
                      header = [@protocol_version, flags, stream_id, request.opcode, body.bytesize]
         
     | 
| 
       50 
50 
     | 
    
         
             
                      buffer << header.pack(HEADER_FORMAT)
         
     | 
| 
       51 
51 
     | 
    
         
             
                      buffer << body
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
         @@ -90,7 +90,9 @@ module Cassandra 
     | 
|
| 
       90 
90 
     | 
    
         
             
                        stream_id  = (frame_header >> 8) & 0xff
         
     | 
| 
       91 
91 
     | 
    
         
             
                        stream_id  = (stream_id & 0x7f) - (stream_id & 0x80)
         
     | 
| 
       92 
92 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
                         
     | 
| 
      
 93 
     | 
    
         
            +
                        error_response = ErrorResponse.new(nil, nil, 0x000A,
         
     | 
| 
      
 94 
     | 
    
         
            +
                                                           'Invalid or unsupported protocol version')
         
     | 
| 
      
 95 
     | 
    
         
            +
                        @handler.complete_request(stream_id, error_response)
         
     | 
| 
       94 
96 
     | 
    
         | 
| 
       95 
97 
     | 
    
         
             
                        return
         
     | 
| 
       96 
98 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -159,7 +161,7 @@ module Cassandra 
     | 
|
| 
       159 
161 
     | 
    
         
             
                      nil
         
     | 
| 
       160 
162 
     | 
    
         
             
                    end
         
     | 
| 
       161 
163 
     | 
    
         | 
| 
       162 
     | 
    
         
            -
                    def actual_decode(buffer, fields,  
     | 
| 
      
 164 
     | 
    
         
            +
                    def actual_decode(buffer, fields, frame_length, code)
         
     | 
| 
       163 
165 
     | 
    
         
             
                      protocol_version = (fields >> 24) & 0x7f
         
     | 
| 
       164 
166 
     | 
    
         
             
                      compression      = ((fields >> 16) & 0x01) == 0x01
         
     | 
| 
       165 
167 
     | 
    
         
             
                      tracing          = ((fields >> 16) & 0x02) == 0x02
         
     | 
| 
         @@ -169,42 +171,45 @@ module Cassandra 
     | 
|
| 
       169 
171 
     | 
    
         
             
                      stream_id        = (stream_id & 0x7fff) - (stream_id & 0x8000)
         
     | 
| 
       170 
172 
     | 
    
         
             
                      opcode           = code & 0xff
         
     | 
| 
       171 
173 
     | 
    
         | 
| 
      
 174 
     | 
    
         
            +
                      # If we're dealing with a compressed body, read the whole body, decompress,
         
     | 
| 
      
 175 
     | 
    
         
            +
                      # and treat the uncompressed body as if that's what we got in the first place.
         
     | 
| 
      
 176 
     | 
    
         
            +
                      # This means, reset frame_length to that uncompressed size.
         
     | 
| 
       172 
177 
     | 
    
         
             
                      if compression
         
     | 
| 
       173 
178 
     | 
    
         
             
                        if @compressor
         
     | 
| 
       174 
     | 
    
         
            -
                          buffer = CqlByteBuffer.new( 
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
      
 179 
     | 
    
         
            +
                          buffer = CqlByteBuffer.new(
         
     | 
| 
      
 180 
     | 
    
         
            +
                            @compressor.decompress(buffer.read(frame_length)))
         
     | 
| 
      
 181 
     | 
    
         
            +
                          frame_length = buffer.size
         
     | 
| 
       176 
182 
     | 
    
         
             
                        else
         
     | 
| 
       177 
     | 
    
         
            -
                          raise Errors::DecodingError, 
     | 
| 
      
 183 
     | 
    
         
            +
                          raise Errors::DecodingError,
         
     | 
| 
      
 184 
     | 
    
         
            +
                                'Compressed frame received, but no compressor configured'
         
     | 
| 
       178 
185 
     | 
    
         
             
                        end
         
     | 
| 
       179 
186 
     | 
    
         
             
                      end
         
     | 
| 
       180 
187 
     | 
    
         | 
| 
       181 
     | 
    
         
            -
                       
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
                       
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
                       
     | 
| 
      
 188 
     | 
    
         
            +
                      # We want to read one full frame; but after we read/parse chunks of the body
         
     | 
| 
      
 189 
     | 
    
         
            +
                      # there may be more cruft left in the frame that we don't care about. So,
         
     | 
| 
      
 190 
     | 
    
         
            +
                      # we save off the current size of the buffer, do all our reads for the
         
     | 
| 
      
 191 
     | 
    
         
            +
                      # frame, get the final remaining size, and based on that discard possible
         
     | 
| 
      
 192 
     | 
    
         
            +
                      # remaining bytes in the frame. In particular, we account for the possibility
         
     | 
| 
      
 193 
     | 
    
         
            +
                      # that the buffer contains some/all of a subsequent frame as well, and we
         
     | 
| 
      
 194 
     | 
    
         
            +
                      # don't want to mess with that.
         
     | 
| 
       187 
195 
     | 
    
         | 
| 
       188 
     | 
    
         
            -
                       
     | 
| 
       189 
     | 
    
         
            -
                        custom_payload = buffer.read_bytes_map.freeze
         
     | 
| 
       190 
     | 
    
         
            -
                        size           = buffer.size
         
     | 
| 
       191 
     | 
    
         
            -
                      else
         
     | 
| 
       192 
     | 
    
         
            -
                        custom_payload = nil
         
     | 
| 
       193 
     | 
    
         
            -
                      end
         
     | 
| 
      
 196 
     | 
    
         
            +
                      buffer_starting_length = buffer.length
         
     | 
| 
       194 
197 
     | 
    
         | 
| 
       195 
     | 
    
         
            -
                      if  
     | 
| 
       196 
     | 
    
         
            -
                        warnings = buffer.read_string_list
         
     | 
| 
       197 
     | 
    
         
            -
                        size     = buffer.size
         
     | 
| 
       198 
     | 
    
         
            -
                      else
         
     | 
| 
       199 
     | 
    
         
            -
                        warnings = nil
         
     | 
| 
       200 
     | 
    
         
            -
                      end
         
     | 
| 
      
 198 
     | 
    
         
            +
                      trace_id = (buffer.read_uuid if tracing)
         
     | 
| 
       201 
199 
     | 
    
         | 
| 
       202 
     | 
    
         
            -
                       
     | 
| 
       203 
     | 
    
         
            -
                      response = decode_response(opcode, protocol_version, buffer, size, trace_id, custom_payload, warnings)
         
     | 
| 
      
 200 
     | 
    
         
            +
                      warnings = (buffer.read_string_list if warning)
         
     | 
| 
       204 
201 
     | 
    
         | 
| 
       205 
     | 
    
         
            -
                       
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
                       
     | 
| 
      
 202 
     | 
    
         
            +
                      custom_payload = (buffer.read_bytes_map.freeze if payload)
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
                      remaining_frame_length = frame_length -
         
     | 
| 
      
 205 
     | 
    
         
            +
                                               (buffer_starting_length - buffer.length)
         
     | 
| 
      
 206 
     | 
    
         
            +
                      response = decode_response(opcode, protocol_version, buffer,
         
     | 
| 
      
 207 
     | 
    
         
            +
                                                 remaining_frame_length, trace_id, custom_payload,
         
     | 
| 
      
 208 
     | 
    
         
            +
                                                 warnings)
         
     | 
| 
      
 209 
     | 
    
         
            +
             
     | 
| 
      
 210 
     | 
    
         
            +
                      # Calculate and discard remaining cruft in the frame.
         
     | 
| 
      
 211 
     | 
    
         
            +
                      extra_length = frame_length - (buffer_starting_length - buffer.length)
         
     | 
| 
      
 212 
     | 
    
         
            +
                      buffer.discard(extra_length) if extra_length > 0
         
     | 
| 
       208 
213 
     | 
    
         | 
| 
       209 
214 
     | 
    
         
             
                      if stream_id == -1
         
     | 
| 
       210 
215 
     | 
    
         
             
                        @handler.notify_event_listeners(response)
         
     | 
| 
         @@ -213,21 +218,86 @@ module Cassandra 
     | 
|
| 
       213 
218 
     | 
    
         
             
                      end
         
     | 
| 
       214 
219 
     | 
    
         
             
                    end
         
     | 
| 
       215 
220 
     | 
    
         | 
| 
       216 
     | 
    
         
            -
                    def decode_response(opcode, 
     | 
| 
      
 221 
     | 
    
         
            +
                    def decode_response(opcode,
         
     | 
| 
      
 222 
     | 
    
         
            +
                                        protocol_version,
         
     | 
| 
      
 223 
     | 
    
         
            +
                                        buffer,
         
     | 
| 
      
 224 
     | 
    
         
            +
                                        size,
         
     | 
| 
      
 225 
     | 
    
         
            +
                                        trace_id,
         
     | 
| 
      
 226 
     | 
    
         
            +
                                        custom_payload,
         
     | 
| 
      
 227 
     | 
    
         
            +
                                        warnings)
         
     | 
| 
       217 
228 
     | 
    
         
             
                      case opcode
         
     | 
| 
       218 
229 
     | 
    
         
             
                      when 0x00 # ERROR
         
     | 
| 
       219 
     | 
    
         
            -
                        code 
     | 
| 
      
 230 
     | 
    
         
            +
                        code = buffer.read_int
         
     | 
| 
       220 
231 
     | 
    
         
             
                        message = buffer.read_string
         
     | 
| 
       221 
232 
     | 
    
         | 
| 
       222 
233 
     | 
    
         
             
                        case code
         
     | 
| 
       223 
     | 
    
         
            -
                        when 0x1000 
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
       226 
     | 
    
         
            -
             
     | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
       229 
     | 
    
         
            -
             
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
      
 234 
     | 
    
         
            +
                        when 0x1000
         
     | 
| 
      
 235 
     | 
    
         
            +
                          UnavailableErrorResponse.new(custom_payload,
         
     | 
| 
      
 236 
     | 
    
         
            +
                                                       warnings,
         
     | 
| 
      
 237 
     | 
    
         
            +
                                                       code,
         
     | 
| 
      
 238 
     | 
    
         
            +
                                                       message,
         
     | 
| 
      
 239 
     | 
    
         
            +
                                                       buffer.read_consistency,
         
     | 
| 
      
 240 
     | 
    
         
            +
                                                       buffer.read_int,
         
     | 
| 
      
 241 
     | 
    
         
            +
                                                       buffer.read_int)
         
     | 
| 
      
 242 
     | 
    
         
            +
                        when 0x1100
         
     | 
| 
      
 243 
     | 
    
         
            +
                          WriteTimeoutErrorResponse.new(custom_payload,
         
     | 
| 
      
 244 
     | 
    
         
            +
                                                        warnings,
         
     | 
| 
      
 245 
     | 
    
         
            +
                                                        code,
         
     | 
| 
      
 246 
     | 
    
         
            +
                                                        message,
         
     | 
| 
      
 247 
     | 
    
         
            +
                                                        buffer.read_consistency,
         
     | 
| 
      
 248 
     | 
    
         
            +
                                                        buffer.read_int,
         
     | 
| 
      
 249 
     | 
    
         
            +
                                                        buffer.read_int,
         
     | 
| 
      
 250 
     | 
    
         
            +
                                                        buffer.read_string)
         
     | 
| 
      
 251 
     | 
    
         
            +
                        when 0x1200
         
     | 
| 
      
 252 
     | 
    
         
            +
                          ReadTimeoutErrorResponse.new(custom_payload,
         
     | 
| 
      
 253 
     | 
    
         
            +
                                                       warnings,
         
     | 
| 
      
 254 
     | 
    
         
            +
                                                       code,
         
     | 
| 
      
 255 
     | 
    
         
            +
                                                       message,
         
     | 
| 
      
 256 
     | 
    
         
            +
                                                       buffer.read_consistency,
         
     | 
| 
      
 257 
     | 
    
         
            +
                                                       buffer.read_int,
         
     | 
| 
      
 258 
     | 
    
         
            +
                                                       buffer.read_int,
         
     | 
| 
      
 259 
     | 
    
         
            +
                                                       (buffer.read_byte != 0))
         
     | 
| 
      
 260 
     | 
    
         
            +
                        when 0x1300
         
     | 
| 
      
 261 
     | 
    
         
            +
                          ReadFailureErrorResponse.new(custom_payload,
         
     | 
| 
      
 262 
     | 
    
         
            +
                                                       warnings,
         
     | 
| 
      
 263 
     | 
    
         
            +
                                                       code,
         
     | 
| 
      
 264 
     | 
    
         
            +
                                                       message,
         
     | 
| 
      
 265 
     | 
    
         
            +
                                                       buffer.read_consistency,
         
     | 
| 
      
 266 
     | 
    
         
            +
                                                       buffer.read_int,
         
     | 
| 
      
 267 
     | 
    
         
            +
                                                       buffer.read_int,
         
     | 
| 
      
 268 
     | 
    
         
            +
                                                       buffer.read_int,
         
     | 
| 
      
 269 
     | 
    
         
            +
                                                       (buffer.read_byte != 0))
         
     | 
| 
      
 270 
     | 
    
         
            +
                        when 0x1400
         
     | 
| 
      
 271 
     | 
    
         
            +
                          FunctionFailureErrorResponse.new(custom_payload,
         
     | 
| 
      
 272 
     | 
    
         
            +
                                                           warnings,
         
     | 
| 
      
 273 
     | 
    
         
            +
                                                           code,
         
     | 
| 
      
 274 
     | 
    
         
            +
                                                           message,
         
     | 
| 
      
 275 
     | 
    
         
            +
                                                           buffer.read_string,
         
     | 
| 
      
 276 
     | 
    
         
            +
                                                           buffer.read_string,
         
     | 
| 
      
 277 
     | 
    
         
            +
                                                           buffer.read_string_list)
         
     | 
| 
      
 278 
     | 
    
         
            +
                        when 0x1500
         
     | 
| 
      
 279 
     | 
    
         
            +
                          WriteFailureErrorResponse.new(custom_payload,
         
     | 
| 
      
 280 
     | 
    
         
            +
                                                        warnings,
         
     | 
| 
      
 281 
     | 
    
         
            +
                                                        code,
         
     | 
| 
      
 282 
     | 
    
         
            +
                                                        message,
         
     | 
| 
      
 283 
     | 
    
         
            +
                                                        buffer.read_consistency,
         
     | 
| 
      
 284 
     | 
    
         
            +
                                                        buffer.read_int,
         
     | 
| 
      
 285 
     | 
    
         
            +
                                                        buffer.read_int,
         
     | 
| 
      
 286 
     | 
    
         
            +
                                                        buffer.read_int,
         
     | 
| 
      
 287 
     | 
    
         
            +
                                                        buffer.read_string)
         
     | 
| 
      
 288 
     | 
    
         
            +
                        when 0x2400
         
     | 
| 
      
 289 
     | 
    
         
            +
                          AlreadyExistsErrorResponse.new(custom_payload,
         
     | 
| 
      
 290 
     | 
    
         
            +
                                                         warnings,
         
     | 
| 
      
 291 
     | 
    
         
            +
                                                         code,
         
     | 
| 
      
 292 
     | 
    
         
            +
                                                         message,
         
     | 
| 
      
 293 
     | 
    
         
            +
                                                         buffer.read_string,
         
     | 
| 
      
 294 
     | 
    
         
            +
                                                         buffer.read_string)
         
     | 
| 
      
 295 
     | 
    
         
            +
                        when 0x2500
         
     | 
| 
      
 296 
     | 
    
         
            +
                          UnpreparedErrorResponse.new(custom_payload,
         
     | 
| 
      
 297 
     | 
    
         
            +
                                                      warnings,
         
     | 
| 
      
 298 
     | 
    
         
            +
                                                      code,
         
     | 
| 
      
 299 
     | 
    
         
            +
                                                      message,
         
     | 
| 
      
 300 
     | 
    
         
            +
                                                      buffer.read_short_bytes)
         
     | 
| 
       231 
301 
     | 
    
         
             
                        else
         
     | 
| 
       232 
302 
     | 
    
         
             
                          ErrorResponse.new(custom_payload, warnings, code, message)
         
     | 
| 
       233 
303 
     | 
    
         
             
                        end
         
     | 
| 
         @@ -247,68 +317,100 @@ module Cassandra 
     | 
|
| 
       247 
317 
     | 
    
         
             
                          column_specs, paging_state = Coder.read_metadata_v4(buffer)
         
     | 
| 
       248 
318 
     | 
    
         | 
| 
       249 
319 
     | 
    
         
             
                          if column_specs.nil?
         
     | 
| 
       250 
     | 
    
         
            -
                            consumed_bytes 
     | 
| 
       251 
     | 
    
         
            -
                            remaining_bytes = 
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
      
 320 
     | 
    
         
            +
                            consumed_bytes = original_buffer_length - buffer.length
         
     | 
| 
      
 321 
     | 
    
         
            +
                            remaining_bytes =
         
     | 
| 
      
 322 
     | 
    
         
            +
                              CqlByteBuffer.new(buffer.read(size - consumed_bytes - 4))
         
     | 
| 
      
 323 
     | 
    
         
            +
                            RawRowsResultResponse.new(custom_payload,
         
     | 
| 
      
 324 
     | 
    
         
            +
                                                      warnings,
         
     | 
| 
      
 325 
     | 
    
         
            +
                                                      protocol_version,
         
     | 
| 
      
 326 
     | 
    
         
            +
                                                      remaining_bytes,
         
     | 
| 
      
 327 
     | 
    
         
            +
                                                      paging_state,
         
     | 
| 
      
 328 
     | 
    
         
            +
                                                      trace_id)
         
     | 
| 
       253 
329 
     | 
    
         
             
                          else
         
     | 
| 
       254 
     | 
    
         
            -
                            RowsResultResponse.new(custom_payload, 
     | 
| 
      
 330 
     | 
    
         
            +
                            RowsResultResponse.new(custom_payload,
         
     | 
| 
      
 331 
     | 
    
         
            +
                                                   warnings,
         
     | 
| 
      
 332 
     | 
    
         
            +
                                                   Coder.read_values_v4(buffer, column_specs),
         
     | 
| 
      
 333 
     | 
    
         
            +
                                                   column_specs,
         
     | 
| 
      
 334 
     | 
    
         
            +
                                                   paging_state,
         
     | 
| 
      
 335 
     | 
    
         
            +
                                                   trace_id)
         
     | 
| 
       255 
336 
     | 
    
         
             
                          end
         
     | 
| 
       256 
337 
     | 
    
         
             
                        when 0x0003 # SetKeyspace
         
     | 
| 
       257 
     | 
    
         
            -
                          SetKeyspaceResultResponse.new(custom_payload, 
     | 
| 
      
 338 
     | 
    
         
            +
                          SetKeyspaceResultResponse.new(custom_payload,
         
     | 
| 
      
 339 
     | 
    
         
            +
                                                        warnings,
         
     | 
| 
      
 340 
     | 
    
         
            +
                                                        buffer.read_string,
         
     | 
| 
      
 341 
     | 
    
         
            +
                                                        trace_id)
         
     | 
| 
       258 
342 
     | 
    
         
             
                        when 0x0004 # Prepared
         
     | 
| 
       259 
343 
     | 
    
         
             
                          id = buffer.read_short_bytes
         
     | 
| 
       260 
344 
     | 
    
         
             
                          pk_idx, params_metadata = Coder.read_prepared_metadata_v4(buffer)
         
     | 
| 
       261 
345 
     | 
    
         
             
                          result_metadata = Coder.read_metadata_v4(buffer).first
         
     | 
| 
       262 
346 
     | 
    
         | 
| 
       263 
     | 
    
         
            -
                          PreparedResultResponse.new(custom_payload, 
     | 
| 
      
 347 
     | 
    
         
            +
                          PreparedResultResponse.new(custom_payload,
         
     | 
| 
      
 348 
     | 
    
         
            +
                                                     warnings,
         
     | 
| 
      
 349 
     | 
    
         
            +
                                                     id,
         
     | 
| 
      
 350 
     | 
    
         
            +
                                                     params_metadata,
         
     | 
| 
      
 351 
     | 
    
         
            +
                                                     result_metadata,
         
     | 
| 
      
 352 
     | 
    
         
            +
                                                     pk_idx,
         
     | 
| 
      
 353 
     | 
    
         
            +
                                                     trace_id)
         
     | 
| 
       264 
354 
     | 
    
         
             
                        when 0x0005 # SchemaChange
         
     | 
| 
       265 
     | 
    
         
            -
                          change 
     | 
| 
       266 
     | 
    
         
            -
                          target 
     | 
| 
       267 
     | 
    
         
            -
                           
     | 
| 
       268 
     | 
    
         
            -
                          name      = nil
         
     | 
| 
      
 355 
     | 
    
         
            +
                          change = buffer.read_string
         
     | 
| 
      
 356 
     | 
    
         
            +
                          target = buffer.read_string
         
     | 
| 
      
 357 
     | 
    
         
            +
                          name = nil
         
     | 
| 
       269 
358 
     | 
    
         
             
                          arguments = EMPTY_LIST
         
     | 
| 
       270 
359 
     | 
    
         | 
| 
       271 
360 
     | 
    
         
             
                          case target
         
     | 
| 
       272 
361 
     | 
    
         
             
                          when Protocol::Constants::SCHEMA_CHANGE_TARGET_KEYSPACE
         
     | 
| 
       273 
362 
     | 
    
         
             
                            keyspace = buffer.read_string
         
     | 
| 
       274 
363 
     | 
    
         
             
                          when Protocol::Constants::SCHEMA_CHANGE_TARGET_TABLE,
         
     | 
| 
       275 
     | 
    
         
            -
             
     | 
| 
      
 364 
     | 
    
         
            +
                                Protocol::Constants::SCHEMA_CHANGE_TARGET_UDT
         
     | 
| 
       276 
365 
     | 
    
         
             
                            keyspace = buffer.read_string
         
     | 
| 
       277 
     | 
    
         
            -
                            name 
     | 
| 
      
 366 
     | 
    
         
            +
                            name = buffer.read_string
         
     | 
| 
       278 
367 
     | 
    
         
             
                          when Protocol::Constants::SCHEMA_CHANGE_TARGET_FUNCTION,
         
     | 
| 
       279 
     | 
    
         
            -
             
     | 
| 
       280 
     | 
    
         
            -
                            keyspace 
     | 
| 
       281 
     | 
    
         
            -
                            name 
     | 
| 
      
 368 
     | 
    
         
            +
                                Protocol::Constants::SCHEMA_CHANGE_TARGET_AGGREGATE
         
     | 
| 
      
 369 
     | 
    
         
            +
                            keyspace = buffer.read_string
         
     | 
| 
      
 370 
     | 
    
         
            +
                            name = buffer.read_string
         
     | 
| 
       282 
371 
     | 
    
         
             
                            arguments = buffer.read_string_list
         
     | 
| 
      
 372 
     | 
    
         
            +
                          else
         
     | 
| 
      
 373 
     | 
    
         
            +
                            raise Errors::DecodingError,
         
     | 
| 
      
 374 
     | 
    
         
            +
                                  "Unsupported event target: #{target.inspect}"
         
     | 
| 
       283 
375 
     | 
    
         
             
                          end
         
     | 
| 
       284 
376 
     | 
    
         | 
| 
       285 
     | 
    
         
            -
                          SchemaChangeResultResponse.new(custom_payload, 
     | 
| 
      
 377 
     | 
    
         
            +
                          SchemaChangeResultResponse.new(custom_payload,
         
     | 
| 
      
 378 
     | 
    
         
            +
                                                         warnings,
         
     | 
| 
      
 379 
     | 
    
         
            +
                                                         change,
         
     | 
| 
      
 380 
     | 
    
         
            +
                                                         keyspace,
         
     | 
| 
      
 381 
     | 
    
         
            +
                                                         name,
         
     | 
| 
      
 382 
     | 
    
         
            +
                                                         target,
         
     | 
| 
      
 383 
     | 
    
         
            +
                                                         arguments,
         
     | 
| 
      
 384 
     | 
    
         
            +
                                                         trace_id)
         
     | 
| 
       286 
385 
     | 
    
         
             
                        else
         
     | 
| 
       287 
     | 
    
         
            -
                          raise Errors::DecodingError, 
     | 
| 
      
 386 
     | 
    
         
            +
                          raise Errors::DecodingError,
         
     | 
| 
      
 387 
     | 
    
         
            +
                                "Unsupported result type: #{result_type.inspect}"
         
     | 
| 
       288 
388 
     | 
    
         
             
                        end
         
     | 
| 
       289 
389 
     | 
    
         
             
                      when 0x0C # EVENT
         
     | 
| 
       290 
390 
     | 
    
         
             
                        event_type = buffer.read_string
         
     | 
| 
       291 
391 
     | 
    
         
             
                        case event_type
         
     | 
| 
       292 
392 
     | 
    
         
             
                        when 'SCHEMA_CHANGE'
         
     | 
| 
       293 
     | 
    
         
            -
                          change 
     | 
| 
       294 
     | 
    
         
            -
                          target 
     | 
| 
       295 
     | 
    
         
            -
                          keyspace  = nil
         
     | 
| 
      
 393 
     | 
    
         
            +
                          change = buffer.read_string
         
     | 
| 
      
 394 
     | 
    
         
            +
                          target = buffer.read_string
         
     | 
| 
       296 
395 
     | 
    
         
             
                          arguments = EMPTY_LIST
         
     | 
| 
       297 
396 
     | 
    
         | 
| 
       298 
397 
     | 
    
         
             
                          case target
         
     | 
| 
       299 
398 
     | 
    
         
             
                          when Protocol::Constants::SCHEMA_CHANGE_TARGET_KEYSPACE
         
     | 
| 
       300 
399 
     | 
    
         
             
                            keyspace = buffer.read_string
         
     | 
| 
       301 
     | 
    
         
            -
                            name 
     | 
| 
      
 400 
     | 
    
         
            +
                            name = nil
         
     | 
| 
       302 
401 
     | 
    
         
             
                          when Protocol::Constants::SCHEMA_CHANGE_TARGET_TABLE,
         
     | 
| 
       303 
     | 
    
         
            -
             
     | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
             
     | 
| 
      
 402 
     | 
    
         
            +
                                Protocol::Constants::SCHEMA_CHANGE_TARGET_UDT,
         
     | 
| 
      
 403 
     | 
    
         
            +
                                Protocol::Constants::SCHEMA_CHANGE_TARGET_FUNCTION,
         
     | 
| 
      
 404 
     | 
    
         
            +
                                Protocol::Constants::SCHEMA_CHANGE_TARGET_AGGREGATE
         
     | 
| 
       306 
405 
     | 
    
         
             
                            keyspace = buffer.read_string
         
     | 
| 
       307 
     | 
    
         
            -
                            name 
     | 
| 
      
 406 
     | 
    
         
            +
                            name = buffer.read_string
         
     | 
| 
      
 407 
     | 
    
         
            +
                          else
         
     | 
| 
      
 408 
     | 
    
         
            +
                            raise Errors::DecodingError,
         
     | 
| 
      
 409 
     | 
    
         
            +
                                  "Unsupported event target: #{target.inspect}"
         
     | 
| 
       308 
410 
     | 
    
         
             
                          end
         
     | 
| 
       309 
411 
     | 
    
         | 
| 
       310 
412 
     | 
    
         
             
                          if target == Protocol::Constants::SCHEMA_CHANGE_TARGET_FUNCTION \
         
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
      
 413 
     | 
    
         
            +
                      || target == Protocol::Constants::SCHEMA_CHANGE_TARGET_AGGREGATE
         
     | 
| 
       312 
414 
     | 
    
         
             
                            arguments = buffer.read_string_list
         
     | 
| 
       313 
415 
     | 
    
         
             
                          end
         
     | 
| 
       314 
416 
     | 
    
         | 
| 
         @@ -318,14 +420,16 @@ module Cassandra 
     | 
|
| 
       318 
420 
     | 
    
         
             
                        when 'TOPOLOGY_CHANGE'
         
     | 
| 
       319 
421 
     | 
    
         
             
                          TopologyChangeEventResponse.new(buffer.read_string, *buffer.read_inet)
         
     | 
| 
       320 
422 
     | 
    
         
             
                        else
         
     | 
| 
       321 
     | 
    
         
            -
                          raise Errors::DecodingError, 
     | 
| 
      
 423 
     | 
    
         
            +
                          raise Errors::DecodingError,
         
     | 
| 
      
 424 
     | 
    
         
            +
                                "Unsupported event type: #{event_type.inspect}"
         
     | 
| 
       322 
425 
     | 
    
         
             
                        end
         
     | 
| 
       323 
426 
     | 
    
         
             
                      when 0x0E # AUTH_CHALLENGE
         
     | 
| 
       324 
427 
     | 
    
         
             
                        AuthChallengeResponse.new(buffer.read_bytes)
         
     | 
| 
       325 
428 
     | 
    
         
             
                      when 0x10 # AUTH_SUCCESS
         
     | 
| 
       326 
429 
     | 
    
         
             
                        AuthSuccessResponse.new(buffer.read_bytes)
         
     | 
| 
       327 
430 
     | 
    
         
             
                      else
         
     | 
| 
       328 
     | 
    
         
            -
                        raise Errors::DecodingError, 
     | 
| 
      
 431 
     | 
    
         
            +
                        raise Errors::DecodingError,
         
     | 
| 
      
 432 
     | 
    
         
            +
                              "Unsupported response opcode: #{opcode.inspect}"
         
     | 
| 
       329 
433 
     | 
    
         
             
                      end
         
     | 
| 
       330 
434 
     | 
    
         
             
                    end
         
     | 
| 
       331 
435 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: utf-8
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright 2013- 
     | 
| 
      
 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.
         
     | 
| 
         @@ -39,9 +39,7 @@ module Cassandra 
     | 
|
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                    # @return [Cassandra::Reconnection::Schedule] reconnection schedule
         
     | 
| 
       41 
41 
     | 
    
         
             
                    #   with constant interval
         
     | 
| 
       42 
     | 
    
         
            -
                     
     | 
| 
       43 
     | 
    
         
            -
                      @schedule
         
     | 
| 
       44 
     | 
    
         
            -
                    end
         
     | 
| 
      
 42 
     | 
    
         
            +
                    attr_reader :schedule
         
     | 
| 
       45 
43 
     | 
    
         
             
                  end
         
     | 
| 
       46 
44 
     | 
    
         
             
                end
         
     | 
| 
       47 
45 
     | 
    
         
             
              end
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: utf-8
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright 2013- 
     | 
| 
      
 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.
         
     | 
| 
         @@ -39,11 +39,11 @@ module Cassandra 
     | 
|
| 
       39 
39 
     | 
    
         
             
                      def backoff
         
     | 
| 
       40 
40 
     | 
    
         
             
                        new_interval = @interval * @exponent
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                        if new_interval >= @max
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
                        @interval = if new_interval >= @max
         
     | 
| 
      
 43 
     | 
    
         
            +
                                      @max
         
     | 
| 
      
 44 
     | 
    
         
            +
                                    else
         
     | 
| 
      
 45 
     | 
    
         
            +
                                      new_interval
         
     | 
| 
      
 46 
     | 
    
         
            +
                                    end
         
     | 
| 
       47 
47 
     | 
    
         
             
                      end
         
     | 
| 
       48 
48 
     | 
    
         
             
                    end
         
     | 
| 
       49 
49 
     | 
    
         | 
    
        data/lib/cassandra/result.rb
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: utf-8
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            #--
         
     | 
| 
       4 
     | 
    
         
            -
            # Copyright 2013- 
     | 
| 
      
 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.
         
     | 
| 
         @@ -23,7 +23,17 @@ module Cassandra 
     | 
|
| 
       23 
23 
     | 
    
         
             
                # Query execution information, such as number of retries and all tried hosts, etc.
         
     | 
| 
       24 
24 
     | 
    
         
             
                # @return [Cassandra::Execution::Info]
         
     | 
| 
       25 
25 
     | 
    
         
             
                def execution_info
         
     | 
| 
       26 
     | 
    
         
            -
                  @info ||= Execution::Info.new(@payload, 
     | 
| 
      
 26 
     | 
    
         
            +
                  @info ||= Execution::Info.new(@payload,
         
     | 
| 
      
 27 
     | 
    
         
            +
                                                @warnings,
         
     | 
| 
      
 28 
     | 
    
         
            +
                                                @keyspace,
         
     | 
| 
      
 29 
     | 
    
         
            +
                                                @statement,
         
     | 
| 
      
 30 
     | 
    
         
            +
                                                @options,
         
     | 
| 
      
 31 
     | 
    
         
            +
                                                @hosts,
         
     | 
| 
      
 32 
     | 
    
         
            +
                                                @consistency,
         
     | 
| 
      
 33 
     | 
    
         
            +
                                                @retries,
         
     | 
| 
      
 34 
     | 
    
         
            +
                                                @trace_id ?
         
     | 
| 
      
 35 
     | 
    
         
            +
                                                    Execution::Trace.new(@trace_id, @client) :
         
     | 
| 
      
 36 
     | 
    
         
            +
                                                    nil)
         
     | 
| 
       27 
37 
     | 
    
         
             
                end
         
     | 
| 
       28 
38 
     | 
    
         | 
| 
       29 
39 
     | 
    
         
             
                # @return [Boolean] whether it has any rows
         
     | 
| 
         @@ -33,14 +43,14 @@ module Cassandra 
     | 
|
| 
       33 
43 
     | 
    
         
             
                # @return [Integer] rows count
         
     | 
| 
       34 
44 
     | 
    
         
             
                def size
         
     | 
| 
       35 
45 
     | 
    
         
             
                end
         
     | 
| 
       36 
     | 
    
         
            -
                alias  
     | 
| 
      
 46 
     | 
    
         
            +
                alias length size
         
     | 
| 
       37 
47 
     | 
    
         | 
| 
       38 
48 
     | 
    
         
             
                # @yieldparam row [Hash] current row
         
     | 
| 
       39 
49 
     | 
    
         
             
                # @return [Enumerator, self] returns Enumerator if no block given
         
     | 
| 
       40 
50 
     | 
    
         
             
                def each
         
     | 
| 
       41 
51 
     | 
    
         
             
                end
         
     | 
| 
       42 
     | 
    
         
            -
                alias  
     | 
| 
       43 
     | 
    
         
            -
                alias  
     | 
| 
      
 52 
     | 
    
         
            +
                alias rows each
         
     | 
| 
      
 53 
     | 
    
         
            +
                alias each_row each
         
     | 
| 
       44 
54 
     | 
    
         | 
| 
       45 
55 
     | 
    
         
             
                # @return [Boolean] whether no more pages are available
         
     | 
| 
       46 
56 
     | 
    
         
             
                def last_page?
         
     | 
| 
         @@ -78,15 +88,16 @@ module Cassandra 
     | 
|
| 
       78 
88 
     | 
    
         
             
                # @return [String, nil] current paging state as a `String` or `nil`.
         
     | 
| 
       79 
89 
     | 
    
         
             
                #
         
     | 
| 
       80 
90 
     | 
    
         
             
                # @note Although this feature exists to allow web applications to store
         
     | 
| 
       81 
     | 
    
         
            -
                #   paging state in an [HTTP cookie](http://en.wikipedia.org/wiki/HTTP_cookie), 
     | 
| 
       82 
     | 
    
         
            -
                #   expose without encrypting or otherwise securing it**. 
     | 
| 
       83 
     | 
    
         
            -
                #   contains information internal to the Apache Cassandra cluster, 
     | 
| 
       84 
     | 
    
         
            -
                #   partition key and data. Additionally, if a paging state is sent with CQL
         
     | 
| 
      
 91 
     | 
    
         
            +
                #   paging state in an [HTTP cookie](http://en.wikipedia.org/wiki/HTTP_cookie),
         
     | 
| 
      
 92 
     | 
    
         
            +
                #   **it is not safe to expose without encrypting or otherwise securing it**.
         
     | 
| 
      
 93 
     | 
    
         
            +
                #   Paging state contains information internal to the Apache Cassandra cluster,
         
     | 
| 
      
 94 
     | 
    
         
            +
                #   such as partition key and data. Additionally, if a paging state is sent with CQL
         
     | 
| 
       85 
95 
     | 
    
         
             
                #   statement, different from the original, the behavior of Cassandra is
         
     | 
| 
       86 
96 
     | 
    
         
             
                #   undefined and will likely cause a server process of the coordinator of
         
     | 
| 
       87 
97 
     | 
    
         
             
                #   such request to abort.
         
     | 
| 
       88 
98 
     | 
    
         
             
                #
         
     | 
| 
       89 
     | 
    
         
            -
                # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v2.spec#L482-L487 Paging State 
     | 
| 
      
 99 
     | 
    
         
            +
                # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v2.spec#L482-L487 Paging State
         
     | 
| 
      
 100 
     | 
    
         
            +
                #   description in Cassandra Native Protocol v2 specification
         
     | 
| 
       90 
101 
     | 
    
         
             
                def paging_state
         
     | 
| 
       91 
102 
     | 
    
         
             
                end
         
     | 
| 
       92 
103 
     | 
    
         
             
              end
         
     | 
| 
         @@ -96,7 +107,19 @@ module Cassandra 
     | 
|
| 
       96 
107 
     | 
    
         
             
                class Paged < Result
         
     | 
| 
       97 
108 
     | 
    
         
             
                  attr_reader :paging_state
         
     | 
| 
       98 
109 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
                  def initialize(payload, 
     | 
| 
      
 110 
     | 
    
         
            +
                  def initialize(payload,
         
     | 
| 
      
 111 
     | 
    
         
            +
                                 warnings,
         
     | 
| 
      
 112 
     | 
    
         
            +
                                 rows,
         
     | 
| 
      
 113 
     | 
    
         
            +
                                 paging_state,
         
     | 
| 
      
 114 
     | 
    
         
            +
                                 trace_id,
         
     | 
| 
      
 115 
     | 
    
         
            +
                                 keyspace,
         
     | 
| 
      
 116 
     | 
    
         
            +
                                 statement,
         
     | 
| 
      
 117 
     | 
    
         
            +
                                 options,
         
     | 
| 
      
 118 
     | 
    
         
            +
                                 hosts,
         
     | 
| 
      
 119 
     | 
    
         
            +
                                 consistency,
         
     | 
| 
      
 120 
     | 
    
         
            +
                                 retries,
         
     | 
| 
      
 121 
     | 
    
         
            +
                                 client,
         
     | 
| 
      
 122 
     | 
    
         
            +
                                 futures_factory)
         
     | 
| 
       100 
123 
     | 
    
         
             
                    @payload        = payload
         
     | 
| 
       101 
124 
     | 
    
         
             
                    @warnings       = warnings
         
     | 
| 
       102 
125 
     | 
    
         
             
                    @rows           = rows
         
     | 
| 
         @@ -121,7 +144,7 @@ module Cassandra 
     | 
|
| 
       121 
144 
     | 
    
         
             
                  def size
         
     | 
| 
       122 
145 
     | 
    
         
             
                    @rows.size
         
     | 
| 
       123 
146 
     | 
    
         
             
                  end
         
     | 
| 
       124 
     | 
    
         
            -
                  alias  
     | 
| 
      
 147 
     | 
    
         
            +
                  alias length size
         
     | 
| 
       125 
148 
     | 
    
         | 
| 
       126 
149 
     | 
    
         
             
                  def each(&block)
         
     | 
| 
       127 
150 
     | 
    
         
             
                    if block_given?
         
     | 
| 
         @@ -131,8 +154,8 @@ module Cassandra 
     | 
|
| 
       131 
154 
     | 
    
         
             
                      @rows.each
         
     | 
| 
       132 
155 
     | 
    
         
             
                    end
         
     | 
| 
       133 
156 
     | 
    
         
             
                  end
         
     | 
| 
       134 
     | 
    
         
            -
                  alias  
     | 
| 
       135 
     | 
    
         
            -
                  alias  
     | 
| 
      
 157 
     | 
    
         
            +
                  alias rows each
         
     | 
| 
      
 158 
     | 
    
         
            +
                  alias each_row each
         
     | 
| 
       136 
159 
     | 
    
         | 
| 
       137 
160 
     | 
    
         
             
                  # Returns true when there are no more pages to load.
         
     | 
| 
       138 
161 
     | 
    
         
             
                  def last_page?
         
     | 
| 
         @@ -160,12 +183,24 @@ module Cassandra 
     | 
|
| 
       160 
183 
     | 
    
         | 
| 
       161 
184 
     | 
    
         
             
                  # @private
         
     | 
| 
       162 
185 
     | 
    
         
             
                  def inspect
         
     | 
| 
       163 
     | 
    
         
            -
                    "#<Cassandra::Result:0x#{ 
     | 
| 
      
 186 
     | 
    
         
            +
                    "#<Cassandra::Result:0x#{object_id.to_s(16)} " \
         
     | 
| 
      
 187 
     | 
    
         
            +
                        "@rows=#{@rows.inspect} " \
         
     | 
| 
      
 188 
     | 
    
         
            +
                        "@last_page=#{@paging_state.nil?}>"
         
     | 
| 
       164 
189 
     | 
    
         
             
                  end
         
     | 
| 
       165 
190 
     | 
    
         
             
                end
         
     | 
| 
       166 
191 
     | 
    
         | 
| 
       167 
192 
     | 
    
         
             
                class Void < Result
         
     | 
| 
       168 
     | 
    
         
            -
                  def initialize(payload, 
     | 
| 
      
 193 
     | 
    
         
            +
                  def initialize(payload,
         
     | 
| 
      
 194 
     | 
    
         
            +
                                 warnings,
         
     | 
| 
      
 195 
     | 
    
         
            +
                                 trace_id,
         
     | 
| 
      
 196 
     | 
    
         
            +
                                 keyspace,
         
     | 
| 
      
 197 
     | 
    
         
            +
                                 statement,
         
     | 
| 
      
 198 
     | 
    
         
            +
                                 options,
         
     | 
| 
      
 199 
     | 
    
         
            +
                                 hosts,
         
     | 
| 
      
 200 
     | 
    
         
            +
                                 consistency,
         
     | 
| 
      
 201 
     | 
    
         
            +
                                 retries,
         
     | 
| 
      
 202 
     | 
    
         
            +
                                 client,
         
     | 
| 
      
 203 
     | 
    
         
            +
                                 futures_factory)
         
     | 
| 
       169 
204 
     | 
    
         
             
                    @payload     = payload
         
     | 
| 
       170 
205 
     | 
    
         
             
                    @warnings    = warnings
         
     | 
| 
       171 
206 
     | 
    
         
             
                    @trace_id    = trace_id
         
     | 
| 
         @@ -188,7 +223,7 @@ module Cassandra 
     | 
|
| 
       188 
223 
     | 
    
         
             
                  def size
         
     | 
| 
       189 
224 
     | 
    
         
             
                    0
         
     | 
| 
       190 
225 
     | 
    
         
             
                  end
         
     | 
| 
       191 
     | 
    
         
            -
                  alias  
     | 
| 
      
 226 
     | 
    
         
            +
                  alias length size
         
     | 
| 
       192 
227 
     | 
    
         | 
| 
       193 
228 
     | 
    
         
             
                  # Iterates over each row in the result set.
         
     | 
| 
       194 
229 
     | 
    
         
             
                  #
         
     | 
| 
         @@ -202,8 +237,8 @@ module Cassandra 
     | 
|
| 
       202 
237 
     | 
    
         
             
                      EMPTY_LIST.each
         
     | 
| 
       203 
238 
     | 
    
         
             
                    end
         
     | 
| 
       204 
239 
     | 
    
         
             
                  end
         
     | 
| 
       205 
     | 
    
         
            -
                  alias  
     | 
| 
       206 
     | 
    
         
            -
                  alias  
     | 
| 
      
 240 
     | 
    
         
            +
                  alias rows each
         
     | 
| 
      
 241 
     | 
    
         
            +
                  alias each_row each
         
     | 
| 
       207 
242 
     | 
    
         | 
| 
       208 
243 
     | 
    
         
             
                  # Returns true when there are no more pages to load.
         
     | 
| 
       209 
244 
     | 
    
         
             
                  #
         
     | 
| 
         @@ -234,7 +269,7 @@ module Cassandra 
     | 
|
| 
       234 
269 
     | 
    
         
             
                  end
         
     | 
| 
       235 
270 
     | 
    
         | 
| 
       236 
271 
     | 
    
         
             
                  def inspect
         
     | 
| 
       237 
     | 
    
         
            -
                    "#<Cassandra::Result:0x#{ 
     | 
| 
      
 272 
     | 
    
         
            +
                    "#<Cassandra::Result:0x#{object_id.to_s(16)} @rows=[] @last_page=true>"
         
     | 
| 
       238 
273 
     | 
    
         
             
                  end
         
     | 
| 
       239 
274 
     | 
    
         
             
                end
         
     | 
| 
       240 
275 
     | 
    
         
             
              end
         
     |