any more sftp fixes?

Jan Hudec bulb at ucw.cz
Fri Dec 2 18:26:23 GMT 2005


On Fri, Dec 02, 2005 at 08:34:16 -0600, John A Meinel wrote:
> Jan Hudec wrote:
> > On Thu, Dec 01, 2005 at 20:53:24 -0600, John A Meinel wrote:
> >> Robey Pointer wrote:
> >>> On 1 Dec 2005, at 5:46, John A Meinel wrote:
> >>>
> >>>> Robey Pointer wrote:
> >>>>> I'm not sure the weakref system will work, though -- I'd pondered that
> >>>>> before, but in tests with the python CLI, the weak values were going
> >>>>> away as soon as the last "real" reference to them died.  If that's true
> >>>>> generally, then the cache has an automatic expiration of zero seconds,
> >>>>> making it a lot less useful. :)
> >>>>>
> >>>> The weakref was mostly a starting point. We had some problems where
> >>>> there were 2 paths to create a connection, and they weren't getting
> >>>> shared.
> >>>>
> >>>> Long term, I wanted bzrlib to keep some sort of reference, so that a
> >>>> front end could implement a longer-term caching policy. Such as keeping
> >>>> a timeout list so that after a period of inactivity (say 1min/60min
> >>>> whatever), they would be closed.
> >>>>
> >>>> Adding the weakref dictionary just means that bzrlib won't try to hold
> >>>> onto them forever, but gives a place for other front-ends to acquire
> >>>> them if it decides to create a different policy.
> >>> I wonder if this maybe should be implemented at the Transport level,
> >>> instead of per-transport (especially after hearing that FTPTransport is
> >>> doing something similar).  Is there any transport that would be hurt by
> >>> such caching?
> >> Because I want to cache at the connection level, not at the URL level.
> > 
> > Right. So what about having a base class, say ConnectionRegistry, that
> > all connection objects would inherit and that would cache them by their
> > __init__ argument tuple? The transports would then have to explicitly
> > use it, but the rest would be taken care of for them.
> 
> Something like this might be useful. I don't know that it has to be a
> full object. Even just a blind:
> 
> def cache_connection(connection, info):
> 
> def get_connection(info):

IMHO a "mixin" would be best. Unfortunately I don't know how to do true
mixins in python. But since python has multiple inheritance, we can have
a second base instead, *if* the __init__ method is properly cooperative (calls
super() in all parents).

-- 
						 Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051202/2bceef96/attachment.pgp 


More information about the bazaar mailing list