Class: Mongo::Cluster::AppMetadata Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mongo/cluster/app_metadata.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 in an ismaster command,

when a new connection is established.

Since:

  • 2.4.0

Constant Summary

MAX_DOCUMENT_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 metadata document byte size.

Since:

  • 2.4.0

512.freeze
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.

@ since 2.4.0

Since:

  • 2.4.0

128.freeze
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.

@ since 2.4.0

Since:

  • 2.4.0

'mongo-ruby-driver'

Instance Method Summary collapse

Constructor Details

#initialize(cluster) ⇒ 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.

Examples:

Instantiate the app metadata.

Mongo::Cluster.AppMetadata.new(cluster)

Parameters:

Since:

  • 2.4.0



54
55
56
57
# File 'lib/mongo/cluster/app_metadata.rb', line 54

def initialize(cluster)
  @app_name = cluster.options[:app_name]
  @platform = cluster.options[:platform]
end

Instance Method Details

#ismaster_bytesString

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 bytes of the ismaster message including this metadata.

Examples:

Get the ismaster message bytes.

.ismaster_bytes

Returns:

  • (String)

    The raw bytes.

Since:

  • 2.4.0



69
70
71
# File 'lib/mongo/cluster/app_metadata.rb', line 69

def ismaster_bytes
  @ismaster_bytes ||= validate! && serialize.to_s
end