Module: Mongo::ClusterTime::Consumer Private

Included in:
Mongo::Cluster, Session
Defined in:
lib/mongo/cluster_time.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Note:

Although attributes and methods defined in this module are part of the public API for the classes including this module, the fact that the methods are defined on this module and not directly on the including classes is not part of the public API.

This module provides common cluster time tracking behavior.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cluster_timenil | ClusterTime (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 cluster time tracked by the object including this module.

Changed in version 2.9.0: This attribute became an instance of ClusterTime, which is a subclass of BSON::Document. Previously it was an instance of BSON::Document.

Returns:

Since:

  • 2.5.0



106
107
108
# File 'lib/mongo/cluster_time.rb', line 106

def cluster_time
  @cluster_time
end

Instance Method Details

#advance_cluster_time(new_cluster_time) ⇒ ClusterTime

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.

Advance the tracked cluster time document for the object including this module.

Parameters:

  • new_cluster_time (BSON::Document)

    The new cluster time document.

Returns:

Since:

  • 2.5.0



116
117
118
119
120
121
122
# File 'lib/mongo/cluster_time.rb', line 116

def advance_cluster_time(new_cluster_time)
  @cluster_time = if @cluster_time
                    @cluster_time.advance(new_cluster_time)
                  else
                    ClusterTime[new_cluster_time]
                  end
end