Class: Innodb::UndoLog::UndoRecordCursor
- Inherits:
-
Object
- Object
- Innodb::UndoLog::UndoRecordCursor
- Defined in:
- lib/innodb/undo_log.rb
Instance Method Summary collapse
- #each_undo_record ⇒ Object
-
#initialize(undo_log, offset, direction = :forward) ⇒ UndoRecordCursor
constructor
A new instance of UndoRecordCursor.
- #next_undo_record ⇒ Object
- #prev_undo_record ⇒ Object
- #undo_record ⇒ Object
Constructor Details
#initialize(undo_log, offset, direction = :forward) ⇒ UndoRecordCursor
Returns a new instance of UndoRecordCursor.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/innodb/undo_log.rb', line 68 def initialize(undo_log, offset, direction=:forward) @initial = true @undo_log = undo_log @offset = offset @direction = direction case offset when :min @undo_record = @undo_log.min_undo_record when :max raise "Not implemented" else @undo_record = @undo_log.undo_record(offset) end end |
Instance Method Details
#each_undo_record ⇒ Object
110 111 112 113 114 115 116 117 118 |
# File 'lib/innodb/undo_log.rb', line 110 def each_undo_record unless block_given? return enum_for(:each_undo_record) end while rec = undo_record yield rec end end |
#next_undo_record ⇒ Object
84 85 86 87 88 |
# File 'lib/innodb/undo_log.rb', line 84 def next_undo_record if rec = @undo_record.next @undo_record = rec end end |
#prev_undo_record ⇒ Object
90 91 92 93 94 |
# File 'lib/innodb/undo_log.rb', line 90 def prev_undo_record if rec = @undo_record.prev @undo_record = rec end end |
#undo_record ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/innodb/undo_log.rb', line 96 def undo_record if @initial @initial = false return @undo_record end case @direction when :forward next_undo_record when :backward prev_undo_record end end |