DIRECTORY Rope, IO, AlgebraClasses; ASDBManager: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; LBAttributeType: TYPE = ATOM; LBAttributeValue: TYPE = ROPE; LBAttribute: TYPE = RECORD[ type: LBAttributeType, value: LBAttributeValue ]; LBEntry: TYPE = LIST OF LBAttribute; LBLog: TYPE = LIST OF LBEntry; OffLineAndKeep: AlgebraClasses.UnaryOp; OffLineAndFree: AlgebraClasses.UnaryOp; OnlineASObject: PROC [in: AlgebraClasses.Object, tryToLink: BOOL _ FALSE, reUse: OnLineObject _ NIL] RETURNS [out: AlgebraClasses.Object]; ObjectName: AlgebraClasses.UnaryOp; ObjectFlavor: AlgebraClasses.UnaryOp; ObjectClass: AlgebraClasses.UnaryOp; ObjectData: AlgebraClasses.UnaryOp; BinaryOp: AlgebraClasses.BinaryOp; END. üASDBManager.mesa Last Edited by: Arnon, November 19, 1987 8:31:50 am PST Manages storage of, and access to, a LoganBerry DB of AlgebraStructures Objects. Clients should not need to know whether the Objects they want are currently in VM, or offline in the LoganBerry DB. The Primary attribute type for the LoganBerry DB is $PrimaryKey. $PrimaryKey values, i.e. names, don't have to be particularly clever, just easily distinguished. Should be human-readable, e.g. "3-SpaceCell(1,1,1)" There is a quick check to determine whether an Object has been offlined: is its primaryKey field nonNIL? For general safety, all access to individual online-only fields of an Object (e.g. class, data) should be with the routines ObjectData, etc. of this interface. Abbreviations from Imported Interfaces Types for Simulated LoganBerry DB Operations Input is an OnlineObject, output is an OffLineObject. Check whether already OffLine by seeing if primaryKey field is nonNIL. If not, then generate appropriate data, and store in LB DB, and make an entry for it in global registry of offline objects which are currently online (i.e. leave it Online). Input is an OnlineObject, output is an OffLineObject. Check whether already OffLine by seeing if primaryKey field is nonNIL. If not, then generate appropriate data, and store in LB DB. Do not make an entry for it in global registry of offline objects which are currently online, so when no other pointers to it remain it will be collected. Checks OnlineASObjects to see if already online; if so, return it and exit. If not, load it and make an entry for it in global registry of offline objects which are currently online. If tryToLink = TRUE, then for each field which contains one or more (necessarily offline) AS objects, look for those objects in OnlineASObjects, and if found, put pointers to their online versions in the output object. If tryToLink = FALSE, then all such fields are left containing offline objects. Note that this only unwinds (i.e. onlines) pointers to offline Objects to one level, i.e. conceivably we could unwind such pointers until every Object accessible from the output object was online. If reUse#NIL, then we can avoid an Alloc. First check for presence of that object in global registry; if so, delete it. It is users responsibility to guarantee correctness of a reUse#NIL call. Selector. RETURN[OnlineASObject[arg].name]; Selector. RETURN[OnlineASObject[arg].flavor]; Selector. RETURN[OnlineASObject[arg].class]; Selector. RETURN[OnlineASObject[arg].data]; Êü˜Jšœ™J™7J˜JšœÅ™ÅJ™J™×J™Jšœh™hJ™Jšœ¡™¡J™šÏk ˜ Icodešœ˜Kšœ˜Kšœ˜—Ihead2šœ œ ˜Jšœ˜headšÏn&™&Kšœœœ˜—šž!™!Kšœœœ˜Kšœœœ˜K˜šœ œœ˜Kšœ˜Kšœ˜K˜—K˜Kšœ œœœ ˜$K˜Kšœœœœ ˜—šœ ™ šžœ˜'J™¬J˜—šžœ˜'J™ÖJ˜—š žœœ(œœœœ˜ŠJšœ¸™¸Jšœ«™«J™ÆJšœÂ™ÂJ˜—šž œ˜#Jšœ,™,J˜—šž œ˜%Jšœ.™.J˜—šž œ˜$Jšœ-™-J˜—šž œ˜#Jšœ,™,J™—šž œ˜$J˜J˜——J˜Jšœ˜—…—ÚÒ