123456789_123456789_123456789_123456789_123456789_

Module: Mongo::Session::ServerSession::Dirtyable Private

Do not use. This module is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/mongo/session/server_session/dirtyable.rb

Overview

Functionality for manipulating and querying a session’s “dirty” state, per the last paragraph at github.com/mongodb/specifications/blob/master/source/sessions/driver-sessions.rst#server-session-pool

If a driver has a server session pool and a network error is
encountered when executing any command with a ClientSession, the
driver MUST mark the associated ServerSession as dirty. Dirty server
sessions are discarded when returned to the server session pool. It is
valid for a dirty session to be used for subsequent commands (e.g. an
implicit retry attempt, a later command in a bulk write, or a later
operation on an explicit session), however, it MUST remain dirty for
the remainder of its lifetime regardless if later commands succeed.

Since:

  • 2.5.0

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#dirty?true | false (readonly)

Query whether the server session has been marked dirty or not.

Returns:

  • (true | false)

    the server session’s dirty state

Since:

  • 2.5.0

[ GitHub ]

  
# File 'lib/mongo/session/server_session/dirtyable.rb', line 38

def dirty?
  @dirty
end

Instance Method Details

#dirty!(mark = true)

Mark the server session as dirty (the default) or clean.

Parameters:

  • mark (true | false) (defaults to: true)

    whether the mark the server session dirty or not.

Since:

  • 2.5.0

[ GitHub ]

  
# File 'lib/mongo/session/server_session/dirtyable.rb', line 46

def dirty!(mark = true)
  @dirty = mark
end