class CryStorage::PageManagement::Page(T)

Included Modules

Defined in:

page_manager.cr

Constant Summary

BODY_SIZE = BYTE_SIZE - HEADER_SIZE
BYTE_SIZE = 1024_i64
HEADER_SIZE = PageHeader::SIZE
SLOT_LINK_SIZE = INT_SIZE * 2

Constructors

Instance Method Summary

Instance methods inherited from module Indexable::Item(IO::Memory)

flush flush, id : CryStorage::Index id, indexer indexer

Instance methods inherited from class CryStorage::PageManagement::IPage

id id, push(slot : ISlot) push, space_left space_left, table table

Instance methods inherited from module Enumerable(CryStorage::PageManagement::ISlot)

tabulate(io) tabulate

Instance methods inherited from class Object

tabulate(io)
tabulate
tabulate
, tap(&) tap

Constructor Detail

def self.new(manager : IManager, id : Index, table : TableSchema, buffer : IO::Memory) #

TODO refactor to def initialize(@id : Index, @table : TableSchema, @manager : IManager = MemoryManager.default)


[View source]

Instance Method Detail

def []=(slot_id : Int, slot : ISlot) #
Description copied from module Indexable::Mutable(CryStorage::PageManagement::ISlot)

Sets the given value at the given index. Returns value.

Negative indices can be used to start counting from the end of the container. Raises IndexError if trying to set an element outside the container's range.

ary = [1, 2, 3]
ary[0] = 5
ary # => [5, 2, 3]

ary[3] = 5 # raises IndexError

[View source]
def each(&) #
Description copied from module Indexable(CryStorage::PageManagement::ISlot)

Calls the given block once for each element in self, passing that element as a parameter.

a = ["a", "b", "c"]
a.each { |x| print x, " -- " }

produces:

a -- b -- c --

[View source]
def full?(slot : ISlot) #

[View source]
def full?(slot_byte_size) #

[View source]
def id : Index #

[View source]
def indexer : Indexable::Mutable(IO::Memory) #

[View source]
def last_index #

[View source]
def not_full!(slot_byte_size) #

[View source]
def push(slot : ISlot) #

[View source]
def size #
Description copied from module Indexable(CryStorage::PageManagement::ISlot)

Returns the number of elements in this container.


[View source]
def slot_cost(slot_byte_size) #

[View source]
def space_left #

[View source]
def table : TableSchema #

[View source]
def table=(table : TableSchema) #

[View source]
def to_io(io, format) #

[View source]
def to_s #
Description copied from class Object

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.


[View source]
def unsafe_fetch(index : Int) : ISlot #
Description copied from module Indexable(CryStorage::PageManagement::ISlot)

Returns the element at the given index, without doing any bounds check.

Indexable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they access elements with #[](index) and #[]?(index).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.


[View source]
def unsafe_push(slot : ISlot) #

[View source]
def unsafe_put(index : Int, value : ISlot) #
Description copied from module Indexable::Mutable(CryStorage::PageManagement::ISlot)

Sets the element at the given index to value, without doing any bounds check.

Indexable::Mutable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they modify elements with #[]=(index, value).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.


[View source]