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) ⇒ RequestPromise

Returns a new instance of RequestPromise.



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

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

Instance Attribute Details

#frameObject (readonly)

Returns the value of attribute frame.



153
154
155
# File 'lib/cql/protocol/cql_protocol_handler.rb', line 153

def frame
  @frame
end

#requestObject (readonly)

Returns the value of attribute request.



153
154
155
# File 'lib/cql/protocol/cql_protocol_handler.rb', line 153

def request
  @request
end

Instance Method Details

#encode_frame!Object



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

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

#time_out!Object



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

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

#timed_out?Boolean

Returns:

  • (Boolean)


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

def timed_out?
  @timed_out
end