Class KyotoCabinet::Cursor
In: kyotocabinet.rb
Parent: Object

Interface of cursor to indicate a record.

Methods

accept   db   disable   error   get   get_key   get_value   inspect   jump   jump_back   remove   set_value   step   step_back   to_s  

Public Instance methods

Accept a visitor to the current record.

  • @param visitor a visitor object which implements the Visitor interface. If it is omitted, the block parameter is evaluated.
  • @param writable true for writable operation, or false for read-only operation.
  • @param step true to move the cursor to the next record, or false for no move.
  • @block If it is specified, the block is called as the visitor.
  • @return true on success, or false on failure.
  • @note The operation for each record is performed atomically and other threads accessing the same record are blocked. To avoid deadlock, any explicit database operation must not be performed in this method.

Get the database object.

  • @return the database object.

Disable the cursor.

  • @return always nil.
  • @note This method should be called explicitly when the cursor is no longer in use.

Get the last happened error.

  • @return the last happened error.

Get a pair of the key and the value of the current record.

  • @param step true to move the cursor to the next record, or false for no move.
  • @return a pair of the key and the value of the current record, or nil on failure.
  • @note If the cursor is invalidated, nil is returned.

Get the key of the current record.

  • @param step true to move the cursor to the next record, or false for no move.
  • @return the key of the current record, or nil on failure.
  • @note If the cursor is invalidated, nil is returned.

Get the value of the current record.

  • @param step true to move the cursor to the next record, or false for no move.
  • @return the value of the current record, or nil on failure.
  • @note If the cursor is invalidated, nil is returned.

Get the inspection string.

  • @return the inspection string.

Jump the cursor to a record for forward scan.

  • @param key the key of the destination record. If it is nil, the destination is the first record.
  • @return true on success, or false on failure.

Jump the cursor to a record for backward scan.

  • @param key the key of the destination record. If it is nil, the destination is the last record.
  • @return true on success, or false on failure.
  • @note This method is dedicated to tree databases. Some database types, especially hash databases, will provide a dummy implementation.

Remove the current record.

  • @return true on success, or false on failure.
  • @note If no record corresponds to the key, false is returned. The cursor is moved to the next record implicitly.

Set the value of the current record.

  • @param value the value.
  • @param step true to move the cursor to the next record, or false for no move.
  • @return true on success, or false on failure.

Step the cursor to the next record.

  • @return true on success, or false on failure.

Step the cursor to the previous record.

  • @return true on success, or false on failure.
  • @note This method is dedicated to tree databases. Some database types, especially hash databases, may provide a dummy implementation.

Get the string expression.

  • @return the string expression.