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.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/innodb/undo_log.rb', line 93 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
133 134 135 136 137 138 139 |
# File 'lib/innodb/undo_log.rb', line 133 def each_undo_record return enum_for(:each_undo_record) unless block_given? while (rec = undo_record) yield rec end end |
#next_undo_record ⇒ Object
109 110 111 112 |
# File 'lib/innodb/undo_log.rb', line 109 def next_undo_record rec = @undo_record.next @undo_record = rec if rec end |
#prev_undo_record ⇒ Object
114 115 116 117 |
# File 'lib/innodb/undo_log.rb', line 114 def prev_undo_record rec = @undo_record.prev @undo_record = rec if rec end |
#undo_record ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/innodb/undo_log.rb', line 119 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 |