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

Stacked resources (streams, files) && resource ownership

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: 2005-12-11 22:13:22 CET

Whlie trying to optimize svn_wc_transmit_text_deltas, I was
implementing a function which is supposed to return a stream
(svn_wc_translated_stream()). Internally this stream will read from a
file, but this is an implementation detail (more on that later). The
problem is that I have a stack of streams and a file:

  stream_translated

  stream_from_aprfile

  apr_file

All functions we have until now, keep references to all streams and
the file and close them as necessary.

On the other hand, we seem to have a 'close' mechanism on all kinds of
handlers (window handlers especially), by sending a final NULL window.
 This NULL window is passed through to all handlers in the stack,
making this effectively the model where each handler is owned by the
handler stacked on top of it.

When looking at it this way, I think we have 2 different models of
resource ownership in the tree. I also think the model used for
stacked files and streams is slightly conflicting with pool
programming: the creator function needs to manually track all
resources stacked together to make sure they're all closed...

What I want to do is add streams which close the streams which they're
stacked upon and add a svn_stream_from_aprfile2() which takes a
close_file boolean to close the file when the stream is closed. That
way, we would grow to a model where all stacked resources own the
resource(s) they're stacked upon.

I shortly talked with Greg Hudson on irc about this, but since he had
to leave, I'm still looking for opinions...

bye,

Erik.
Received on Sun Dec 11 22:13:59 2005

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.