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

Re: svn commit: r985514 - stream_move_mark()

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Mon, 16 Aug 2010 10:04:31 +0100

On Mon, 2010-08-16 at 09:55 +0100, Julian Foad wrote:
> On Sat, 2010-08-14, stefan2_at_apache.org wrote:
> > Log:
> > Extend the stream API by three functions:
> > svn_stream_move_mark() to move an existing mark by some delta
>
> Hi Stefan.
>
> Unfortunately this is not a logical extension to the stream API.
> Subversion's svn_stream_t streams support arbitrary "filtering" or
> "translation" tasks that require a mostly sequential processing of the
> stream. One of the ideas embodied by the "get a mark" and "seek to a
> mark" paradigm is that the stream position is not expressible by a
> simple number (such as a byte offset from the start), because the stream
> may be performing translation whose state at a given position depends on
> the preceding content of the stream. Therefore "get a mark" does not
> return a scalar number but instead returns a stream state object which
> contains the translation state of the stream as well as the "mark" of
> the underlying stream if there is one.
>
> Seeking to an arbitrary new position requires telling the stream all of
> its relevant internal state at that position. "Move by +/- N bytes"
> does not seem to be an operation that can be supported.

... supported by all streams that support mark & seek. Of course some
streams could support it.

I don't like to see an API be complicated by lots of functions that may
or may not be supported, and functions to find out whether they are
supported. I would ask you to look for another way to realize most of
the speed gain that you were hoping to get from this extension.

- Julian

[...]
> > +/** Returns @c TRUE if the generic @a stream supports svn_stream_mark().
> > + *
> > + * @see svn_stream_mark()
> > + * @since New in 1.7.
> > + */
> > +svn_boolean_t
> > +svn_stream_supports_mark(svn_stream_t *stream);
> > +
> > /** Set a @a mark at the current position of a generic @a stream,
> > * which can later be sought back to using svn_stream_seek().
> > * The @a mark is allocated in @a pool.
> > @@ -1102,6 +1142,27 @@ svn_stream_mark(svn_stream_t *stream,
> > svn_error_t *
> > svn_stream_seek(svn_stream_t *stream, svn_stream_mark_t *mark);
> >
> > +/** Move a @a mark for a generic @a stream by delta.
> > + * This function returns the #SVN_ERR_STREAM_SEEK_NOT_SUPPORTED error
> > + * if the stream doesn't implement seeking.
> > + *
> > + * @see svn_stream_mark()
> > + * @since New in 1.7.
> > + */
> > +svn_error_t *
> > +svn_stream_move_mark(svn_stream_t *stream,
> > + svn_stream_mark_t *mark,
> > + apr_off_t delta);
Received on 2010-08-16 11:05:15 CEST

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.