class CryStorage::PageManagement::MemoryManager
Defined in:
page_manager.crConstant Summary
-
MAX_SIZE =
20
-
PAGE_SIZE =
1024
Constructors
Class Method Summary
Instance Method Summary
-
#[](index : Int) : IO::Memory
Returns the element at the given index.
- #[]=(index : Int, page : IPage)
- #new_page : Tuple(Index, IO::Memory)
-
#size : Int
Returns the number of elements in this container.
-
#unsafe_fetch(index : Int) : IO::Memory
Returns the element at the given index, without doing any bounds check.
-
#unsafe_put(index : Int, value : IO::Memory)
Sets the element at the given index to value, without doing any bounds check.
Instance methods inherited from class CryStorage::PageManagement::IManager
new_page : Tuple(Index, IO::Memory)
new_page,
new_table_page(schema, cls = Page(Slot))
new_table_page,
table_page(id, schema, cls = Page(Slot))
table_page
Instance methods inherited from module Enumerable(IO::Memory)
tabulate(io)
tabulate
Instance methods inherited from class Object
tabulate(io)tabulate tabulate, tap(&) tap
Constructor Detail
Class Method Detail
Instance Method Detail
Returns the element at the given index.
Negative indices can be used to start counting from the end of the array.
Raises IndexError
if trying to access an element outside the array's range.
ary = ['a', 'b', 'c']
ary[0] # => 'a'
ary[2] # => 'c'
ary[-1] # => 'c'
ary[-2] # => 'b'
ary[3] # raises IndexError
ary[-4] # raises IndexError
Returns the number of elements in this container.
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.