class CryStorage::PageManagement::Page(T)
Included Modules
Defined in:
page_manager.crConstant Summary
-
BODY_SIZE =
BYTE_SIZE - HEADER_SIZE
-
BYTE_SIZE =
1024_i64
-
HEADER_SIZE =
PageHeader::SIZE
-
SLOT_LINK_SIZE =
INT_SIZE * 2
Constructors
-
.new(manager : IManager, id : Index, table : TableSchema, buffer : IO::Memory)
TODO refactor to def initialize(@id : Index, @table : TableSchema, @manager : IManager = MemoryManager.default)
Instance Method Summary
-
#[]=(slot_id : Int, slot : ISlot)
Sets the given value at the given index.
-
#each(&)
Calls the given block once for each element in
self
, passing that element as a parameter. - #full?(slot : ISlot)
- #full?(slot_byte_size)
- #id : Index
- #indexer : Indexable::Mutable(IO::Memory)
- #last_index
- #not_full!(slot_byte_size)
- #push(slot : ISlot)
-
#size
Returns the number of elements in this container.
- #slot_cost(slot_byte_size)
- #space_left
- #table : TableSchema
- #table=(table : TableSchema)
- #to_io(io, format)
-
#to_s
Returns a nicely readable and concise string representation of this object, typically intended for users.
-
#unsafe_fetch(index : Int) : ISlot
Returns the element at the given index, without doing any bounds check.
- #unsafe_push(slot : ISlot)
-
#unsafe_put(index : Int, value : ISlot)
Sets the element at the given index to value, without doing any bounds check.
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
TODO refactor to def initialize(@id : Index, @table : TableSchema, @manager : IManager = MemoryManager.default)
Instance Method Detail
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
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 --
Returns the number of elements in this container.
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
.
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.
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.