Class Mongo::Cluster::CursorReaper
In: lib/mongo/cluster/reapers/cursor_reaper.rb
Parent: Object

A manager that sends kill cursors operations at regular intervals to close cursors that have been garbage collected without being exhausted.

@api private

@since 2.3.0

Methods

Included Modules

Retryable

Constants

FREQUENCY = 1.freeze   The default time interval for the cursor reaper to send pending kill cursors operations.

@since 2.3.0

Public Class methods

Create a cursor reaper.

@example Create a CursorReaper.

  Mongo::Cluster::CursorReaper.new(cluster)

@api private

@since 2.3.0

Public Instance methods

execute()

Alias for kill_cursors

flush()

Alias for kill_cursors

Execute all pending kill cursors operations.

@example Execute pending kill cursors operations.

  cursor_reaper.kill_cursors

@api private

@since 2.3.0

Register a cursor id as active.

@example Register a cursor as active.

  cursor_reaper.register_cursor(id)

@param [ Integer ] id The id of the cursor to register as active.

@api private

@since 2.3.0

Schedule a kill cursors operation to be eventually executed.

@example Schedule a kill cursors operation.

  cursor_reaper.schedule_kill_cursor(id, op_spec, server)

@param [ Integer ] id The id of the cursor to kill. @param [ Hash ] op_spec The spec for the kill cursors op. @param [ Mongo::Server ] server The server to send the kill cursors operation to.

@api private

@since 2.3.0

Unregister a cursor id, indicating that it‘s no longer active.

@example Unregister a cursor.

  cursor_reaper.unregister_cursor(id)

@param [ Integer ] id The id of the cursor to unregister.

@api private

@since 2.3.0

[Validate]