Difference between revisions of "TIncrementalCache"
From Ultibo.org
Line 45: | Line 45: | ||
|- | |- | ||
| <code>FKeyMask:LongWord;</code> | | <code>FKeyMask:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FKeyShift:LongWord;</code> | ||
| | | | ||
|- | |- | ||
Line 260: | Line 263: | ||
|- | |- | ||
| <code>function PrepareDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; var ASector:LongWord; var ACount:Word):Boolean;</code> | | <code>function PrepareDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; var ASector:LongWord; var ACount:Word):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CompleteDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; ASector,ACount:LongWord):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CalculateDevicePage(ADevice:TDiskDevice; ASector:LongWord; var ACount:LongWord):Boolean;</code> | ||
| | | | ||
|- | |- | ||
Line 783: | Line 792: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function TIncrementalCache.PrepareDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; ASector,ACount:LongWord):Boolean;</pre> | <pre style="border: 0; padding-bottom:0px;">function TIncrementalCache.PrepareDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; ASector,ACount:LongWord):Boolean;</pre> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Prepare an incremental Cache Page for Write by ensuring that required sectors are cached</div> | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Prepare an incremental Cache Page for Write by ensuring that all required sectors are cached</div> |
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Sector | ||
+ | | Passed Sector will be the starting sector for the write to this Page | ||
+ | |- | ||
+ | ! Count | ||
+ | | Passed Count will be the write count to this Page (Calculated by caller) | ||
+ | |- | ||
+ | ! Note | ||
+ | | Only called internally by DeviceWrite | ||
+ | Caller must hold the lock | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function TIncrementalCache.CompleteDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; ASector,ACount:LongWord):Boolean;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Complete an incremental Cache Page Write by ensuring that all written sectors are marked dirty</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" |
Latest revision as of 04:21, 20 July 2023
Return to Unit Filesystem
Description
To be documented
Class definitions
[Expand]
TIncrementalCache = class(TObject)
Function declarations
[Expand]
constructor TIncrementalCache.Create(ADriver:TFileSysDriver);
Description: To be documented
[Expand]
function TIncrementalCache.AddPage(APage:TCachePage):Boolean;
Description: Add a new page to the Page list and the Empty list
[Expand]
function TIncrementalCache.RemovePage(APage:TCachePage):Boolean;
Description: Remove a Page from the Page list and any other lists then Free the Page
[Expand]
function TIncrementalCache.AddEmpty(APage:TCachePage):Boolean;
Description: Add a Page to the Empty list, removing from other lists if needed
[Expand]
function TIncrementalCache.AddClean(APage:TCachePage):Boolean;
Description: Add a Page to the Clean list, removing from other lists if needed
[Expand]
function TIncrementalCache.AddDirty(APage:TCachePage):Boolean;
Description: Add a Page to the Dirty list, removing from other lists if needed
[Expand]
function TIncrementalCache.AddUnknown(APage:TCachePage):Boolean;
Description: Make a Page Unknown by removing from any other lists if needed
[Expand]
function TIncrementalCache.UpdateClean(APage:TCachePage):Boolean;
Description: Move a Page to the end of the Clean list
[Expand]
function TIncrementalCache.UpdateDirty(APage:TCachePage):Boolean;
Description: Move a Page to the end of the Dirty list
[Expand]
function TIncrementalCache.RoundPageSize(APageSize:LongWord):LongWord;
Description: Round Page Size to the power of 2 of Sector Size
[Expand]
function TIncrementalCache.RoundCacheSize(ACacheSize,APageSize:LongWord):LongWord;
Description: Round Cache Size to the next multiple of Page Size
[Expand]
function TIncrementalCache.AdjustCacheKeys(ACacheKeys:LongWord):LongWord;
Description: Adjust Cache Keys to be within safe limits
[Expand]
function TIncrementalCache.CalculatePageCount(ADevice:TDiskDevice):Word;
Description: Calculate the power of 2 multiple of sector size which will fit within the page
[Expand]
function TIncrementalCache.CalculatePageShift(ADevice:TDiskDevice):Word;
Description: Calculate the shift count for Page to Key conversion
[Expand]
function TIncrementalCache.CalculatePageMask(ADevice:TDiskDevice):LongWord;
Description: Calculate the mask for Sector to Page conversion
[Expand]
function TIncrementalCache.KeyLink(APage:THashCachePage):Boolean;
Description: Link APage to KeyPrev,KeyNext siblings and Adjust First
[Expand]
function TIncrementalCache.KeyUnlink(APage:THashCachePage):Boolean;
Description: Unlink APage from KeyPrev,KeyNext siblings and Adjust First
[Expand]
function TIncrementalCache.KeyFirst(AKeyHash:LongWord):THashCachePage;
Description: To be documented
[Expand]
function TIncrementalCache.LinkPage(APage:TCachePage):Boolean;
Description: Link APage to PrevPage,NextPage siblings and Adjust FirstPage/LastPage
[Expand]
function TIncrementalCache.UnlinkPage(APage:TCachePage):Boolean;
Description: Unlink APage from PrevPage,NextPage Siblings and Adjust FirstPage/LastPage
[Expand]
function TIncrementalCache.LinkEmpty(APage:TCachePage):Boolean;
Description: Link APage to PrevLink,NextLink siblings and Adjust FirstEmpty/LastEmpty
[Expand]
function TIncrementalCache.UnlinkEmpty(APage:TCachePage):Boolean;
Description: Unlink APage from PrevLink,NextLink Siblings and Adjust FirstEmpty/LastEmpty
[Expand]
function TIncrementalCache.LinkClean(APage:TCachePage):Boolean;
Description: Link APage to PrevLink,NextLink siblings and Adjust FirstClean/LastClean
[Expand]
function TIncrementalCache.UnlinkClean(APage:TCachePage):Boolean;
Description: Unlink APage from PrevLink,NextLink Siblings and Adjust FirstClean/LastClean
[Expand]
function TIncrementalCache.LinkDirty(APage:TCachePage):Boolean;
Description: Link APage to PrevLink,NextLink siblings and Adjust FirstDirty/LastDirty
[Expand]
function TIncrementalCache.UnlinkDirty(APage:TCachePage):Boolean;
Description: Unlink APage from PrevLink,NextLink Siblings and Adjust FirstDirty/LastDirty
[Expand]
function TIncrementalCache.PrepareDeviceRead(ADevice:TDiskDevice; APage:TCachePage; ASector,ACount:LongWord):Boolean;
Description: Prepare an incremental Cache Page for Read by ensuring that all required sectors are cached
[Expand]
function TIncrementalCache.PrepareDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; ASector,ACount:LongWord):Boolean;
Description: Prepare an incremental Cache Page for Write by ensuring that all required sectors are cached
[Expand]
function TIncrementalCache.CompleteDeviceWrite(ADevice:TDiskDevice; APage:TCachePage; ASector,ACount:LongWord):Boolean;
Description: Complete an incremental Cache Page Write by ensuring that all written sectors are marked dirty
[Expand]
function TIncrementalCache.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 TIncrementalCache.OpenCache(ACacheSize,ACacheKeys,APageSize:LongWord; ACacheMode:TCacheMode):Boolean;
Description: Allocate the Memory, Create the Empty Pages and Open Cache
[Expand]
function TIncrementalCache.CloseCache:Boolean;
Description: Flush all Dirty Pages, Release the Memory and Close the Cache
[Expand]
function TIncrementalCache.DeviceRead(ADevice:TDiskDevice; ASector,ACount:LongWord; var ABuffer):Boolean;
Description: Read Data from the Physical Device using either Cached or Direct access
[Expand]
function TIncrementalCache.DeviceWrite(ADevice:TDiskDevice; ASector,ACount:LongWord; const ABuffer):Boolean;
Description: Write Data to the Physical Device using either Cached or Direct access
[Expand]
function TIncrementalCache.DeviceErase(ADevice:TDiskDevice; ASector,ACount:LongWord):Boolean;
Description: Erase Data from the Physical Device and update cached pages accordingly
[Expand]
function TIncrementalCache.GetDevicePage(ADevice:TDiskDevice; ASector:LongWord):TCachePage;
Description: Get the Clean or Dirty Page that contains this Sector on this Device
[Expand]
function TIncrementalCache.GetEmptyPage:TCachePage;
Description: Get the First Empty Page, Discard First Clean Page if none Empty
[Expand]
function TIncrementalCache.AllocDevicePage(ADevice:TDiskDevice; ASector:LongWord; AWrite:Boolean):TCachePage;
Description: Allocate an Empty Page to the Device and mark as Clean or Dirty
[Expand]
function TIncrementalCache.DiscardPage(APage:TCachePage):Boolean;
Description: Return a Clean Page to Empty
[Expand]
function TIncrementalCache.DiscardCache(AFirst,AAll:Boolean):Boolean;
Description: Find any Clean Pages older than DiscardTimeout and Discard them
[Expand]
function TIncrementalCache.ReleaseDevicePages(ADevice:TDiskDevice):Boolean;
Description: Return all Clean or Dirty Pages on the Device to Empty
[Expand]
function TIncrementalCache.FlushPage(APage:TCachePage):Boolean;
Description: Return a Dirty Page to Clean
[Expand]
function TIncrementalCache.FlushPageEx(APage:TCachePage):Boolean;
Description: Return a Dirty Page to Clean if it is older than FlushTimeout
[Expand]
function TIncrementalCache.FlushCache(AFirst,AAll:Boolean):Boolean;
Description: Find any Dirty Pages older than FlushTimeout and Flush them
[Expand]
function TIncrementalCache.SchedulePage(APage:TCachePage; ATimeout:LongWord):Boolean;
Description: To be documented
[Expand]
function TIncrementalCache.UnschedulePage(APage:TCachePage):Boolean;
Description: To be documented
Return to Unit Reference