Class: Moped::Protocol::KillCursors

Inherits:
Object
  • Object
show all
Includes:
Message
Defined in:
lib/moped/protocol/kill_cursors.rb

Overview

The Protocol class for killing active cursors.

Examples:

command = KillCursors.new [123, 124, 125]

Setting the request id

command = KillCursors.new [123, 124, 125], request_id: 456

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Message

included, #inspect, #receive_replies, #serialize

Constructor Details

#initialize(cursor_ids, options = {}) ⇒ KillCursors

Create a new command to kill cursors.

Parameters:

  • cursor_ids (Array)

    an array of cursor ids to kill

  • options (Hash) (defaults to: {})

    additional options

Options Hash (options):

  • :request_id (Number)

    the command’s request id



51
52
53
54
55
# File 'lib/moped/protocol/kill_cursors.rb', line 51

def initialize(cursor_ids, options = {})
  @cursor_ids           = cursor_ids
  @number_of_cursor_ids = cursor_ids.length
  @request_id           = options[:request_id]
end

Instance Attribute Details

#cursor_idsArray

Returns the cursor ids to kill.

Returns:

  • (Array)

    the cursor ids to kill



36
# File 'lib/moped/protocol/kill_cursors.rb', line 36

int64    :cursor_ids, type: :array

#lengthNumber

Returns the length of the message.

Returns:

  • (Number)

    the length of the message



16
# File 'lib/moped/protocol/kill_cursors.rb', line 16

int32 :length

#number_of_cursor_idsNumber

Returns the number of cursor ids.

Returns:

  • (Number)

    the number of cursor ids



32
# File 'lib/moped/protocol/kill_cursors.rb', line 32

int32    :number_of_cursor_ids

#op_codeNumber

Returns OP_KILL_CURSORS operation code (2007).

Returns:

  • (Number)

    OP_KILL_CURSORS operation code (2007)



26
# File 'lib/moped/protocol/kill_cursors.rb', line 26

int32 :op_code

#request_idNumber

Returns the request id of the message.

Returns:

  • (Number)

    the request id of the message



20
# File 'lib/moped/protocol/kill_cursors.rb', line 20

int32 :request_id

Instance Method Details

#log_inspectObject



57
58
59
60
61
# File 'lib/moped/protocol/kill_cursors.rb', line 57

def log_inspect
  type = "KILL_CURSORS"

  "%-12s cursor_ids=%s" % [type, cursor_ids.inspect]
end