-- WalnutDBLog.Mesa
-- Contents: types and procedures for dealing with the log information in the database
-- Last Edited by: Willie-Sue, July 19, 1983 5:37 pm

DIRECTORY
DB;

WalnutDBLog: CEDAR DEFINITIONS =

BEGIN OPEN DB;

SchemaVersionTime: DB.GMT;
-- schemaVersion is time found in database

SchemaMismatch: SIGNAL[schemaVersion: DB.GMT];

walnutLogInfo: Relation; -- used to keep current info about the log file
wExpectedLength: Attribute; -- int (how long the log file is)
wExpectedDBPos: Attribute; -- int (how much of the log has been parsed into Msgs)
wStartExpungePos: Attribute; -- int (where in log file the last/current expunge started)
wCopyInProgress: Attribute; -- bool (TRUE while Copying onto tail of log file)
wSchemaVersion: Attribute; -- time (for keeping track of changes in walnut's schema)
wLogFileName: Attribute; -- string (where to find the log file)

walnutInfoRelship: Relship;  -- need fetch & check only once

-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

GetCurrentLogFile: PROC RETURNS[ROPE];
-- Retrieves name for current log file from database

-- SetCurrentLogFile: PROC[fileName: ROPE] is allowed only by Expunge

GetExpectedLogLength: PROC RETURNS[INT];
-- Retrieves last stored log length from database (used for recovery from crash)

SetExpectedLogLength: PROC[INT];
-- sets the log length in the database

SetExpectedDBLogPos: PROC[INT];
-- sets the last stored DB log position

GetExpectedDBLogPos: PROC RETURNS[INT];
-- Retrieves last stored DB log pos from database (used for recovery from crash)

GetStartExpungePos: PROC RETURNS[INT];
-- Log file position at which current/last expunge began

SetStartExpungePos: PROC[INT];
 -- set the starting position of the next expunge

GetCopyInProgress: PROC RETURNS[BOOL];
-- returns TRUE if a copy onto tail of log file is in progress

SetCopyInProgress: PROC[BOOL];
 -- set the copy in progress bit in the DB

END.