Class | Ole::Storage::AllocationTable |
In: |
lib/ole/storage/base.rb
|
Parent: | Array |
AllocationTable‘s hold the chains corresponding to files. Given an initial index, AllocationTable#chain follows the chain, returning the blocks that make up that file.
There are 2 allocation tables, the bbat, and sbat, for big and small blocks respectively. The block chain should be loaded using either Storage#read_big_blocks or Storage#read_small_blocks as appropriate.
Whether or not big or small blocks are used for a file depends on whether its size is over the Header#threshold level.
An Ole::Storage document is serialized as a series of directory objects, which are stored in blocks throughout the file. The blocks are either big or small, and are accessed using the AllocationTable.
The bbat allocation table‘s data is stored in the spare room in the header block, and in extra blocks throughout the file as referenced by the meta bat. That chain is linear, as there is no higher level table.
AllocationTable.new is used to create an empty table. It can parse a string with the load method. Serialization is accomplished with the to_s method.
AVAIL | = | 0xffffffff | a free block (I don‘t currently leave any blocks free), although I do pad out the allocation table with AVAIL to the block size. | |
EOC | = | 0xfffffffe | ||
BAT | = | 0xfffffffd | these blocks are used for storing the allocation table chains | |
META_BAT | = | 0xfffffffc |
block_size | [R] | |
io | [R] | |
ole | [R] |
rewrote this to be non-recursive as it broke on a large attachment chain with a stack error