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

Re: svn commit: r1680819 - /subversion/trunk/subversion/libsvn_fs_fs/revprops.c

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 28 May 2015 11:01:32 +0100

Evgeny Kotkov <evgeny.kotkov_at_visualsvn.com> writes:

> 1) We cannot really use svn_stream_flush(TRUE) + svn_stream_close() with
> a compressed stream that is chained over a file stream or a stream that we
> expect to be consistent with the underlying device. A compressed stream
> writes the final data chunk in close_handler_gz() and calls deflate() with
> Z_FINISH. In this case, closing the compressed stream would require a
> full flush of the underlying stream in order to guarantee consistency.
> Leaving the compressed streams without a flush handler implementation is
> also a poor choice because the caller of svn_stream_flush() would have to
> know the details about the given stream in order to avoid receiving the
> SVN_ERR_STREAM_NOT_SUPPORTED error.
>
> I believe that this is an example where achieving the proper behavior with
> files is simple, but abstracting it with streams is a challenge.

I still prefer the stream patch I posted earlier, and it can be extended
to support compressed streams. Something like:

svn_error_t *
svn_stream_flush_to_disk_on_close(svn_stream_t *stream)
{
  if (stream->close_fn == close_handler_apr)
    {
      svn_stream_set_close(stream, close_handler_flush);
    }
  else if (stream->close_fn == close_handler_gz)
    {
      struct zbaton *zbaton = stream->baton;
      SVN_ERR(svn_stream_flush_to_disk_on_close(zbaton->substream));
    }
  else if (stream->close_fn != close_handler_flush)
    {
      return svn_error_create(SVN_ERR_STREAM_NOT_SUPPORTED, NULL,
                              _("No closing file to flush"));
    }

  return SVN_NO_ERROR;
}

That only allows flushing the stream on close but I do not see any need
at present to support flushing at arbitrary positions.

I don't insist on this solution, if people think the file code is better
that is OK.

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*
Received on 2015-05-28 12:01:46 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.