DIRECTORY AlpineEnvironment, AlpineFile, AlpineInternal, FileInstance, FileMap, TransactionMap; FileLog: DEFINITIONS = BEGIN FileID: TYPE = AlpineEnvironment.FileID; LockSubID: TYPE = AlpineInternal.LockSubID; LogRecordID: TYPE = AlpineInternal.LogRecordID; OwnerName: TYPE = AlpineEnvironment.OwnerName; PageCount: TYPE = AlpineEnvironment.PageCount; PageRun: TYPE = AlpineEnvironment.PageRun; ReferencePattern: TYPE = AlpineEnvironment.ReferencePattern; TransState: TYPE = AlpineInternal.TransState; VolumeID: TYPE = AlpineEnvironment.VolumeID; LogCreate: PROCEDURE [fileInstance: FileInstance.Handle, initialSize: PageCount, owner: OwnerName]; LogDelete: PROCEDURE [fileInstance: FileInstance.Handle]; LogSetSize: PROCEDURE [fileInstance: FileInstance.Handle, old, new: PageCount]; LogWritePages: PROCEDURE [fileInstance: FileInstance.Handle, where: LONG POINTER, pageRun: PageRun, referencePattern: ReferencePattern] RETURNS [recordID: LogRecordID]; LogReadPages: PROCEDURE [fileInstance: FileInstance.Handle, where: LONG POINTER, pageRun: PageRun, recordID: LogRecordID] RETURNS [referencePattern: ReferencePattern]; LogWriteLeaderPage: PROCEDURE [fileInstance: FileInstance.Handle, where: LONG POINTER] RETURNS [recordID: LogRecordID]; LogReadLeaderPage: PROCEDURE [fileInstance: FileInstance.Handle, where: LONG POINTER, recordID: LogRecordID]; LogFileLock: PROCEDURE [fileInstance: FileInstance.Handle]; RecoverCreate: PROCEDURE [fileInstance: FileInstance.Handle, initialSize: PageCount, outcome: TransState]; RecoverDelete: PROCEDURE [fileInstance: FileInstance.Handle, outcome: TransState]; RecoverSetSize: PROCEDURE [fileInstance: FileInstance.Handle, old, new: PageCount, outcome: TransState]; RecoverWritePages: PROCEDURE [fileInstance: FileInstance.Handle, recordID: LogRecordID, pageRun: PageRun, outcome: TransState]; RecoverWriteLeaderPage: PROCEDURE [fileInstance: FileInstance.Handle, recordID: LogRecordID, outcome: TransState]; RecoverLock: PROCEDURE [fileInstance: FileInstance.Handle, lockSubID: LockSubID, outcome: TransState]; DefinedFileRecord: TYPE = AlpineInternal.FileRecord[writePages..lock]; FileLogRecord: PRIVATE TYPE = MACHINE DEPENDENT RECORD [ volumeID (0): VolumeID, fileID (5): FileID, specifics (9): SELECT COMPUTED DefinedFileRecord FROM writePages => [ pageRun (9): PageRun, referencePattern (12): ReferencePattern, data (13): DataRep], writeLeaderPage => [data (9): DataRep], setSize => [old (9), new (11): PageCount], create => [initialSize (9): PageCount, owner (11): StringRep], delete => [], lock => [lockSubID (9): LockSubID], ENDCASE]; DataRep: PRIVATE TYPE = MACHINE DEPENDENT RECORD [ ARRAY [0..0) OF WORD]; StringRep: PRIVATE TYPE = MACHINE DEPENDENT RECORD [ length (0): CARDINAL, text (1): PACKED ARRAY [0..0) OF CHARACTER]; END. (FileLog.mesa Last edited by: MBrown on January 30, 1984 5:24:32 pm PST Taft on April 6, 1983 5:14 pm This interface captures all interactions between the AlpineFile implementation and the Log. Exported from FileLogImpl, for writing and reading log records during normal operation ! Log.WriteFailed; Logs the creation of a file (as an undo action). Note: this operation forces the log to stable storage. ! Log.WriteFailed; Logs the deletion of a file (as a deferred action). ! Log.WriteFailed; Logs a change in the size of a file. old should be the committed size of the file. This is a deferred action if newold. ! Log.WriteFailed; Writes a writePages log record from memory. Reads the specified pageRun interval of the file designated by fileInstance into memory starting at where. recordID identifies a writePages record which the caller asserts includes the requested interval. Returns the ReferencePattern which was passed to LogWritePages. A fatal error occurs if pageRun is not a subinterval of the pageRun actually contained in the log record or if the log record describes a write to the wrong file. ! Log.WriteFailed; Writes a writeLeaderPage log record from memory. Reads a writeLeaderPage log record into memory. Raises WrongLengthRecord if the log record is not precisely the right length. A fatal error occurs if the log record describes a write to the wrong file. ! Log.WriteFailed; Logs the setting of a file write lock (only write locks are logged). Imported by FileLogImpl, for processing log records during recovery. Each takes as arguments the information that was passed to the corresponding WriteXXX procedure which wrote the log record, plus the transaction outcome which is {committed, aborted, ready}. Note that the calls are made only for files which still exist at recovery time. Note: type and owner are not passed, as they are not actually needed for recovery, and constructing an owner string from the log record is a messy job. Log record representation old is needed for undo actions, which arise only if new>old. ΚP– "cedar" style˜Jšœ ™ šœ™Jšœ)™)Jšœ™—J˜Jšœ[™[unitšΟk ˜ Icode˜L˜ L˜L˜ L˜L˜—šœ  œ˜Lš˜L˜Lšœœ˜(Lšœ œ˜+Lšœ œ˜/Lšœ œ˜.Lšœ œ˜.Lšœ œ˜*Lšœœ&˜L˜ L˜#Lšœ˜ ——š œ œœœ œœ˜2Lšœœœ˜—š œ œœœ œœ˜4Lšœ œ˜Lš œ œœœ œ˜,—Kšœ˜——…— θ`