THashCache

From Ultibo.org
Revision as of 04:17, 20 July 2023 by Ultibo (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Return to Unit Filesystem


Description


To be documented

Class definitions



[Expand]

THashCache = class(TObject)


Function declarations



[Expand]
constructor THashCache.Create(ADriver:TFileSysDriver);
Description: To be documented


[Expand]
destructor THashCache.Destroy;
Description: To be documented


[Expand]
function THashCache.AcquireLock:Boolean;
Description: To be documented


[Expand]
function THashCache.ReleaseLock:Boolean;
Description: To be documented


[Expand]
function THashCache.AddPage(APage:TCachePage):Boolean;
Description: Add a new page to the Page list and the Empty list


[Expand]
function THashCache.RemovePage(APage:TCachePage):Boolean;
Description: Remove a Page from the Page list and any other lists then Free the Page


[Expand]
function THashCache.AddEmpty(APage:TCachePage):Boolean;
Description: Add a Page to the Empty list, removing from other lists if needed


[Expand]
function THashCache.AddClean(APage:TCachePage):Boolean;
Description: Add a Page to the Clean list, removing from other lists if needed


[Expand]
function THashCache.AddDirty(APage:TCachePage):Boolean;
Description: Add a Page to the Dirty list, removing from other lists if needed


[Expand]
function THashCache.AddUnknown(APage:TCachePage):Boolean;
Description: Make a Page Unknown by removing from any other lists if needed


[Expand]
function THashCache.UpdateClean(APage:TCachePage):Boolean;
Description: Move a Page to the end of the Clean list


[Expand]
function THashCache.UpdateDirty(APage:TCachePage):Boolean;
Description: Move a Page to the end of the Dirty list


[Expand]
function THashCache.RoundPageSize(APageSize:LongWord):LongWord;
Description: Round Page Size to the power of 2 of Sector Size


[Expand]
function THashCache.RoundCacheSize(ACacheSize,APageSize:LongWord):LongWord;
Description: Round Cache Size to the next multiple of Page Size


[Expand]
function THashCache.AdjustCacheKeys(ACacheKeys:LongWord):LongWord;
Description: Adjust Cache Keys to be within safe limits


[Expand]
function THashCache.CalculatePageCount(ADevice:TDiskDevice):Word;
Description: Calculate the power of 2 multiple of sector size which will fit within the page


[Expand]
function THashCache.CalculatePageShift(ADevice:TDiskDevice):Word;
Description: Calculate the shift count for Page to Key conversion


[Expand]
function THashCache.CalculatePageMask(ADevice:TDiskDevice):LongWord;
Description: Calculate the mask for Sector to Page conversion


[Expand]
function THashCache.KeyLink(APage:THashCachePage):Boolean;
Description: Link APage to KeyPrev,KeyNext siblings and Adjust First


[Expand]
function THashCache.KeyUnlink(APage:THashCachePage):Boolean;
Description: Unlink APage from KeyPrev,KeyNext siblings and Adjust First


[Expand]
function THashCache.KeyFirst(AKeyHash:LongWord):THashCachePage;
Description: To be documented


[Expand]
function THashCache.LinkPage(APage:TCachePage):Boolean;
Description: Link APage to PrevPage,NextPage siblings and Adjust FirstPage/LastPage


[Expand]
function THashCache.UnlinkPage(APage:TCachePage):Boolean;
Description: Unlink APage from PrevPage,NextPage Siblings and Adjust FirstPage/LastPage


[Expand]
function THashCache.LinkEmpty(APage:TCachePage):Boolean;
Description: Link APage to PrevLink,NextLink siblings and Adjust FirstEmpty/LastEmpty


[Expand]
function THashCache.UnlinkEmpty(APage:TCachePage):Boolean;
Description: Unlink APage from PrevLink,NextLink Siblings and Adjust FirstEmpty/LastEmpty


[Expand]
function THashCache.LinkClean(APage:TCachePage):Boolean;
Description: Link APage to PrevLink,NextLink siblings and Adjust FirstClean/LastClean


[Expand]
function THashCache.UnlinkClean(APage:TCachePage):Boolean;
Description: Unlink APage from PrevLink,NextLink Siblings and Adjust FirstClean/LastClean


[Expand]
function THashCache.LinkDirty(APage:TCachePage):Boolean;
Description: Link APage to PrevLink,NextLink siblings and Adjust FirstDirty/LastDirty


[Expand]
function THashCache.UnlinkDirty(APage:TCachePage):Boolean;
Description: Unlink APage from PrevLink,NextLink Siblings and Adjust FirstDirty/LastDirty


[Expand]
function THashCache.PrepareDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; ASector,ACount:LongWord):Boolean;
Description: Prepare a Cache Page for Write by ensuring that required sectors are cached


