Page Set
Information
This class is huge and has a boatload of functionality.
First and foremost this class is a "radix" of pages.
A Radix (in this case a 27 by 27 radix) is an array that has a value hashed like a hashmap. In this case the first two letter of a page are "encoded" and then if that matches the whole page name is compared to get the result (see PageSet::Make Radix?).
Note that the Radix does not contain ALL of the pages, just 27*27 of them. Each page itself is actually a linked list and points to the next page in the list with mNext. So, when there is a Radix match it actually searches all pages in that particular list.
For memory reasons, it is probably not the greatest idea to have all pages in memory at once. One way would be to just get the information from a file.
CreatePage returns the page if it exists or creates a new one - EnsurePage basically does the same thing only allows you to specify its contents in one fell swoop as well.
GetPageInfo and SetPageInfo get/set information from the page's .wkv file which contains revisioning information.
NOTE: This should really be renamed to .wkp or something for compatability and just use an INI/Headers-compatable format instead.
LoadPage/UnloadPage (un)load the "mASCII" member of the page which is the actual contents of the page.
ValidatePage, currently unused, slowly makes sure the revisions of a page are on disk correctly. If they are not, it tries to recover the revisions it can.
Note that the Page Set instance is shared so all accesses to the page radix are locked with a Spin Lock? so there are not any thread problems. However, an alternative wouldn't be a bad idea...
Credits
- Eddie Edwards (<eddie@tinyted.net>)
- Ryan Norton (<wxprojects@comcast.net>)