On 3/23/07, Nick Kew <[EMAIL PROTECTED]> wrote:
I'm developing a DBD-based DAV backend. I've been trying to use lazy evaluation for efficiency. But there are obstacles in the way. I've just added an SQL query to my get_resource method just to determine whether the resource is a collection. I don't think that should be necessary: not every request needs that information about every resource. And it's very expensive in an operation such as directory listing. This could be fixed if the collection field of dav_resource was a method rather than just a field.
Eww - that would be a *major* change to all downstream WebDAV providers with no possibilities of caching it (unless you add a 'hidden' field - which defeats your purpose entirely! - but still there's an inappropriate function-call overhead). Why can't your SQL query return that as part of the initial existence test? There really shouldn't be much overhead here. My hunch without having *any* details provided by you whatsoever is that your SQL schema is inappropriate - there are too many instances where the caller needs to know whether it's a collection or a specific file. (For a directory listing, it'd almost certainly *need* to know whether the entry is itself a directory or not.)
I don't want to propose a bunch of tiny changes like this, but I'm looking towards a possible review of mod_dav. Meanwhile, anyone BTDT and have insights to share?
What is BTDT? -- justin
