-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/22/2011 08:54 AM, frits.swinkels wrote:
> I am new to ZODB and to this list: greetings.
> 
> I need to get some points clear about precisely when objects are fully
> instantiated in memory. It may be a simple matter of pointing me at some
> documentation; I read pretty much anything I could find but there may a
> problem of your jargon being different from mine:)
> 
> The main data structure of my application is a directed graph of nodes;
> each node has at least three slots which contain other nodes (e.g.
> parent, right child, left child; the parent always exists, the child 
> slots may be None). I only want to instantiate that part of the graph 
> that I am working on.
> 
> Q1. I assume that when an object is instantiated, its "sub" objects will
> be in the form of some kind of proxy (perhaps that ghost I met in the
> ZODB How document?). Is this assumption correct?

Yes.  The ghost has not had its instance dictionary populated yet.
Attempting to access any instance attribute will "unghostify" the object.

> Q2. Given an object, designated by the variable a, in which of the
> following statements does the child become instantiated (activated?) ?
> child = a.leftchild
> name = child.name

The second (assuming that the nodes in your data structure derive from a
"persistent" base class, such as Persistent, or one of the BTrees),

> Q3. Actually, before the child is instantiated, I somehow would like to
> query the object a, whether there is anything in the slot, i.e. whether
> the content of the slot is not None. Of course, this query should not
> trigger the instantiation.

That should already be working, again assuming your objects derive from
Persistent.

> I had the application running in another OO language. An object would
> first carry a proxy with the OID in a slot; it would get instantiated on
> access. The ad-hoc database made use of the Reiser file system, which
> allowed indexing serialized objects on their OID in a B tree.


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk065S4ACgkQ+gerLs4ltQ510wCfSujRaHMG7utqgsgRbEEHwmiI
iFsAoKEv4K5tIPYR2su/o3aEUDyVfTta
=2Jam
-----END PGP SIGNATURE-----

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to