Class: Innodb::DataType::RollPointerType

Inherits:
Object
  • Object
show all
Extended by:
ReadBitsAtOffset
Defined in:
lib/innodb/data_type.rb

Overview

Rollback data pointer.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ReadBitsAtOffset

read_bits_at_offset

Constructor Details

#initialize(base_type, modifiers, properties) ⇒ RollPointerType

Returns a new instance of RollPointerType.



344
345
346
347
# File 'lib/innodb/data_type.rb', line 344

def initialize(base_type, modifiers, properties)
  @width = 7
  @name = Innodb::DataType.make_name(base_type, modifiers, properties)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



342
343
344
# File 'lib/innodb/data_type.rb', line 342

def name
  @name
end

#widthObject (readonly)

Returns the value of attribute width.



342
343
344
# File 'lib/innodb/data_type.rb', line 342

def width
  @width
end

Class Method Details

.parse_roll_pointer(roll_ptr) ⇒ Object



349
350
351
352
353
354
355
356
357
358
# File 'lib/innodb/data_type.rb', line 349

def self.parse_roll_pointer(roll_ptr)
  {
    :is_insert  => read_bits_at_offset(roll_ptr, 1, 55) == 1,
    :rseg_id    => read_bits_at_offset(roll_ptr, 7, 48),
    :undo_log   => {
      :page   => read_bits_at_offset(roll_ptr, 32, 16),
      :offset => read_bits_at_offset(roll_ptr, 16, 0),
    }
  }
end

Instance Method Details

#value(data) ⇒ Object



360
361
362
363
# File 'lib/innodb/data_type.rb', line 360

def value(data)
  roll_ptr = BinData::Uint56be.read(data)
  self.class.parse_roll_pointer(roll_ptr)
end