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

Included in:
Mongo::Session::ServerSession
Defined in:
lib/mongo/session/server_session/dirtyable.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.

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 Method Summary collapse

Instance Method Details

#dirty!(mark = true) ⇒ Object

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.

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



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

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

#dirty?true | false

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.

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

Returns:

  • (true | false)

    the server session’s dirty state

Since:

  • 2.5.0



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

def dirty?
  @dirty
end