<> <> <> <> <> <> <> <> <> DIRECTORY DBCache USING[CacheHandle], DB, DBStorage, Rope; DBTuplesConcrete: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; TupleHandle, TupleSet, Index, IndexFactor: TYPE = REF TupleObject; Domain, Relation, Attribute, DataType: TYPE = Entity; Relship: TYPE = REF RelshipObject; Entity: TYPE = REF EntityObject; EntityObject: TYPE = TupleObject; RelshipObject: TYPE = TupleObject; SystemATuple: TYPE = REF attribute TupleObject; SystemTSTuple: TYPE = REF tupleSet TupleObject; SystemSTuple: TYPE = REF surrogate TupleObject; TupleObject: TYPE = RECORD[ tid: LONG CARDINAL, pred: TupleHandle _ NIL, succ: TupleHandle _ NIL, <> otherInfo: SELECT type: DBStorage.TupleObjectType FROM stored => [ -- tid > DBStorage.MaxSystemTuplesetID cacheHint: DBCache.CacheHandle ], -- hint in finding the cache page for the tid tupleSet => [ -- tid IN [TupleSetTSID..IndexFactorTSID] vTuple: DBStorage.SystemTuplesetHandle_ NIL, -- corresponding system tupleset vName: ROPE_ NIL, -- name of this tupleset entity vIsDomain: BOOL, -- TRUE if tuple set is domain, FALSE if is relation vAttributes: LIST OF Attribute_ NIL, -- if relation, list of its attributes; if domain, list of <<"fake" surrogate attributes that are attributes of this domain and not client-visible >> vR1to1: BOOLEAN_ TRUE], -- whether 1-to-1 if relation; unused if domain attribute => [ -- tid IN [FirstAttributeID .. MaxSystemTupleID] vHandle: DBStorage.FieldHandle_ NIL, -- handle for this attribute vType: DataType, -- type of this attribute vName: ROPE_ NIL, -- name of this attribute vRelation: Relation_ NIL], -- relation this attribute belongs to entity => [ -- used only for IntType, StringType, etc. vName: ROPE_ NIL, -- name of the entity vParent: Domain_ NIL], -- domain entity belongs to (always ValueTypeDomain) surrogate => [ vRelation: Relation_ NIL, -- relation this surrogate relship belongs to vEntity: Entity_ NIL, -- entity this relship corresponds to in target domain vTargetAttribute: Attribute_ NIL], -- the target (first) attribute of vRelation ENDCASE ]; <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> RelshipSet: TYPE = REF RelshipSetObject; RelshipSetObject: TYPE = RECORD[ scan: SELECT type: * FROM tupleSet => [ -- scan all relships in the tupleset, serially testing each serialCheck: AttributeValueList, -- if non-NIL, serially check that tuples satisfy this scanHandle: DBStorage.TuplesetScanHandle, -- this scan gives the tuples to consider surrogate: Relation_ NIL], -- if non-NIL, above gives entities, must convert to surrogate index => [ -- scan all relships in an index, serially testing each serialCheck: AttributeValueList, -- if non-NIL, serially check that tuples satisfy this scanHandle: DBStorage.IndexScanHandle, -- this scan gives the tuples to consider surrogate: Relation_ NIL], -- if non-NIL, above gives entities, must convert to surrogate group => [ -- scan all relships referencing a particular entity serialCheck: AttributeValueList, -- if non-NIL, serially check that tuples satisfy this scanHandle: DBStorage.GroupScanHandle, -- this scan gives the tuples to consider surrogate: Relation_ NIL], -- if non-NIL, above gives entities, must convert to surrogate justOne => [ -- just return hereItIs for first NextRelship call [hereItIs set to NIL after that] hereItIs: Relship], empty => -- NextRelship always returns NIL on one of these NULL, segment => [ -- scan multiple segments, concatenating the RelationSubset results remainingSegments: LIST OF ATOM, -- remaining segments to search previousSegments: LIST OF ATOM, -- segments already searched relation: Relation, -- relation we are scanning (passed by client) constraint: AttributeValueList, -- the constraint passed by client start: FirstLast, -- passed by client currentRelshipSet: RelshipSet], -- the RelshipSet in the current segment ENDCASE ]; EntitySet: TYPE = REF EntitySetObject; EntitySetObject: TYPE = RECORD[ SELECT scan: * FROM index => [ -- scan of a domain index by name scanHandle: DBStorage.IndexScanHandle], tupleSet => [ -- scan of entire domain, no constraint scanHandle: DBStorage.TuplesetScanHandle], empty => -- NextEntity always returns NIL on one of these NULL, nested => [ -- scan multiple domains, concatenating the DomainSubset results remainingDomains: LIST OF Domain, -- (sub-)domains still to scan previousDomains: LIST OF Domain, -- domains already scanned lowName, highName: ROPE, -- passed by client start: FirstLast, -- passed by client currentEntitySet: EntitySet], -- current set; go on to next domain when done segment => [ -- scan multiple segments, concatenating the DomainSubset results remainingSegments: LIST OF ATOM, -- remaining segments to search previousSegments: LIST OF ATOM, -- segments already scanned domain: Domain, -- domain we are scanning (passed by client) lowName, highName: ROPE, -- passed by client start: FirstLast, -- passed by client searchSubDomains: BOOL_ FALSE, -- passed by client (not currently used) currentEntitySet: EntitySet], -- the EntitySet in the current segment ENDCASE ]; FirstLast: TYPE = DB.FirstLast; AttributeValueList: TYPE = DB.AttributeValueList; AttributeList: TYPE = DB.AttributeList; END. Edited by: Cattell on 23-Nov-81 13:12:33: added nameElement EntitySet variant. Cattell on 29-Dec-81 14:16:20: removed it again, don't need it; added empty variant, made all variants lower case names. Cattell on 29-Dec-81 16:32:50: what Eric was calling a system EntitySetObject was really a group EntitySetObject, i changed it to use an entity position. Took out DBTuples dependency. Cattell on July 16, 1982 3:11 pm: Removed RefSet, MatchSet, RefSetObject, MatchSetObject. Added empty variant of RelshipSet. Cattell on October 22, 1982 12:28 pm: Changes for new properties, indexes, and system entities. Reduced size of largest variant of TupleHandle. Cattell on November 4, 1982 9:29 am: More revisions. Didn't need to reduce size of largest variant of TupleHandle, since allocation machinery only allocates for size needed. Put vAttributes into tupleSet variant. Added surrogate field to tupleset, index, and group variants of RelshipSets. Added augment variant to RelshipSets and EntitySets for future use; may have to change later. Willie-Sue on February 15, 1985: made Cedar, added tioga formatting