File DBStorageTSDict.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited by MBrown on August 12, 1980 4:03 PM
Willie-Sue, February 15, 1985 11:18:03 am PST
DIRECTORY
DBCommon USING[DBPage],
DBStorageTID USING[TID],
DBStorageVec USING[SlotIndexField, VecPage, VecHeader];
DBStorageTSDict:
CEDAR
DEFINITIONS =
BEGIN
OPEN DBCommon, DBStorageTID;
This interface defines types associated with tupleset dictionaries, and gives some
operations on them.
TSDicts live in a known slot, which allows operations below to take pointers to pages
rather than pointers to TSDicts.
The selection of interface operations seems QUITE ad-hoc; hopefully that will be fixed.
Reserved slot index on tuple pages:
TSDictSlotIndex: DBStorageVec.SlotIndexField = 1;
This slot points to the tupleset dictionary vec.
TSDict:
TYPE =
MACHINE
DEPENDENT
RECORD[
header: DBStorageVec.VecHeader,
TSDict is stored in a vec, so prefix is a VecHeader
allocLink: DBPage,
TSDict is stored in a vec, so prefix is a VecHeader
seq:
ARRAY [1..1)
OF TSDictEntry
sequence of TSDictEntry, length implicit in header.length
indices in this array are used as slot types; NOTE 1-origin
];--TSDict
TSDictEntry:
TYPE =
MACHINE
DEPENDENT
RECORD[
tuplesetID: TID,
next: DBPage,
prev: DBPage
links in a doubly-linked list of pages that contain tuples from this tupleset
];--TSDictEntry
In addition to serving as a method of assigning short names to tuple types, the
tupleset dictionary is used to link together all pages that contain tuples of a
given type. This allows a tupleset to be scanned without looking at all pages in
the segment. There is a corresponding cost when tuples are created and destroyed.
SizeOfInitialTSDict: CARDINAL = SIZE[TSDict] + SIZE[TSDictEntry];
SizeOfNullTSDict: CARDINAL = SIZE[TSDict];
NEntries:
PROC[
LONG
POINTER
TO TSDict]
RETURNS[
CARDINAL];
Returns the number of TSDictEntries in the seq of a TSDict. This can be computed
from the VecHeader.
GetIndex:
PROC[
--p--
LONG
POINTER
TO DBStorageVec.VecPage,
--tsID--
TID]
RETURNS[
--index--
CARDINAL,
--found it--
BOOLEAN];
Returns index of the TSDictEntry on page p that contains tsID as its tuplesetID field.
Second result is TRUE iff entry was actually found; otherwise we return 1+number of entries in
the TSDict, and FALSE.
GetEntry:
PROC[
--p--
LONG
POINTER
TO DBStorageVec.VecPage,
--tsID--
TID]
RETURNS[
LONG
POINTER
TO TSDictEntry];
Returns ptr to the TSDictEntry on page p that contains tsID as its tuplesetID field.
ERRORs InternalBug if no such entry exists.
EntryFromIndex:
PROC[
--p--
LONG
POINTER
TO DBStorageVec.VecPage,
--index--
CARDINAL]
RETURNS[
LONG
POINTER
TO TSDictEntry];
Returns ptr to the index-th TSDictEntry on page p.
ERRORs InternalBug if no such entry exists.
END.--DBStorageTSDict
CHANGE LOG
Created by MBrown on June 14, 1980 9:10 PM
Moved types here from DBStoragePrivateB, made procs accessible.
Changed by MBrown on July 24, 1980 9:18 PM
Added EntryFromIndex, for use in StorageTuplesetScanImpl. Added allocLink field to TSDict.
Changed by MBrown on August 12, 1980 4:03 PM
Moved TSDictSlotIndex here, from DBStoragePrivateB.
Changed by Willie-Sue on February 15, 1985
made Cedar, added tioga formatting