class Tarantool::EMDB::OneShardRead
Public Class Methods
new(replicas, response, feed)
click to toggle source
# File lib/tarantool/em_db.rb, line 94 def initialize(replicas, response, feed) @replicas = replicas @i = -1 @response = response @feed = feed end
Public Instance Methods
call(result=INITIAL)
click to toggle source
# File lib/tarantool/em_db.rb, line 101 def call(result=INITIAL) result = _parse_iproto(result) unless result == INITIAL case result when INITIAL, ::IProto::ConnectionError begin if (@i += 1) >= @replicas.size EM.next_tick Curry1.new(@feed, ConnectionError.new("no available connections")) return end end until (repl = @replicas[@i]).could_be_connected? repl.send_request(@response.request_type, @response.body, self) when Exception @feed.call result else @feed.call @response.parse_response_for_cb(result) end end