Class: Innodb::DataType::RollPointerType

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

Overview

Rollback data pointer.

Defined Under Namespace

Classes: 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.



380
381
382
383
# File 'lib/innodb/data_type.rb', line 380

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.



377
378
379
# File 'lib/innodb/data_type.rb', line 377

def name
  @name
end

#widthObject (readonly)

Returns the value of attribute width.



378
379
380
# File 'lib/innodb/data_type.rb', line 378

def width
  @width
end

Class Method Details

.parse_roll_pointer(roll_ptr) ⇒ Object



385
386
387
388
389
390
391
392
393
394
# File 'lib/innodb/data_type.rb', line 385

def self.parse_roll_pointer(roll_ptr)
  Pointer.new(
    is_insert: read_bits_at_offset(roll_ptr, 1, 55) == 1,
    rseg_id: read_bits_at_offset(roll_ptr, 7, 48),
    undo_log: Innodb::Page::Address.new(
      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



396
397
398
399
# File 'lib/innodb/data_type.rb', line 396

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