DIRECTORY AlpTransaction USING[Handle], Atom USING [GetPropFromList], Commander USING [Handle], PrincOps USING [wordsPerPage], Rope USING[ROPE], IO USING [STREAM], ProcessProps USING [GetPropList]; DBCommon: CEDAR DEFINITIONS IMPORTS Atom, ProcessProps = BEGIN SegmentIndex: TYPE = INT [0 .. 512); Segment: TYPE = ATOM; Transaction: TYPE = AlpTransaction.Handle; TransactionHandle: TYPE = REF TransactionObject; TransactionObject: TYPE = RECORD[trans: Transaction, segments: SegmentList]; SegmentList: TYPE = REF SegmentListObject; SegmentListObject: TYPE = RECORD[segment: Segment, next: SegmentList]; FirstLast: TYPE = {First, Last} _ First; TID: TYPE = LONG CARDINAL _ 0; TupleHandle: TYPE = REF TupleObject; TupleObject: TYPE = RECORD[ tid: TID, succ, pred: TupleHandle, cacheHint: CacheHandle ]; CacheHandle: TYPE = REF CacheRecord; CacheRecord: TYPE = RECORD [ dbPage: DBCommon.DBPage, pagePtr: LONG POINTER, lockCount: [0..7777B] _ 0, occupied: BOOL _ FALSE, written: BOOL _ FALSE, readonly: BOOL _ FALSE, pred: CacheHandle, succ: CacheHandle, hashChain: CacheHandle ]; IndexKey: TYPE = LONG POINTER TO READONLY KeyBody; KeyBody: TYPE = MACHINE DEPENDENT RECORD [ text: PACKED SEQUENCE length: CARDINAL OF CHAR ]; softwareCompatibilityVersion: INTEGER = 5; systemIndexCount: CARDINAL = 2; domainIndex: CARDINAL = 0; -- the index on the set of domains (by name) relationIndex: CARDINAL = 1; -- the index on the set of relations (by name) DBPage: TYPE = LONG CARDINAL; NullDBPage: DBPage = 0; NotOnList: DBPage = LAST[LONG CARDINAL]; PagesPerDBPage: CARDINAL = 1; WordsPerPage: CARDINAL = PagesPerDBPage * PrincOps.wordsPerPage; BytesPerPage: CARDINAL = 2*WordsPerPage; LogOfWordsPerPage: CARDINAL = 8; LogOfBytesPerPage: CARDINAL = LogOfWordsPerPage+1; MaskOfWordsPerPage: CARDINAL = WordsPerPage-1; MaskOfBytesPerPage: CARDINAL = BytesPerPage-1; PagesForBytes: PROC [nBytes: LONG CARDINAL] RETURNS[CARDINAL] = INLINE { RETURN[nBytes/BytesPerPage]}; VersionOptions: TYPE = {NewFileOnly, OldFileOnly, None}; SegmentID: TYPE = DBPage; -- with lots of low-order zeroes. OpenFileHandle: TYPE = REF ANY; GetDebugStream: PROC RETURNS [IO.STREAM] = INLINE { ch: Commander.Handle_ NARROW[Atom.GetPropFromList[ProcessProps.GetPropList[], $CommanderHandle]]; RETURN [ch.out]}; END.--DBCommon LDBCommon.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last edited by MBrown on December 14, 1982 2:16 pm Cattell on November 10, 1983 2:10 am Willie-Sue on: February 18, 1985 8:37:49 am PST Donahue, March 3, 1986 7:47:12 am PST Widom, September 6, 1985 6:44:23 pm PDT This interface contains things that don't fit anywhere else. number to identify a segment used to define which end of an enumeration to start on A pointer to a tuple in the database. Its structure is given by the procedures in DBStorageTID The tuples handles currently allocated are linked (by segment) in a list so that they can be nullified when necessary hint in finding the cache page for the tid A CacheHandle represents an association between a database page and a core page. This association is guaranteed while the page is "locked", but may be broken at other times. Access to a page is more efficient if the CacheHandle is known in addition to the DBPage address, since hashing is avoided. database page number location of the cache page in memory incremented by read page, write page; decremented by unlock page. If >0, page will not move in core or leave cache. true if this page contains valid data (is contained in ht). true if this page has been written, needs to be stored back to file system. true iff this page cannot be written (according to the file system). Doubly-linked list of cache handles, used to maintain LRU information. Singly-linked list of cache handles, used to resolve hash table collisions. READONLY Index keys are accessible through the DBStorage interface Version of DB software. When new segment are created, five indices are established for use by Cypress itself. These include indices on the names of domain, relations and attributes and indices on the types of attributes and the relations to which attributes belong. "Virtual address" of a page in a database. Interpreted by the segment implementation only. DBSegmentPrivate and DBStorageTID include definitions relevant to more detailed interpretation. A DBPage address that represents "no page" (NIL, used to terminate lists). A DBPage address that represents "page not part of a list". the rest are all defined in terms of WordsPerPage Versions that may be specified to ObtainFile. Common IO stream procs Gives a place to print debugging info; creates Viewer typescript on screen. ΚΚ˜šœ ™ Jšœ Οmœ1™<—Jšœ™Jšœ#™#Jšœ%™%Jšœ/™/Icode™%J™'˜šΟk ˜ Jšœžœ ˜Jšœžœ˜Jšœ žœ ˜Jšœ žœ˜Jšœžœžœ˜Jšžœžœžœ˜Jšœ žœ˜!J˜——šœ žœž ˜J˜Jšžœ˜J˜Jšœž˜J™Jšœ<™