📄 absdiskengine.hpp
字号:
public:
void __fastcall ReadPageRegion(void *Buffer, int PageNo, Word Offset, Word Count);
void __fastcall WritePageRegion(const void *Buffer, int PageNo, Word Offset, Word Count);
void __fastcall WriteEmptyPage(int PageNo);
virtual void __fastcall InternalAddPage(Abspage::TABSPage* aPage);
virtual void __fastcall InternalRemovePage(int PageNo);
virtual bool __fastcall InternalReadPage(Abspage::TABSPage* aPage);
virtual void __fastcall InternalWritePage(Abspage::TABSPage* aPage);
int __fastcall InternalReadPageState(int PageNo);
void __fastcall InternalWritePageState(int PageNo, int PageState);
virtual Abspage::TABSPage* __fastcall GetPage(int SessionID, int PageNo, Word PageType, bool SynchronizeAllowed = true);
virtual void __fastcall RemovePage(int SessionID, int PageNo);
bool __fastcall LockFreeSpaceManager(void);
bool __fastcall UnlockFreeSpaceManager(void);
bool __fastcall LockTables(void);
bool __fastcall UnlockTables(void);
bool __fastcall LockDBHeader(void);
bool __fastcall UnlockDBHeader(void);
bool __fastcall LockLastObjectID(void);
bool __fastcall UnlockLastObjectID(void);
bool __fastcall LockPageByte(int PageNo, Word Offset);
bool __fastcall UnlockPageByte(int PageNo, Word Offset);
bool __fastcall IsPageByteLocked(int PageNo, Word Offset);
bool __fastcall IsPageRegionLocked(int PageNo, Word Offset, Word Count);
__fastcall TABSDiskPageManager(void);
__fastcall virtual ~TABSDiskPageManager(void);
void __fastcall CreateAndOpenDatabase(AnsiString DatabaseFileName, const Abssecurity::TABSPassword &Password, Word PageSize = (Word)(0x1000), Word ExtentPageCount = (Word)(0x8));
void __fastcall OpenDatabase(AnsiString DatabaseFileName, const Abssecurity::TABSPassword &Password, bool &ReadOnly, bool &RepairNeeded, bool Exclusive, bool &MultiUser);
void __fastcall CloseDatabase(void);
void __fastcall TruncateDatabase(void);
void __fastcall ExtendFile(int PageCount);
void __fastcall TruncateFile(int PageCount);
int __fastcall GetNextObjectID(int TryCount = 0x5, int DelayMS = 0x64);
void __fastcall InitObjectID(int TryCount = 0x5, int DelayMS = 0x64);
virtual void __fastcall ApplyChanges(int SessionID);
__property TABSDatabaseFile* DatabaseFile = {read=FDatabaseFile};
__property Abstypes::PABSDBHeader DBHeader = {read=GetDbHeader};
__property Abstypes::TABSLockedBytes LockedBytes = {read=FLockedBytes};
__property Abssecurity::PABSPassword Password = {read=GetPassword};
__property bool IsOpened = {read=GetIsOpened, nodefault};
__property __int64 OffsetToFirstPage = {read=FOffsetToFirstPage};
__property __int64 OffsetToLockedBytes = {read=FOffsetToLockedBytes};
__property TABSDatabaseFreeSpaceManager* FreeSpaceManager = {read=FDatabaseFreeSpaceManager};
__property TABSDiskTablePagesCacheManager* TablePagesCacheManager = {read=FTablePagesCacheManager};
__property bool Exclusive = {read=FExclusive, nodefault};
__property bool Encrypted = {read=GetEncrypted, nodefault};
};
class DELPHICLASS TABSInternalDBTransactedAccessFile;
class PASCALIMPLEMENTATION TABSInternalDBTransactedAccessFile : public System::TObject
{
typedef System::TObject inherited;
private:
TABSDiskPageManager* LPageManager;
int FStartPageNo;
Word FPageTypeID;
void __fastcall SetStartPageNo(int StartPageNo);
void __fastcall CheckFileOpened(AnsiString OperationName);
int __fastcall GetPageCountForDataSize(int DataSize);
void __fastcall GetPageNoAndOffsetForPosition(int Position, int &PagePosition, Word &Offset);
int __fastcall GoToPage(int SessionID, int PagePosition);
public:
__fastcall TABSInternalDBTransactedAccessFile(TABSDiskPageManager* PageManager, Word PageTypeID);
__fastcall virtual ~TABSInternalDBTransactedAccessFile(void);
void __fastcall CreateFile(int SessionID);
void __fastcall DeleteFile(int SessionID, int StartPageNo = 0xffffffff);
void __fastcall OpenFile(int StartPageNo);
void __fastcall SetFileSize(int SessionID, int NewSize, int DecompressedSize, Abscompression::TABSCompressionAlgorithm CompressionAlgorithm);
void __fastcall GetFileSize(int SessionID, int &Size, int &DecompressedSize, Abscompression::TABSCompressionAlgorithm &CompressionAlgorithm, bool &FileWasChanged, bool SyncronizeAllowed);
int __fastcall GetSize(int SessionID);
void __fastcall ReadFile(int SessionID, void *Buffer, const int Count, bool SynchronizeAllowed = true);
void __fastcall WriteFile(int SessionID, const void *Buffer, const int Count, const Abscompression::TABSCompressionAlgorithm Algorithm = (Abscompression::TABSCompressionAlgorithm)(0x0), const int CompressionMode = 0x0);
bool __fastcall LockFile(void);
bool __fastcall UnlockFile(void);
__property TABSDiskPageManager* PageManager = {read=LPageManager};
__property int StartPageNo = {read=FStartPageNo, nodefault};
};
class PASCALIMPLEMENTATION TABSSystemDirectory : public System::TObject
{
typedef System::TObject inherited;
private:
TABSDiskPageManager* LPageManager;
TABSInternalDBTransactedAccessFile* FHandle;
DynamicArray<Abstypes::TABSSystemDirectoryListItem > FFileList;
public:
__fastcall TABSSystemDirectory(TABSDiskPageManager* PageManager);
__fastcall virtual ~TABSSystemDirectory(void);
void __fastcall CreateDirectory(void);
void __fastcall LoadDirectory(void);
void __fastcall SaveDirectory(void);
void __fastcall CreateFile(Abstypes::TABSDBFileType FileType, int FirstPageNo);
int __fastcall GetFileFirstPageNo(Abstypes::TABSDBFileType FileType);
__property TABSDiskPageManager* PageManager = {read=LPageManager};
};
class DELPHICLASS TABSActiveSessionsFile;
class DELPHICLASS TABSInternalDBDirectAccessFile;
class PASCALIMPLEMENTATION TABSInternalDBDirectAccessFile : public System::TObject
{
typedef System::TObject inherited;
private:
TABSDiskPageManager* LPageManager;
int FStartPageNo;
Word FPageTypeID;
int FFileSize;
Abstypes::TABSIntegerArray* FFilePages;
void __fastcall SetStartPageNo(int StartPageNo);
void __fastcall ReadPageHeader(int PageNo, Abstypes::TABSDiskPageHeader &PageHeader, bool SkipFirstByte = false);
void __fastcall CheckFileOpened(AnsiString OperationName);
int __fastcall GetPageCountForDataSize(int DataSize);
void __fastcall GetPageNoAndOffsetForPosition(int Position, int &PagePosition, Word &Offset);
void __fastcall ReadPageList(void);
int __fastcall GoToPage(int PagePosition);
void __fastcall InternalSeek(int FileOffset, /* out */ int &PageNo, /* out */ Word &PageOffset);
public:
__fastcall TABSInternalDBDirectAccessFile(TABSDiskPageManager* PageManager, Word PageTypeID);
__fastcall virtual ~TABSInternalDBDirectAccessFile(void);
void __fastcall CreateFile(int Size);
void __fastcall DeleteFile(int StartPageNo = 0xffffffff);
void __fastcall OpenFile(int StartPageNo);
int __fastcall GetSize(void);
void __fastcall ReadBuffer(void *Buffer, const int Count, const int Position = 0xffffffff);
void __fastcall WriteBuffer(const void *Buffer, const int Count, const int Position = 0xffffffff);
bool __fastcall LockFile(void);
bool __fastcall UnlockFile(void);
bool __fastcall LockByte(int ByteNo);
bool __fastcall UnlockByte(int ByteNo);
bool __fastcall IsByteLocked(int ByteNo);
bool __fastcall IsRegionLocked(int ByteNo, int ByteCount);
__property TABSDiskPageManager* PageManager = {read=LPageManager};
__property int StartPageNo = {read=FStartPageNo, nodefault};
};
class PASCALIMPLEMENTATION TABSActiveSessionsFile : public System::TObject
{
typedef System::TObject inherited;
private:
TABSDiskPageManager* LPageManager;
TABSInternalDBDirectAccessFile* FHandle;
int FMaxSessionCount;
int __fastcall GetStartPageNo(void);
public:
__fastcall TABSActiveSessionsFile(Abspage::TABSPageManager* PageManager);
__fastcall virtual ~TABSActiveSessionsFile(void);
int __fastcall CreateFile(int aMaxSessionCount);
void __fastcall OpenFile(int aStartPageNo);
void __fastcall CloseFile(void);
int __fastcall MultiUserConnect(void);
void __fastcall MultiUserDisconnect(int SessionID);
bool __fastcall SingleUserConnect(void);
void __fastcall SingleUserDisconnect(void);
int __fastcall GetDBFileConnectionsCount(void);
__property int StartPageNo = {read=GetStartPageNo, nodefault};
__property int MaxSessionCount = {read=FMaxSessionCount, nodefault};
};
class DELPHICLASS TABSTableListFile;
class PASCALIMPLEMENTATION TABSTableListFile : public System::TObject
{
typedef System::TObject inherited;
private:
TABSDiskPageManager* LPageManager;
TABSInternalDBTransactedAccessFile* FHandle;
DynamicArray<Abstypes::TABSTableListItem > FTableList;
int __fastcall GetStartPageNo(void);
int __fastcall GetTableIndex(AnsiString TableName);
public:
__fastcall TABSTableListFile(Abspage::TABSPageManager* PageManager);
__fastcall virtual ~TABSTableListFile(void);
int __fastcall CreateFile(void);
void __fastcall OpenFile(int aStartPageNo);
void __fastcall CloseFile(void);
void __fastcall Load(void);
void __fastcall Save(void);
void __fastcall AddTable(int TableID, AnsiString TableName, int MetadataFilePageNo, int MostUpdatedFilePageNo, int LocksFilePageNo);
void __fastcall RemoveTable(AnsiString TableName);
void __fastcall OpenTable(AnsiString TableName, /* out */ int &TableID, /* out */ int &MetadataFilePageNo, /* out */ int &MostUpdatedFilePageNo, /* out */ int &LocksFilePageNo);
void __fastcall RenameTable(AnsiString TableName, AnsiString NewTableName);
bool __fastcall TableExists(AnsiString TableName);
void __fastcall GetTablesList(Classes::TStrings* List);
__property int StartPageNo = {read=GetStartPageNo, nodefault};
};
class DELPHICLASS TABSDatabaseTableLockManager;
class DELPHICLASS TABSTableLocksFile;
class PASCALIMPLEMENTATION TABSDatabaseTableLockManager : public System::TObject
{
typedef System::TObject inherited;
private:
Classes::TList* FSessionLockList;
int FMaxSessionCount;
_RTL_CRITICAL_SECTION FCSect;
Abspage::TABSPageManager* LPageManager;
void __fastcall Lock(void);
void __fastcall Unlock(void);
bool __fastcall AddSIRWLocksToULocks(int SessionID);
bool __fastcall SetPhysicalLockForWeakerLocks(int SessionID, Abstypes::TABSLockType LockType, TABSTableLocksFile* TableLocksFile);
public:
__fastcall TABSDatabaseTableLockManager(int MaxSessionCount, Abspage::TABSPageManager* PageManager);
__fastcall virtual ~TABSDatabaseTableLockManager(void);
bool __fastcall LockTable(int SessionID, Abstypes::TABSLockType LockType, TABSTableLocksFile* TableLocksFile, int aTryCount, int aDelayMS, bool NoThreadLock = false, bool AllowXIRWAfterSIRW = true);
bool __fastcall UnlockTable(int SessionID, Abstypes::TABSLockType LockType, TABSTableLocksFile* TableLocksFile, bool IgnoreIfNoLock = false, bool IgnoreCount = false);
bool __fastcall LockRecord(int SessionID, TABSTableLocksFile* TableLocksFile, const Abstypes::TABSPageItemID &RecordID, int aTryCount, int aDelayMS);
bool __fastcall UnlockRecord(int SessionID, TABSTableLocksFile* TableLocksFile, const Abstypes::TABSPageItemID &RecordID);
bool __fastcall AddRWLocksBeforeCommit(int SessionID);
bool __fastcall ClearTransactionLocks(int SessionID);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -