BackupBTree.mesa
Carl Hauser, November 21, 1985 3:06:34 pm PST
DIRECTORY
AlpineEnvironment USING [UniversalFile],
AlpineLog USING [RecordID],
AlpTransaction USING [Handle],
BackupLog USING [nullRecordID, RecordID],
BasicTime USING [GMT],
BTree USING [Relation],
Rope USING [ROPE];
BackupBTree: CEDAR DEFINITIONS
~ BEGIN
Reason: TYPE = {transactionFailure, lockFailure, damagedBTree};
transactionFailure => client should re-open the BackupBTree and start processing from the positions returned by GetPositionInfo
lockFailure => client programming error: no other transactions should be manipulating the file containing the BackupBTree.
damagedBTree => BTree package detected an error in the state of the btree. If you're lucky, aborting the transaction will fix it. If not, well ...
Error: ERROR[why: Reason];
OpenForNormalOperation: PROC [trans: AlpTransaction.Handle, btreeFile: AlpineEnvironment.UniversalFile, initialize: BOOLFALSE];
Prepares the database for reading and writing by the backup process.
Commit: PROC [];
Commits all activity since previous commit or open. In the normal case the transaction remains valid for further work.
OpenForRecovery: PROC [];
Prepares the database for reading during recovery.
SetFileInfo: PROC [universalFile: AlpineEnvironment.UniversalFile, baseRecord, lastIncrementRecord: BackupLog.RecordID ← BackupLog.nullRecordID, name: Rope.ROPE];
SetFileInfo records baseRecord and lastIncrementRecord in the database under the following interpretation:
SELECT TRUE FROM
baseRecord = nullRecord AND lastIncrementRecord = nullRecord => update both to nullRecord.
baseRecord = nullRecord AND lastIncrementRecord # nullRecord => update only lastIncrementRecord
baseRecord # nullRecord AND lastIncrementRecord = nullRecord => update only baseRecord
baseRecord # nullRecord AND lastIncrementRecord # nullRecord => update both.
END
GetFileInfo: PROC [universalFile: AlpineEnvironment.UniversalFile, relation: BTree.Relation ← equal] RETURNS [found: BOOLEAN, baseRecord, lastIncrementRecord, prevBaseRecord: BackupLog.RecordID , name: Rope.ROPE];
GetFileInfo returns the recorded information for the first file matching universalFile according to relation.
DeleteFileInfo: PROC [universalFile: AlpineEnvironment.UniversalFile] RETURNS [found: BOOLEAN];
DeleteFileInfo removes the entry for the universalFile from the BTree.
SetPositionInfo: PROC [logRecord: AlpineLog.RecordID, backupRecord: BackupLog.RecordID];
Remember the progress of the backup process.
GetPositionInfo: PROC [] RETURNS [logRecord: AlpineLog.RecordID, backupRecord: BackupLog.RecordID];
Retrieve progress of the backup process.
SetFullyConsistent: PROC [backupRecord: BackupLog.RecordID, time: BasicTime.GMT];
GetFullyConsistent: PROC RETURNS [backupRecord: BackupLog.RecordID, time: BasicTime.GMT];
END.