[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: RE: RA existence check?

From: Bill Tutt <rassilon_at_lyra.org>
Date: 2001-11-21 23:33:38 CET

You want to be careful when you use this kind of check, esp. from a
ra_dav POV. You're usually much better off documenting, and checking
against a remote non-existence error than having an additional round
trip just to give a prettier error message.

As the folks on the MS perf alias are found of saying:
   Design for performance.

If you know that round trips are bad, try to minimize the need to add
extra ones, instead of having to go fix it up later....

Bill

--
Bunnies aren't just cute like everybody supposes.
They got their hoppy legs and twitchy little noses.
And what's with all the carrots, 
What do they need such good eyesight for anyway?
-----Original Message-----
From: Greg Stein [mailto:gstein@collab.net] 
Sent: Monday, November 19, 2001 11:30 AM
To: cmpilato@collab.net
Cc: dev@subversion.tigris.org
Subject: RE: RA existence check?
> -----Original Message-----
> From: cmpilato@collab.net [mailto:cmpilato@collab.net]
> Sent: Monday, November 19, 2001 10:07 AM
>...
> An RA-layer existence/node-kind check of some sort is necessary.
> You know, maybe something like:
>
>    ra->get_node_kind (enum svn_node_kind *kind,
>                       svn_string_t *url,
>                       svn_revnum_t revision,
>                       apr_pool_t *pool);
>
> Where a node kind of svn_node_none would indicate non-existence.
> GregS, is there an efficient way to do this in RA_DAV, or are we
> talking about a custom REPORT/response couplet here?
That is a PROPFIND (Depth:0) for the DAV:resourcetype property.
You can use the svn_ra_dav__get_one_prop() function to fetch it. If the
PROPFIND fails with a 404, then you have svn_node_none. If the resulting
property looks like:
    <D:resourcetype>
      <D:collection/>
    </D:resourcetype>
Then it is a collection (directory; svn_node_dir). Otherwise, it is a
regular resource (svn_node_file).
The harder part is parsing the resourcetype property. "Proper" parsing
means
treating it as an XML property and looking for the DAV:collection
element in
there. To do that, however, means that get_one_prop() can't be used. I
think
there may be some Neon functions for parsing XML properties; we'd need
to
look. That would probably be the best approach. (an alternative is to
use
apr_xml_* parsing functions on the returned string; get back a DOM-like
thing, and look for the element).
Cheers,
-g
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:49 2006

This is an archived mail posted to the Subversion Dev mailing list.