[elephant-devel] Newbee questions

Robert L. Read read at robertlread.net
Sat Mar 4 15:14:46 UTC 2006


If by GC you mean Garbage Collect,
Ian has pointed out that migrate a store and migrating back represents a
primitive 
form of generational garbage collection.


On Sat, 2006-03-04 at 00:15 -0500, William Halliburton wrote:

> Thank you for the explanation. I was mostly looking to see how to GC
> the group. Looks like a future feture. 
> 
> William
> 
> On 3/3/06, Robert L. Read <read at robertlread.net> wrote:
> 
>         Dear William,
>             Welcome.
>         
>             Are you using 0.5 or the latest version from CVS (which
>         has not quite been formally released yet)?  
>         I think this changes slightly based on which version you are
>         using.
>         
>             Under the 0.5:
>         
>             I think the "Tutorial" on the section Persistent Classes 
>         http://common-lisp.net/project/elephant/doc/Persistent-
>         Classes.html#Persistent-Classes
>         shows how to do what you want; I'm pretty sure that it is
>         accurate, but haven't actually done it.
>         It shows placing the whole object into the root; I honestly
>         would have to go back to 0.5 to 
>         say whether this is really necessary or not.  You can try my
>         code snippet below under 0.5 
>         and see if it works.  (We have been working on what will be
>         0.6 for quite a while.)
>         
>             Under the most recent CVS version:
>         
>             Yes, each time you make-instance a class with a metaclass
>         of :persistent-metaclass, the instance
>         is placed in the database with a unique OID.  If you store the
>         OID (for example in the root), you
>         can can then close the store-controller, exit lisp, restart
>         LISP, reopen the store-controller, and 
>         then either do (make-instance  'my-persistent-class :from-oid
>         OID), or, if you have indexed a slot
>         of enables class indexing on the class, you could you (get-
>         instance-by-class 'my-persistent-class)
>         
>         ELE-TESTS> (defclass my-persistent-class ()
>                 ((slot1 :accessor slot1)
>                  (slot2 :accessor slot2))
>                 (:metaclass persistent-metaclass))
>              
>         #<PERSISTENT-METACLASS MY-PERSISTENT-CLASS>
>         ELE-TESTS> (setq x (make-instance 'my-persistent-class))
>         ; loading system definition from /usr/local/share/lisp/ele-
>         bdb.asd into
>         ; #<PACKAGE "ASDF1474">
>         ; registering #<SYSTEM ELE-BDB {AA32BE1}> as ELE-BDB
>         STYLE-WARNING: implicitly creating new generic function BUILD-
>         BTREE-INDEX
>         #<SLEEPYCAT::BDB-STORE-CONTROLLER {B6C1941}>
>         ELE-TESTS> (setq x (make-instance 'my-persistent-class))
>         #<MY-PERSISTENT-CLASS {B8BA3C1}>
>         ELE-TESTS> (elephant::oid x)
>         14700
>         ELE-TESTS> (close-store)
>         NIL
>         ELE-TESTS> (open-store *default-spec*)
>         #<SLEEPYCAT::BDB-STORE-CONTROLLER {A97B6B1}>
>         ELE-TESTS> (make-instance 'my-persistent-class :from-oid
>         14700)
>         #<MY-PERSISTENT-CLASS {A9FEE69}>
>         ELE-TESTS> 
>         
>         In the file classindex.lisp, you can find:
>         
>         (defgeneric get-instances-by-class (persistent-metaclass))
>         (defgeneric get-instances-by-value (persistent-metaclass slot-
>         name value))
>         (defgeneric get-instances-by-range (persistent-metaclass slot-
>         name start end))
>         
>         which are very useful for this, and may mean you don't have to
>         store the OID in the root if 
>         you "enable-class-indexing" on the class.
>         
>         
>         
>             
>             
>         
>         On Thu, 2006-03-02 at 17:11 -0500, William Halliburton wrote:
>         
>         
>         Starting to use elephant with bdb backend. 
>         
>         Please tell me if the following explanation is correct.
>         
>         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?
>         
>         Thank you,
>         William Halliburton
>         
>         _______________________________________________
>         elephant-devel site list
>         
>         elephant-devel at common-lisp.net
>         http://common-lisp.net/mailman/listinfo/elephant-devel
>         
>         
>         
>         _______________________________________________
>         elephant-devel site list
>         elephant-devel at common-lisp.net
>         http://common-lisp.net/mailman/listinfo/elephant-devel
>         
> 
> 
> 
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20060304/ef9ee866/attachment.html>


More information about the elephant-devel mailing list