-- File: DBStorageInternalImpl.mesa -- Last edited by MBrown on 17-Jun-81 10:33:47 -- Last Edited by: Cattell, September 29, 1983 6:43 pm DIRECTORY DBCache USING[CacheHandle], DBCommon USING[DBPage], DBEnvironment USING[InternalError], DBSegment USING[SegmentIDFromDBPage], DBStorage USING[TupleHandle, IndexObjectSize, ReadNWord, WriteNWord], DBStorageField USING[TuplesetFieldHandle], DBStorageInternal USING[TupleTree, TupleTreeRecord, TID], DBStorageTID USING[TID, DecomposeTID], DBStorageTuple USING[ConsTupleObject, TIDOfTuple]; DBStorageInternalImpl: PROGRAM IMPORTS DBEnvironment, DBSegment, DBStorage, DBStorageField, DBStorageTID, DBStorageTuple EXPORTS DBStorageInternal = BEGIN OPEN DBStorageTID; -- This module implements DBStorageInternal. ReadIndexObject: PUBLIC PROC[ t: DBStorage.TupleHandle, result: DBStorageInternal.TupleTree] = { -- PARAMETERS: t is an index tuple, i.e. a tuple whose first field is an index object; -- result points to a TupleTreeRecord that may be overwritten. -- EFFECTS: the index object contained in tuple t is written into result. IF SIZE[DBStorageInternal.TupleTreeRecord] > DBStorage.IndexObjectSize THEN ERROR DBEnvironment.InternalError; DBStorage.ReadNWord[t, DBStorageField.TuplesetFieldHandle[], result]; };--ReadIndexObject WriteIndexObject: PUBLIC PROC[ t: DBStorage.TupleHandle, val: DBStorageInternal.TupleTree] = { -- PARAMETERS: an index tuple, i.e. a tuple whose first field is an index object, -- and a value for such and object. -- EFFECTS: writes the value val into the index object field of tuple t. IF SIZE[DBStorageInternal.TupleTreeRecord] # DBStorage.IndexObjectSize THEN ERROR DBEnvironment.InternalError; DBStorage.WriteNWord[t, DBStorageField.TuplesetFieldHandle[], val]; };--WriteIndexObject SegmentIDOfTuple: PUBLIC PROC[ t: DBStorage.TupleHandle] RETURNS[--segmentID--DBCommon.DBPage] = { -- RESULTS: the "segment ID" of the segment that contains tuple t. dbPage: DBCommon.DBPage; [dbPage,] _ DecomposeTID[TIDOfTuple[t]]; RETURN[DBSegment.SegmentIDFromDBPage[dbPage]]; };--SegmentIDOfTuple TIDOfTuple: PUBLIC PROC[t: DBStorage.TupleHandle] RETURNS[DBStorageInternal.TID] = { -- RESULTS: the TID of tuple t (suitable for storing in an index). RETURN[DBStorageTuple.TIDOfTuple[t]]; };--TIDOfTuple MakeTupleHandle: PUBLIC PROC[ tid: DBStorageInternal.TID, cacheHint: DBCache.CacheHandle _ NIL] RETURNS[DBStorage.TupleHandle] = { -- RESULTS: a tuple handle that contains the given TID and CacheHandle. RETURN[DBStorageTuple.ConsTupleObject[tid: tid, cacheHint: cacheHint]]; };--MakeTupleHandle END.--StorageInternalImpl CHANGE LOG Created by MBrown on 9-May-80 10:54 Changed by MBrown on June 8, 1980 9:35 PM -- Changed to use DBStorageField. Changed by MBrown on June 11, 1980 3:53 PM -- Changed to use DBStorageTuple. Changed by MBrown on September 26, 1980 4:35 PM -- Converted to new DBException. Changed by MBrown on February 27, 1981 5:25 PM -- Pre-Pilot changes. Changed by MBrown on 17-Jun-81 10:32:40 -- ReleaseTupleHandle is now a no-op, remove from here and make INLINE in interface.