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

Re: Context parameter in public API

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-10-13 09:04:10 CEST

On Fri, Oct 11, 2002 at 02:37:15PM +0300, Nuutti Kotivuori wrote:
> Karl Fogel wrote:
> > Nuutti Kotivuori <naked@iki.fi> writes:
> >>> So, how about adding a context parameter to every function? I
> >>> know that's a big change, but I think we'll be forced to do that
> >>> sooner or later anyway.

Agreed.

>...
> OK, let me think this over a bit - a context parameter. How I
> understand what that would mean is that the svn_client library has a
> context, which is to be first opened, then passed to every function
> called from the library, and then closed at the end. And that context
> would be opaque to users of the client library. Roughly as pseudocode:
>
> svn_error_t *svn_client_context_open(svn_context_t **ctx);
>
> svn_error_t *svn_client_context_close(svn_context_t *ctx);

The open would take a pool, and the close would be implied by clearing or
destroying that pool. (that's the typical pattern of use in SVN)

> And in usage, for example:
>
> svn_error_t *
> svn_client_ls (apr_hash_t **dirents,
> const char *url,
> svn_opt_revision_t *revision,
> svn_client_auth_baton_t *auth_baton,
> svn_boolean_t recurse,
> apr_pool_t *pool,
> svn_context_t *ctx);

The auth_baton would be incorporated into the context.

If people wanted multiple auth within a single app, then they can use
multiple context objects. Or maybe the context has a way to change auth
values.

>...
> Is the 'config' file a feature of svn_client libraries or is it
> something that only the command-line client uses?

The config file is one way to store options. The context should be a generic
mechanism for passing option state. A GUI app might actually store all that
stuff within its own state files.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Oct 13 09:02:40 2002

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.