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

Re: svn commit: r11750 - branches/locking/subversion/include

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2004-11-05 15:34:38 CET

On Nov 4, 2004, at 10:50 PM, Greg Hudson wrote:

> On Thu, 2004-11-04 at 23:29, Ben Collins-Sussman wrote:
>> Unfortunately, it's still more complicated than that. A whole slew of
>> fs functions -- not just the new lock/unlock funcs -- need to check
>> if
>> locks exist before changing a path.
>
> We're not doing that by lock token? I'm confused.
>

Allow me to clarify with an example. This is based on discussions that
sander/fitz/I have been having in the Chicago office this week.

Take the function svn_fs_apply_txdelta(), used to change a file's
contents.

Some server process authenticates a username. Now the process wants to
change a file's contents, as part of an incoming request. When the
process calls svn_fs_apply_txdelta(), the fs func needs to do three
things, potentially:

    1. check to see if there's a pre-existing lock on the file.
       if not, proceed normally.

    2. if there's a lock, look at the 'owner' field in the lock. Is it
the same as the authenticated username? If not, error out.

    3. if the lock-owner and authenticated username match, we're still
not out of the woods. The fs function still needs to see the
lock-token from the client, and make sure it matches the lock. The
client's lock-token could be some ancient defunct thing, who knows?

So, step #2 requires that an fs_t have a (presumably authenticated)
username attached to it.

And step #3 is even more interesting: it means that a bunch of fs
functions either need to be revved to svn_fs_*_2(), taking optional
lock-token objects as arguments.... or it means that this bunch of fs
functions need to be able to "pull" lock-tokens from the fs-caller as
necessary, through a registered callback.

The design that Sander and I have been learning towards is the callback
one:

   A. add a new editor function: editor->give_lock_token(). The
editor-driver can "push" as many lock-tokens as it wishes at the
editor. The understanding is that the editor will store them up, and
use them when appropriate. It's the editor-driver's responsibility to
make sure that a lock-token has been pushed at the editor before the
editor may need to use it.

   B. the editor registers a callback with the svn_fs_t, essentially
allowing any fs function to "pull" a token (when necessary) from the
editor's stash of tokens. Really, we're just talking about the fs
functions doing the equivalent of an apr_hash_get(path) on the editor's
token-hash, whenever an fs function discovers a lock.

Don't mean to deluge folk here. But we think (at the moment) that this
is the cleanest way to make both lock-tokens and
authenticated-usernames available to every fs function. It seems like
the messier alternative is to rev a bunch of fs functions to version 2,
and also rev every editor function to version 2! Ick.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Nov 5 15:35:00 2004

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.