[darcs-users] Re: Secure access to remote repositories

David Roundy droundy at abridgegame.org
Mon May 19 22:26:31 UTC 2003


On Tue, May 20, 2003 at 12:06:06AM +0200, Peter Simons wrote:
> 
> One suggestion, though: As I understand it, your current I/O model is
> completely stateless. I think it would be beneficial, to have a
> concept of a "connection", which is opened and can then be used to
> access files from the remote end. The advantage is that protocols,
> which support state, can operate much more efficiently because they
> have a context and can re-use an open connection.

Hmmm.  I can see how that could be a lot faster.  However, the network
connection side of things is among my least favorite sort of code to write
(and I get more than enough of that working on my bridge game), so I'm
not likely to worry about the speed issure for some time.  Especially since
I fear there are lingering scalability issues remaining which are much more
severe...

I imagine (on the haskell side) one could create a nice little API
reminiscent of what I've already got for persistent connections.  Something
like:

openConnection :: String -> IO Connection
closeConnection :: Connection -> IO ()
copyFileConnection :: Connection -> String -> String -> IO ()
openFileConnection :: Connection -> String -> IO Handle

I don't much care for the last two names, but you can hopefully see what
each of these would do.  Connection would be a data type (with its
constructors private to the Curl module) that would store whatever
information is needed for keeping the connection type (which would be
determined by the argument to openConnection).  Then the copy and open
routines would behave pretty much like my existing functions, except that
they require an existing open connection.  Actually, they could even be
extended to open the connection themselves if it has been closed.

Anyhow, I imagine this would basically be the API needed for a persistent
connection, and if someone were to implement the backend of such an api for
any protocol, I'd be happy to modify all the code that retrieves files to
use it.  You wouldn't have to support every case, since we could easily
support a connectionless mode which would have the existing routines as the
backend.
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list