Struct rustdb::compact::CompactFile[][src]

pub struct CompactFile {
    pub stg: Box<dyn Storage>,
    // some fields omitted
}
Expand description

CompactFile stores logical pages in smaller regions of backing storage.

Each logical page has a fixed size “starter page”.

A logical page that does not fit in the “starter page” has 1 or more “extension pages”.

Each extension page starts with it’s containing logical page number ( to allow extension pages to be relocated as required ).

When a new extension page is needed, it is allocated from the end of the file.

When an extension page is freed, the last extension page in the file is relocated to fill it.

If the starter page array needs to be enlarged, the first extension page is relocated to the end of the file.

File layout: file header | starter pages | extension pages.

Layout of starter page: 2 byte logical page size | array of 8 byte page numbers | user data | unused data.

Note: for a free logical page, a special value is stored after the page size, then a link to the next free logical page.

Layout of extension page: 8 byte logical page number | user data | unused data.

Fields

stg: Box<dyn Storage>

Underlying storage.

Implementations

Construct a new CompactFile.

Get the current size of the specified logical page.

Set the contents of the page.

Get logical page contents.

Allocate logical page number. Pages are numbered 0,1,2…

Free a logical page number.

Is this a new file?

Resets logical page allocation to last save.

Process the temporary sets of free pages and write the file header.

Check whether compressing a page is worthwhile.

Get the set of free logical pages ( also verifies free chain is ok ).

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.