Re: How to remove an object and all its references ?

[email protected]
Newsgroups gmane.comp.web.zope.zodb
Message-ID <[email protected]>
Yes that is helpful, thank you Jim for your answer.
I already do it at application level. I know about repoze.catalog but 
haven't used it yet.
I just wanted to know if there another standard way to do it, and you have 
answered me for this.

Have a nice day.

Le samedi 13 août 2016 14:44:53 UTC+2, Jim Fulton a écrit :
>
>
>
> On Fri, Aug 12, 2016 at 1:30 AM, <[email protected] <javascript:>> 
> wrote:
>
>> Good morning,
>>
>> I'm quite new to ZODB and I wonder if there is a way to remove a stored 
>> object with all its references ?
>> persistent weak ref seems a nice path, but objects are collected on pack 
>> operation only IIUC.
>>
>> What I'd like to do : create a persistent object, store it into the 
>> database and add it to a BTree. When I delete the original object stored in 
>> database, I'd like it removed from BTree too.
>>
>> If there is such a way, do I have to care about performance impact for 
>> collecting and removing all references ?
>>
>
> There are two levels at which to think about this question.
>
> In this context, you should think about ZODB as persistent memory in a 
> high-level language.  As with Python, objects are removed through garbage 
> collection. There's no way to explicitly deallocate/remove objects.
>
> At the application level, as with Python, you could arrange automation to 
> remove objects from collections, often some sort of master collection and 
> secondary collections (e.g. index).  How this is done seems to depend a lot 
> of application requirements and tradeoffs. As a result, there's more than 
> one way to do it.
>
> A very common pattern in the Zope community (including Plone, etc.) is to 
> use a "catalog" which is a collection of objects with indexes.  When object 
> lifecycle events happen, methods are called on the catalog to add, update, 
> or remove objects. Because Zope was designed to be wildly extensible, a 
> number of abstractions (base classes, event systems, special methods) are 
> used to automate this, which leads to some complexity.  I haven't used 
> Zope-based catalog machinery in a while, so I can't point to the current 
> best examples.
>
> Less ambitious applications can use simpler frameworks to do the same 
> thing.
>
>  
>
>> Thanks for your help.
>>
>
> I hope I was helpful.
>
> Jim
>
> -- 
> Jim Fulton
> http://jimfulton.info
>

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.