[MERGE] Handle lock contention on NFS

Robert Collins robertc at robertcollins.net
Sun Apr 2 23:56:53 BST 2006


On Wed, 2006-03-29 at 10:05 -0500, Aaron Bentley wrote:


> > If you are interested in making it a decorator but not completely sure
> > of what I mean, I'll be happy to do a variation on that part of the
> > patch that does this.
> 
> Yes, that would be interesting.  Also, it would be nice to make it a
> subclass of LocalTransport if that's possible.

Here is a decorator version of FakeNFS. This will by default backend
onto a LocalRelpathServer, so it has actual disk backing.

However, it does not appear as a 'LocalTransport' to our code that
checks for instances of LocalTransport.

I realise this patch looks a lot bigger, but its 90% just moving the
infrastructure the ReadOnlyTransport decorator used into a common base
class to allow trivial decorators to be written.

I think that for the LocalHost checks it might be nice to add the
following to Transport:

    def get_local_path(self):
        """Returns a local path representation of this transports url.

        If this URL cannot be represented as a local path, NotLocalURL
        will be raised.

        The default implementation raises NotLocalURL as we expect that
        to be the common case.
        """
        raise NotLocalUrl(self.base)

Then the FakeNFSTransportDecorator can just do:
        return self._decorated.get_local_path()

And it also solves the confusion we've had about whether local path urls
are utf8 encoded or url encoded etc etc by giving them a specific
protocol for getting a local path representation.

What do you think?

Rob


-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nfslocks-decorator.patch
Type: text/x-patch
Size: 21614 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060403/cb8b9adc/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060403/cb8b9adc/attachment.pgp 


More information about the bazaar mailing list