Pager

PDBM in the lowest level is splited into IO chunks called Page. Every Page has the same size. A Page has a Data, a blocked information and pointers to anothers Pages.The Data size is by default 1024 bytes but this could be changed in pager.h #define CHUNK_SIZE, this need to be power of 2 between 512 - 65535 bytes.

Multiple process could read a Page at the same time, but when a process wants to write on it, the Page is become blocked, no one could read or write, only the process wich block could write. After the Page is writed the Page is unlocked.


The Pager Struct defined at pager.h

Another important feature of our Pager is that a Page has a pointer to the next Page, this gives the flexibilty for write emulate Sequential Data into the file. To see this feature in examples look down at the examples.

Here we have a File splited into Pages
but Every Page is free



Now Write Data 1 (Red), Data 2 (Yellow),
and Data 3 (Green). Look that they
are written in sequencial mode.



Now we append more information to Data 1,
look where is the new Page, that is still
sequencial data, becouse they have a pointer



Now we resize Data 3, note that the Pages
now is Grey, that mean that those Pages
are free.



Now we append more information to Data 2
Look that the Pager gives free pages
instaed to create new pages. With this feature
we control the free pages.

The Pager API provied functions to manipulate Data not Page. That mean that with the Pager API you are not able to read or write a Pager directly, just Read, Write, Modify, Resize and Delete a Data.

 

This project is Public Domain. For more information write to
This project is developed and mainted by Guaranix Fundation Code