Class BufferCursor
In: lib/innodb/util/buffer_cursor.rb
Parent: Object

A cursor to walk through data structures to read fields. The cursor can move forwards, backwards, is seekable, and supports peeking without moving the cursor. The BinData module is used for interpreting bytes as desired.

Methods

Classes and Modules

Class BufferCursor::StackEntry

Constants

VERSION = "0.9.0"

Public Class methods

Initialize a cursor within a buffer at the given position.

Enable tracing for all BufferCursor objects globally.

Public Instance methods

Adjust the current cursor to a new relative position.

Set the direction of the cursor to "backward".

The current cursor object; the top of the stack.

Iterate through length bytes returning each as an unsigned 8-bit integer.

Set the direction of the cursor to "forward".

Read an array of 1-bit integers.

Return raw bytes.

Return raw bytes as hex.

Read an InnoDB-compressed unsigned 32-bit integer (1-5 bytes).

The first byte makes up part of the value stored as well as indicating the number of bytes stored, maximally an additional 4 bytes after the flag for integers >= 0xf0000000.

Optionally accept a flag (first byte) if it has already been read (as is the case in get_imc_uint64).

Read an InnoDB-compressed unsigned 64-bit integer (5-9 bytes).

The high 32 bits are stored as an InnoDB-compressed unsigned 32-bit integer (1-5 bytes) while the low 32 bits are stored as a standard big-endian 32-bit integer (4 bytes). This makes a combined size of between 5 and 9 bytes.

Read an InnoDB-"much compressed" unsigned 64-bit integer (1-11 bytes).

If the first byte is 0xff, this indicates that the high 32 bits are stored immediately afterwards as an InnoDB-compressed 32-bit unsigned integer. If it is any other value it represents the first byte (which is also a flag) of the low 32 bits of the value, also as an InnoDB- compressed 32-bit unsigned integer. This makes for a combined size of between 1 and 11 bytes.

Read a big-endian signed 16-bit integer.

Return a null-terminated string.

Read a big-endian unsigned 16-bit integer.

Read a big-endian unsigned 24-bit integer.

Read a big-endian unsigned 32-bit integer.

Read a big-endian unsigned 48-bit integer.

Read a big-endian unsigned 64-bit integer.

Read an unsigned 8-bit integer.

Read an array of count unsigned integers given their size in bytes.

Read a big-endian unsigned integer given its size in bytes.

Execute a block and restore the cursor to the previous position after the block returns. Return the block‘s return value after restoring the cursor. Optionally seek to provided position before executing block.

Restore the last cursor position.

Return the position of the current cursor.

Print a trace output for this cursor. The method is passed a cursor object, position, raw byte buffer, and array of names.

Save the current cursor position and start a new (nested, stacked) cursor.

Read a number of bytes forwards or backwards from the current cursor position and adjust the cursor position by that amount.

Generate a trace record from the current cursor.

Move the current cursor to a new absolute position.

Set a Proc or method on self to trace with.

[Validate]