[Zope] storage space used by a folder

A M Thomas am@virtueofthesmall.com
Thu, 18 Jul 2002 10:31:28 -0400


Hi all,

Does anyone know how to determine the disk space usage for all the Zope
objects in a particular folder (and in its subfolders, etc.)?  I'd like
an easy way to find out / let my virtual hosting clients know how much
disk space they're using.

Obviously, I could recursively add up the sizes of all the images within
a folder and its subfolders, and I could go a step further and add up
the lengths of any text contents in contained DTML documents and
methods, then property values ... then the names of custom properties
... but it just seems like there should be a better way.  I don't
remember coming across anything like this, though.  I tried searches on
the Zope site and the Zope cookbook site (as well as this list's
archives), but as you know, it's hard finding something when you don't
know what it's called...

I sent this question to the iMeme users' list and got two pretty good
suggestions:

1) Use a product called QuotaFolder, which, based on what I've read
about it, adds a get_size() method to various Zope base classes, then
calls that method on all objects contained in a folder.  This is pretty
good (thank you for creating, ivo), but it admittedly doesn't take into
account revisions, properties, etc.  Also, it makes me wonder whether
there's already a more thorough equivalent to "get_size()" already in
Zope, that I could call.  There should be, shouldn't there?  The final
worry is that it might be difficult to integrate with my existing
product, but this may not be an issue now that I think of it - I'll have
to try it to find out.  Anybody care to report experience with
QuotaFolder?

2) Export the folder, then look at the size of the resulting file.  This
is something I might actually try (since I'm thinking of automatically
backing up my virtual domains this way anyway), but it seems that there
should still be a better way.

So, how about it, zopistas?  Is there a nice, clean way to find the
amount of storage space consumed by all the objects within a particular
folder?  Is there a method to get the total storage used by any
ObjectManagerItem-derived object?  If not, is something in the works?

Many thanks,
AM

Thanks,
AM