class Innodb::HistoryList::UndoRecordCursor
Public Class Methods
new(history, undo_record, direction = :forward)
click to toggle source
# File lib/innodb/history_list.rb, line 15 def initialize(history, undo_record, direction = :forward) @history = history @undo_record = undo_record # rubocop:disable Style/IfUnlessModifier case undo_record when :min @undo_log_cursor = history.list.list_cursor(:min, direction) if (@undo_log = @undo_log_cursor.node) @undo_record_cursor = @undo_log.undo_record_cursor(:min, direction) end when :max @undo_log_cursor = history.list.list_cursor(:max, direction) if (@undo_log = @undo_log_cursor.node) @undo_record_cursor = @undo_log.undo_record_cursor(:max, direction) end else raise "Not implemented" end # rubocop:enable Style/IfUnlessModifier end
Public Instance Methods
each_undo_record() { |rec| ... }
click to toggle source
# File lib/innodb/history_list.rb, line 83 def each_undo_record return enum_for(:each_undo_record) unless block_given? while (rec = undo_record) yield rec end end
move_cursor(page, undo_record)
click to toggle source
# File lib/innodb/history_list.rb, line 52 def move_cursor(page, undo_record) @undo_log = page @undo_log_cursor = @undo_log.undo_record_cursor(undo_record, @direction) end
next_undo_record()
click to toggle source
# File lib/innodb/history_list.rb, line 57 def next_undo_record if (rec = @undo_record_cursor.undo_record) return rec end if (undo_log = @undo_log_cursor.node) @undo_log = undo_log @undo_record_cursor = @undo_log.undo_record_cursor(:min, @direction) end @undo_record_cursor.undo_record end
prev_undo_record()
click to toggle source
# File lib/innodb/history_list.rb, line 70 def prev_undo_record if (rec = @undo_log_cursor.undo_record) return rec end if (undo_log = @undo_log_cursor.node) @undo_log = undo_log @undo_record_cursor = @undo_log.undo_record_cursor(:max, @direction) end @undo_record_cursor.undo_record end
undo_record()
click to toggle source
# File lib/innodb/history_list.rb, line 37 def undo_record return nil unless @undo_record_cursor if (rec = @undo_record_cursor.undo_record) return rec end case @direction when :forward next_undo_record when :backward prev_undo_record end end