[Expand]
function THashCache.CalculateDevicePage(ADevice:TDiskDevice; ASector:LongWord; var ACount:LongWord):Boolean;
Description: Calculate the number of sectors remaining in a page given the starting sector


[Expand]
function THashCache.OpenCache(ACacheSize,ACacheKeys,APageSize:LongWord; ACacheMode:TCacheMode):Boolean;
Description: Allocate the Memory, Create the Empty Pages and Open Cache


[Expand]
function THashCache.CloseCache:Boolean;
Description: Flush all Dirty Pages, Release the Memory and Close the Cache


[Expand]
function THashCache.DeviceRead(ADevice:TDiskDevice; ASector,ACount:LongWord; var ABuffer):Boolean;
Description: Read Data from the Physical Device using either Cached or Direct access


[Expand]
function THashCache.DeviceWrite(ADevice:TDiskDevice; ASector,ACount:LongWord; const ABuffer):Boolean;
Description: Write Data to the Physical Device using either Cached or Direct access


[Expand]
function THashCache.DeviceErase(ADevice:TDiskDevice; ASector,ACount:LongWord):Boolean;
Description: Erase Data from the Physical Device and update cached pages accordingly


[Expand]
function THashCache.GetDevicePage(ADevice:TDiskDevice; ASector:LongWord):TCachePage;
Description: Get the Clean or Dirty Page that contains this Sector on this Device


[Expand]
function THashCache.GetEmptyPage:TCachePage;
Description: Get the First Empty Page, Discard First Clean Page if none Empty


[Expand]
function THashCache.AllocDevicePage(ADevice:TDiskDevice; ASector:LongWord; AWrite:Boolean):TCachePage;
Description: Allocate an Empty Page to the Device and mark as Clean or Dirty


[Expand]
function THashCache.DiscardPage(APage:TCachePage):Boolean;
Description: Return a Clean Page to Empty


[Expand]
function THashCache.DiscardCache(AFirst,AAll:Boolean):Boolean;
Description: Find any Clean Pages older than DiscardTimeout and Discard them


[Expand]
function THashCache.ReleaseDevicePages(ADevice:TDiskDevice):Boolean;
Description: Return all Clean or Dirty Pages on the Device to Empty


[Expand]
function THashCache.FlushPage(APage:TCachePage):Boolean;
Description: Return a Dirty Page to Clean


[Expand]
function THashCache.FlushPageEx(APage:TCachePage):Boolean;
Description: Return a Dirty Page to Clean if it is older than FlushTimeout


[Expand]
function THashCache.FlushCache(AFirst,AAll:Boolean):Boolean;
Description: Find any Dirty Pages older than FlushTimeout and Flush them


[Expand]
function THashCache.CheckTimer:Boolean;
Description: To be documented


[Expand]
function THashCache.ProcessTimer:Boolean;
Description: To be documented


[Expand]
function THashCache.SchedulePage(APage:TCachePage; ATimeout:LongWord):Boolean;
Description: To be documented


[Expand]
function THashCache.UnschedulePage(APage:TCachePage):Boolean;
Description: To be documented


Return to Unit Reference