Class: Innodb::Page::Index::RecordCursor
- Inherits:
-
Object
- Object
- Innodb::Page::Index::RecordCursor
- Defined in:
- lib/innodb/page/index.rb
Overview
A class for cursoring through records starting from an arbitrary point.
Instance Method Summary collapse
-
#initialize(page, offset) ⇒ RecordCursor
constructor
A new instance of RecordCursor.
-
#record ⇒ Object
Return the next record, and advance the cursor.
Constructor Details
#initialize(page, offset) ⇒ RecordCursor
Returns a new instance of RecordCursor.
418 419 420 421 |
# File 'lib/innodb/page/index.rb', line 418 def initialize(page, offset) @page = page @offset = offset end |
Instance Method Details
#record ⇒ Object
Return the next record, and advance the cursor. Return nil when the end of records is reached.
425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'lib/innodb/page/index.rb', line 425 def record return nil unless @offset record = @page.record(@offset) if record == @page.supremum @offset = nil else @offset = record[:next] record end end |