class Cassandra::Protocol::QueryRequest
Attributes
consistency[RW]
cql[R]
page_size[R]
paging_state[R]
payload[R]
retries[RW]
serial_consistency[R]
timestamp[R]
type_hints[R]
values[R]
Public Class Methods
new(cql, values, type_hints, consistency, serial_consistency = nil, page_size = nil, paging_state = nil, trace = false, names = EMPTY_LIST, timestamp = nil, payload = nil)
click to toggle source
Calls superclass method
Cassandra::Protocol::Request::new
# File lib/cassandra/protocol/requests/query_request.rb 26 def initialize(cql, 27 values, 28 type_hints, 29 consistency, 30 serial_consistency = nil, 31 page_size = nil, 32 paging_state = nil, 33 trace = false, 34 names = EMPTY_LIST, 35 timestamp = nil, 36 payload = nil) 37 super(7, trace) 38 @cql = cql 39 @values = values 40 @type_hints = type_hints 41 @consistency = consistency 42 @serial_consistency = serial_consistency 43 @page_size = page_size 44 @paging_state = paging_state 45 @names = names 46 @timestamp = timestamp 47 @payload = payload 48 end
Public Instance Methods
eql?(rq)
click to toggle source
# File lib/cassandra/protocol/requests/query_request.rb 83 def eql?(rq) 84 rq.is_a?(self.class) && 85 rq.cql == cql && 86 rq.values == values && 87 rq.type_hints == type_hints && 88 rq.consistency == consistency && 89 rq.serial_consistency == serial_consistency && 90 rq.page_size == page_size && 91 rq.paging_state == paging_state 92 end
Also aliased as: ==
hash()
click to toggle source
# File lib/cassandra/protocol/requests/query_request.rb 95 def hash 96 @h ||= begin 97 h = 17 98 h = 31 * h + @cql.hash 99 h = 31 * h + @values.hash 100 h = 31 * h + @type_hints.hash 101 h = 31 * h + @consistency.hash 102 h = 31 * h + @serial_consistency.hash 103 h = 31 * h + @page_size.hash 104 h = 31 * h + @paging_state.hash 105 h = 31 * h + @names.hash 106 h = 31 * h + @timestamp.hash 107 h 108 end 109 end
payload?()
click to toggle source
# File lib/cassandra/protocol/requests/query_request.rb 50 def payload? 51 !!@payload 52 end
to_s()
click to toggle source
# File lib/cassandra/protocol/requests/query_request.rb 79 def to_s 80 %(QUERY "#{@cql}" #{@consistency.to_s.upcase}) 81 end
write(buffer, protocol_version, encoder)
click to toggle source
# File lib/cassandra/protocol/requests/query_request.rb 54 def write(buffer, protocol_version, encoder) 55 buffer.append_long_string(@cql) 56 buffer.append_consistency(@consistency) 57 if protocol_version > 1 58 flags = 0 59 flags |= 0x04 if @page_size 60 flags |= 0x08 if @paging_state 61 flags |= 0x10 if @serial_consistency 62 flags |= 0x20 if protocol_version > 2 && @timestamp 63 if @values && !@values.empty? 64 flags |= 0x01 65 flags |= 0x40 if protocol_version > 2 && !@names.empty? 66 buffer.append(flags.chr) 67 encoder.write_parameters(buffer, @values, @type_hints, @names) 68 else 69 buffer.append(flags.chr) 70 end 71 buffer.append_int(@page_size) if @page_size 72 buffer.append_bytes(@paging_state) if @paging_state 73 buffer.append_consistency(@serial_consistency) if @serial_consistency 74 buffer.append_long(@timestamp) if protocol_version > 2 && @timestamp 75 end 76 buffer 77 end