module Mongo::Retryable

Defines basic behavior around retrying operations.

@since 2.1.0

Public Instance Methods

read_worker() click to toggle source

Returns the read worker for handling retryable reads.

@api private

@note this is only a public method so that tests can add expectations

based on it.
# File lib/mongo/retryable.rb, line 58
def read_worker
  @read_worker ||= ReadWorker.new(self)
end
select_server(cluster, server_selector, session) click to toggle source

This is a separate method to make it possible for the test suite to assert that server selection is performed during retry attempts.

This is a public method so that it can be accessed via the read and write worker delegates, as needed.

@api private

@return [ Mongo::Server ] A server matching the server preference.

# File lib/mongo/retryable.rb, line 48
def select_server(cluster, server_selector, session)
  server_selector.select_server(cluster, nil, session)
end
write_worker() click to toggle source

Returns the write worker for handling retryable writes.

@api private

@note this is only a public method so that tests can add expectations

based on it.
# File lib/mongo/retryable.rb, line 68
def write_worker
  @write_worker ||= WriteWorker.new(self)
end