Class: Mongo::URI::SRVProtocol
- Inherits:
-
URI
- Object
- URI
- Mongo::URI::SRVProtocol
- Defined in:
- lib/mongo/uri/srv_protocol.rb
Overview
Parser for a URI using the mongodb+srv protocol, which specifies a DNS to query for SRV records.
The driver will query the DNS server for SRV records on
Please refer to the Initial DNS Seedlist Discovery spec for details.
Instance Attribute Summary collapse
-
#query_hostname ⇒ String
readonly
private
The hostname that is specified in the URI and used to look up SRV records.
- #srv_records ⇒ Object readonly
-
#srv_result ⇒ Srv::Result
readonly
private
SRV lookup result.
Instance Method Summary collapse
-
#client_options ⇒ Hash
Gets the options hash that needs to be passed to a Mongo::Client on instantiation, so we don't have to merge the txt record options, credentials, and database in at that point - we only have a single point here.
Instance Attribute Details
#query_hostname ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The hostname that is specified in the URI and used to look up SRV records.
This attribute needs to be defined because SRVProtocol changes #servers to be the result of the lookup rather than the hostname specified in the URI.
68 69 70 |
# File 'lib/mongo/uri/srv_protocol.rb', line 68 def query_hostname @query_hostname end |
#srv_records ⇒ Object (readonly)
35 36 37 |
# File 'lib/mongo/uri/srv_protocol.rb', line 35 def srv_records @srv_records end |
#srv_result ⇒ Srv::Result (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns SRV lookup result.
56 57 58 |
# File 'lib/mongo/uri/srv_protocol.rb', line 56 def srv_result @srv_result end |
Instance Method Details
#client_options ⇒ Hash
Gets the options hash that needs to be passed to a Mongo::Client on instantiation, so we don't have to merge the txt record options, credentials, and database in at that point - we only have a single point here.
47 48 49 50 51 |
# File 'lib/mongo/uri/srv_protocol.rb', line 47 def opts = @txt_options.merge(ssl: true) opts = opts.merge().merge(database: database) @user ? opts.merge(credentials) : opts end |