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



123
124
125
# File 'lib/mongo/cluster_time.rb', line 123

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



133
134
135
136
137
138
139
# File 'lib/mongo/cluster_time.rb', line 133

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