<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.3.2">
</HEAD>
<BODY>
If by GC you mean Garbage Collect,<BR>
Ian has pointed out that migrate a store and migrating back represents a primitive <BR>
form of generational garbage collection.<BR>
<BR>
<BR>
On Sat, 2006-03-04 at 00:15 -0500, William Halliburton wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
    <FONT COLOR="#000000">Thank you for the explanation. I was mostly looking to see how to GC the group. Looks like a future feture. </FONT><BR>
    <BR>
    <FONT COLOR="#000000">William</FONT><BR>
    <BR>
    <FONT COLOR="#000000">On 3/3/06, </FONT><FONT COLOR="#000000"><B>Robert L. Read</B></FONT><FONT COLOR="#000000"> <<A HREF="mailto:read@robertlread.net">read@robertlread.net</A>> wrote:</FONT><BR>
    <BLOCKQUOTE>
        <FONT COLOR="#000000">Dear William,</FONT><BR>
        <FONT COLOR="#000000">    Welcome.</FONT><BR>
        <BR>
        <FONT COLOR="#000000">    Are you using 0.5 or the latest version from CVS (which has not quite been formally released yet)?  </FONT><BR>
        <FONT COLOR="#000000">I think this changes slightly based on which version you are using.</FONT><BR>
        <BR>
        <FONT COLOR="#000000">    Under the 0.5:</FONT><BR>
        <BR>
        <FONT COLOR="#000000">    I think the "Tutorial" on the section Persistent Classes </FONT><BR>
        <FONT COLOR="#000000"><A HREF="http://common-lisp.net/project/elephant/doc/Persistent-Classes.html#Persistent-Classes">http://common-lisp.net/project/elephant/doc/Persistent-Classes.html#Persistent-Classes</A></FONT><BR>
        <FONT COLOR="#000000">shows how to do what you want; I'm pretty sure that it is accurate, but haven't actually done it.</FONT><BR>
        <FONT COLOR="#000000">It shows placing the whole object into the root; I honestly would have to go back to 0.5 to </FONT><BR>
        <FONT COLOR="#000000">say whether this is really necessary or not.  You can try my code snippet below under 0.5 </FONT><BR>
        <FONT COLOR="#000000">and see if it works.  (We have been working on what will be 0.6 for quite a while.)</FONT><BR>
        <BR>
        <FONT COLOR="#000000">    Under the most recent CVS version:</FONT><BR>
        <BR>
        <FONT COLOR="#000000">    Yes, each time you make-instance a class with a metaclass of :persistent-metaclass, the instance</FONT><BR>
        <FONT COLOR="#000000">is placed in the database with a unique OID.  If you store the OID (for example in the root), you</FONT><BR>
        <FONT COLOR="#000000">can can then close the store-controller, exit lisp, restart LISP, reopen the store-controller, and </FONT><BR>
        <FONT COLOR="#000000">then either do (make-instance  'my-persistent-class :from-oid OID), or, if you have indexed a slot</FONT><BR>
        <FONT COLOR="#000000">of enables class indexing on the class, you could you (get-instance-by-class 'my-persistent-class)</FONT><BR>
        <BR>
        <FONT COLOR="#000000">ELE-TESTS> (defclass my-persistent-class ()</FONT><BR>
        <FONT COLOR="#000000">        ((slot1 :accessor slot1)</FONT><BR>
        <FONT COLOR="#000000">         (slot2 :accessor slot2))</FONT><BR>
        <FONT COLOR="#000000">        (:metaclass persistent-metaclass))</FONT><BR>
        <FONT COLOR="#000000">     </FONT><BR>
        <FONT COLOR="#000000">#<PERSISTENT-METACLASS MY-PERSISTENT-CLASS></FONT><BR>
        <FONT COLOR="#000000">ELE-TESTS> (setq x (make-instance 'my-persistent-class))</FONT><BR>
        <FONT COLOR="#000000">; loading system definition from /usr/local/share/lisp/ele-bdb.asd into</FONT><BR>
        <FONT COLOR="#000000">; #<PACKAGE "ASDF1474"></FONT><BR>
        <FONT COLOR="#000000">; registering #<SYSTEM ELE-BDB {AA32BE1}> as ELE-BDB</FONT><BR>
        <FONT COLOR="#000000">STYLE-WARNING: implicitly creating new generic function BUILD-BTREE-INDEX</FONT><BR>
        <FONT COLOR="#000000">#<SLEEPYCAT::BDB-STORE-CONTROLLER {B6C1941}></FONT><BR>
        <FONT COLOR="#000000">ELE-TESTS> (setq x (make-instance 'my-persistent-class))</FONT><BR>
        <FONT COLOR="#000000">#<MY-PERSISTENT-CLASS {B8BA3C1}></FONT><BR>
        <FONT COLOR="#000000">ELE-TESTS> (elephant::oid x)</FONT><BR>
        <FONT COLOR="#000000">14700</FONT><BR>
        <FONT COLOR="#000000">ELE-TESTS> (close-store)</FONT><BR>
        <FONT COLOR="#000000">NIL</FONT><BR>
        <FONT COLOR="#000000">ELE-TESTS> (open-store *default-spec*)</FONT><BR>
        <FONT COLOR="#000000">#<SLEEPYCAT::BDB-STORE-CONTROLLER {A97B6B1}></FONT><BR>
        <FONT COLOR="#000000">ELE-TESTS> (make-instance 'my-persistent-class :from-oid 14700)</FONT><BR>
        <FONT COLOR="#000000">#<MY-PERSISTENT-CLASS {A9FEE69}></FONT><BR>
        <FONT COLOR="#000000">ELE-TESTS> </FONT><BR>
        <BR>
        <FONT COLOR="#000000">In the file classindex.lisp, you can find:</FONT><BR>
        <BR>
        <FONT COLOR="#000000">(defgeneric get-instances-by-class (persistent-metaclass))</FONT><BR>
        <FONT COLOR="#000000">(defgeneric get-instances-by-value (persistent-metaclass slot-name value))</FONT><BR>
        <FONT COLOR="#000000">(defgeneric get-instances-by-range (persistent-metaclass slot-name start end))</FONT><BR>
        <BR>
        <FONT COLOR="#000000">which are very useful for this, and may mean you don't have to store the OID in the root if </FONT><BR>
        <FONT COLOR="#000000">you "enable-class-indexing" on the class.</FONT><BR>
        <BR>
        <BR>
        <BR>
        <FONT COLOR="#000000">    </FONT><BR>
        <FONT COLOR="#000000">    </FONT><BR>
        <BR>
        <FONT COLOR="#000000">On Thu, 2006-03-02 at 17:11 -0500, William Halliburton wrote:</FONT><BR>
        <BR>
        <BR>
        <FONT COLOR="#000000">Starting to use elephant with bdb backend. </FONT><BR>
        <BR>
        <FONT COLOR="#000000">Please tell me if the following explanation is correct.</FONT><BR>
        <BR>
        <FONT COLOR="#000000">Each time I make-instance a class with a metaclass of :persistent-metaclass the class is placed into the database with a unique OID. I can retrieve this back with (make-instance 'class :with-oid OID). Now this object in not in the root. Must I place it into the root? How do I remove old objects?</FONT><BR>
        <BR>
        <FONT COLOR="#000000">Thank you,</FONT><BR>
        <FONT COLOR="#000000">William Halliburton</FONT>
<PRE>
<FONT COLOR="#000000">_______________________________________________</FONT>
<FONT COLOR="#000000">elephant-devel site list</FONT>

<FONT COLOR="#000000"><A HREF="mailto:elephant-devel@common-lisp.net">elephant-devel@common-lisp.net</A></FONT>
<FONT COLOR="#000000"><A HREF="http://common-lisp.net/mailman/listinfo/elephant-devel">http://common-lisp.net/mailman/listinfo/elephant-devel</A></FONT>

</PRE>
        <BR>
        <FONT COLOR="#000000">_______________________________________________</FONT><BR>
        <FONT COLOR="#000000">elephant-devel site list</FONT><BR>
        <FONT COLOR="#000000"><A HREF="mailto:elephant-devel@common-lisp.net">elephant-devel@common-lisp.net</A></FONT><BR>
        <FONT COLOR="#000000"><A HREF="http://common-lisp.net/mailman/listinfo/elephant-devel">http://common-lisp.net/mailman/listinfo/elephant-devel</A></FONT><BR>
        <BR>
    </BLOCKQUOTE>
    <BR>
<PRE>
<FONT COLOR="#000000">_______________________________________________</FONT>
<FONT COLOR="#000000">elephant-devel site list</FONT>
<FONT COLOR="#000000"><A HREF="mailto:elephant-devel@common-lisp.net">elephant-devel@common-lisp.net</A></FONT>
<FONT COLOR="#000000"><A HREF="http://common-lisp.net/mailman/listinfo/elephant-devel">http://common-lisp.net/mailman/listinfo/elephant-devel</A></FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>