Class: Cql::Protocol::CqlProtocolHandler::RequestPromise

Inherits:
Cql::Promise
  • Object
show all
Defined in:
lib/cql/protocol/cql_protocol_handler.rb

Instance Attribute Summary collapse

Attributes inherited from Cql::Promise

#future

Instance Method Summary collapse

Methods inherited from Cql::Promise

#fail, #fulfill, #observe, #try

Constructor Details

#initialize(request, frame_encoder) ⇒ RequestPromise

Returns a new instance of RequestPromise.



158
159
160
161
162
163
# File 'lib/cql/protocol/cql_protocol_handler.rb', line 158

def initialize(request, frame_encoder)
  @request = request
  @frame_encoder = frame_encoder
  @timed_out = false
  super()
end

Instance Attribute Details

#frameObject (readonly)

Returns the value of attribute frame.



156
157
158
# File 'lib/cql/protocol/cql_protocol_handler.rb', line 156

def frame
  @frame
end

#requestObject (readonly)

Returns the value of attribute request.



156
157
158
# File 'lib/cql/protocol/cql_protocol_handler.rb', line 156

def request
  @request
end

Instance Method Details

#encode_frame!Object



176
177
178
# File 'lib/cql/protocol/cql_protocol_handler.rb', line 176

def encode_frame!
  @frame = @frame_encoder.encode_frame(@request)
end

#time_out!Object



169
170
171
172
173
174
# File 'lib/cql/protocol/cql_protocol_handler.rb', line 169

def time_out!
  unless future.completed?
    @timed_out = true
    fail(TimeoutError.new)
  end
end

#timed_out?Boolean

Returns:

  • (Boolean)


165
166
167
# File 'lib/cql/protocol/cql_protocol_handler.rb', line 165

def timed_out?
  @timed_out
end