类:Mongo::URI::SRVProtocol
- 继承:
-
URI
- 对象
- URI
- Mongo::URI::SRVProtocol
- 定义于:
- lib/mongo/uri/srv_protocol.rb
Overview
使用 mongodb+srv协议 的URI 的解析器,该协议指定用于查询SRV 记录的 DNS。驱动程序将在 DNS服务器上查询前缀为 _mongodb._tcp 的 SRV
有关详细信息,请参阅初始 DNS 种子列表发现规范。
实例属性摘要折叠
-
# query_hostname ⇒ string
只读
private
URI 中指定的用于查找 SRV 记录的主机名。
- # srv_records ⇒ 对象 只读
-
# srv_result ⇒ Srv::Result
只读
private
SRV 查找结果。
实例方法摘要折叠
-
# client_options ⇒ 哈希
获取在实例化时需要传递给 Mongo::Client 的选项哈希值,因此我们不必在点合并 txt记录选项、凭证和数据库- 这里只有一个点。
实例属性详细信息
# query_hostname ⇒ string (只读)
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
URI 中指定的用于查找 SRV 记录的主机名。
需要定义此属性,因为 SRVProtocol 会将 #servers 更改为查找的结果,而不是 URI 中指定的主机名。
68 69 70 |
# File 'lib/ Mongo/uri/srv_protocol.rb', line 68 def query_hostname @query_hostname end |
# srv_records ⇒对象(只读)
35 36 37 |
# File 'lib/ Mongo/uri/srv_protocol.rb', line 35 def srv_records @srv_records end |
# srv_result ⇒ Srv::Result (只读)
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回 SRV 查找结果。
56 57 58 |
# File 'lib/ Mongo/uri/srv_protocol.rb', line 56 def srv_result @srv_result end |
实例方法详细信息
# client_options ⇒哈希
获取在实例化时需要传递给 Mongo::Client 的选项哈希值,因此我们不必在点合并 txt记录选项、凭证和数据库- 这里只有一个点。
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)(凭证) : opts end |