AppMetadata — Documentation by YARD 0.9.37 (original) (raw)
Class: Mongo::Server::AppMetadataPrivate
Inherits:
Object
- Object
- Mongo::Server::AppMetadata show all
Extended by:
Forwardable
Defined in:
lib/mongo/server/app_metadata.rb,
lib/mongo/server/app_metadata/platform.rb,
lib/mongo/server/app_metadata/truncator.rb,
lib/mongo/server/app_metadata/environment.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Application metadata that is sent to the server during a handshake,
when a new connection is established.
Defined Under Namespace
Classes: Environment, Platform, Truncator
Constant Summarycollapse
MAX_APP_NAME_SIZE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The max application name byte size.
128
DRIVER_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The driver name.
'mongo-ruby-driver'
AUTH_OPTION_KEYS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Option keys that affect auth mechanism negotiation.
%i[ user auth_source auth_mech].freeze
PURPOSES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Possible connection purposes.
%i[ application monitor push_monitor ].freeze
Instance Attribute Summary collapse
- #platform ⇒ String readonly private
The platform information given when the object was instantiated. - #purpose ⇒ Symbol readonly private
The purpose of the connection for which this app metadata is created. - #server_api ⇒ Hash | nil readonly private
The requested server API version. - #wrapping_libraries ⇒ Array | nil readonly private
Information about libraries wrapping the driver.
Instance Method Summarycollapse
- #client_document ⇒ BSON::Document private
Get BSON::Document to be used as value for ‘client` key in handshake document. - #initialize(options = {}) ⇒ AppMetadata constructor private
Instantiate the new AppMetadata object. - #validated_document ⇒ BSON::Document private
Get the metadata as BSON::Document to be sent to as part of the handshake.
Constructor Details
#initialize(options = {}) ⇒ AppMetadata
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.
Instantiate the new AppMetadata object.
| 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # File 'lib/mongo/server/app_metadata.rb', line 74 def initialize(options = {}) @app_name = options[:app_name].to_s if options[:app_name] @platform = options[:platform] @purpose = check_purpose!(options[:purpose]) @compressors = options[:compressors] || [] @wrapping_libraries = options[:wrapping_libraries] @server_api = options[:server_api] return unless options[:user] && !options[:auth_mech] auth_db = options[:auth_source] | | 'admin' @request_auth_mech = "#{auth_db}.#{options[:user]}" end | | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
Instance Attribute Details
#platform ⇒ String
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 The platform information given when the object was instantiated.
96 97 98 | # File 'lib/mongo/server/app_metadata.rb', line 96 def platform @platform end |
---|
#purpose ⇒ Symbol
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 The purpose of the connection for which this app metadata is created.
92 93 94 | # File 'lib/mongo/server/app_metadata.rb', line 92 def purpose @purpose end |
---|
#server_api ⇒ Hash | nil
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 The requested server API version.
Thes hash can have the following items:
- :version – string
- :strict – boolean
- :deprecation_errors – boolean.
104 105 106 | # File 'lib/mongo/server/app_metadata.rb', line 104 def server_api @server_api end |
---|
#wrapping_libraries ⇒ Array | nil
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 Information about libraries wrapping the driver.
108 109 110 | # File 'lib/mongo/server/app_metadata.rb', line 108 def wrapping_libraries @wrapping_libraries end |
---|
Instance Method Details
#client_document ⇒ BSON::Document
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.
Get BSON::Document to be used as value for ‘client` key in handshake document.
| 128 129 130 131 132 133 134 135 136 137 | # File 'lib/mongo/server/app_metadata.rb', line 128 def client_document @client_document ||= BSON::Document.new.tap do | doc| doc[:application] = { name: @app_name } if @app_name doc[:driver] = driver_doc doc[:os] = os_doc doc[:platform] = platform_string env_doc.tap { | env| doc[:env] = env if env } end end | | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
#validated_document ⇒ BSON::Document
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.
Get the metadata as BSON::Document to be sent to as part of the handshake. The document should be appended to a suitable handshake command.
This method ensures that the metadata are valid.
119 120 121 122 | # File 'lib/mongo/server/app_metadata.rb', line 119 def validated_document validate! document end |
---|