You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/06/29 21:33:10 UTC
svn commit: r1498013 - in
/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs: cached_data.c
reps.c reps.h
Author: stefan2
Date: Sat Jun 29 19:33:10 2013
New Revision: 1498013
URL: http://svn.apache.org/r1498013
Log:
On the fsfs-format7 branch: allow for containerized representations to be
longer than SVN_DELTA_WINDOW_SIZE. For that, we must be able to extract
sub-strings from a full representation.
* subversion/libsvn_fs_fs/reps.h
(svn_fs_fs__reps_get): add optional range parameters
* subversion/libsvn_fs_fs/reps.c
(svn_fs_fs__extractor_drive): update implementation
* subversion/libsvn_fs_fs/cached_data.c
(read_container_window): model similar to plain window reader
(get_combined_window,
get_contents): update callers
Modified:
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.c
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.h
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c?rev=1498013&r1=1498012&r2=1498013&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/cached_data.c Sat Jun 29 19:33:10 2013
@@ -1502,6 +1502,7 @@ read_plain_window(svn_stringbuf_t **nwin
static svn_error_t *
read_container_window(svn_stringbuf_t **nwin,
rep_state_t *rs,
+ apr_size_t size,
apr_pool_t *pool)
{
svn_fs_fs__rep_extractor_t *extractor = NULL;
@@ -1535,7 +1536,11 @@ read_container_window(svn_stringbuf_t **
rs->item_index, rs->file->file, pool, pool));
}
- SVN_ERR(svn_fs_fs__extractor_drive(nwin, extractor, pool, pool));
+ SVN_ERR(svn_fs_fs__extractor_drive(nwin, extractor, rs->current, size,
+ pool, pool));
+
+ /* Update RS. */
+ rs->current += (apr_off_t)size;
return SVN_NO_ERROR;
}
@@ -1589,7 +1594,8 @@ get_combined_window(svn_stringbuf_t **re
if (source == NULL && rb->src_state != NULL)
{
if (rb->src_state->header_size == 0)
- SVN_ERR(read_container_window(&source, rb->src_state, pool));
+ SVN_ERR(read_container_window(&source, rb->src_state,
+ window->sview_len, pool));
else
SVN_ERR(read_plain_window(&source, rb->src_state,
window->sview_len, pool));
@@ -1842,7 +1848,14 @@ get_contents(struct rep_read_baton *rb,
/* reps in containers don't have a header */
if (rs->header_size == 0 && rb->base_window == NULL)
- SVN_ERR(read_container_window(&rb->base_window, rs, rb->pool));
+ {
+ /* RS->SIZE is unreliable here because it is based upon
+ * the delta rep size _before_ putting the data into a
+ * a container. */
+ SVN_ERR(read_container_window(&rb->base_window, rs,
+ rb->len, rb->pool));
+ rs->current -= rb->base_window->len;
+ }
if (rb->base_window != NULL)
{
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.c?rev=1498013&r1=1498012&r2=1498013&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.c Sat Jun 29 19:33:10 2013
@@ -604,12 +604,30 @@ svn_fs_fs__reps_get(svn_fs_fs__rep_extra
svn_error_t *
svn_fs_fs__extractor_drive(svn_stringbuf_t **contents,
svn_fs_fs__rep_extractor_t *extractor,
+ apr_size_t start_offset,
+ apr_size_t size,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
/* we don't support base reps right now */
SVN_ERR_ASSERT(extractor->missing == NULL);
- *contents = svn_stringbuf_dup(extractor->result, result_pool);
+
+ if (size == 0)
+ {
+ *contents = svn_stringbuf_dup(extractor->result, result_pool);
+ }
+ else
+ {
+ /* clip the selected range */
+ if (start_offset > extractor->result->len)
+ start_offset = extractor->result->len;
+
+ if (size > extractor->result->len - start_offset)
+ size = extractor->result->len - start_offset;
+
+ *contents = svn_stringbuf_ncreate(extractor->result->data + start_offset,
+ size, result_pool)
+ }
return SVN_NO_ERROR;
}
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.h?rev=1498013&r1=1498012&r2=1498013&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/reps.h Sat Jun 29 19:33:10 2013
@@ -121,16 +121,21 @@ svn_fs_fs__reps_get(svn_fs_fs__rep_extra
apr_pool_t *pool);
/* Let the EXTRACTOR object fetch all parts of the desired fulltext and
- * return the latter in *CONTENTS. Allocate the result in RESULT_POOL
- * and use SCRATCH_POOL for temporary allocations.
+ * return the latter in *CONTENTS. If SIZE is not 0, return SIZE bytes
+ * starting at offset START_OFFSET of the full contents. If that range
+ * lies partly or completely outside the content, clip it accordingly.
+ * Allocate the result in RESULT_POOL and use SCRATCH_POOL for temporary
+ * allocations.
*
* Note, you may not run this inside a cache access function.
*/
svn_error_t *
-svn_fs_fs__extractor_drive(svn_stringbuf_t **contents,
- svn_fs_fs__rep_extractor_t *extractor,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
+svn_fs_fs__extractor_drive(svn_stringbuf_t** contents,
+ svn_fs_fs__rep_extractor_t* extractor,
+ apr_size_t start_offset,
+ apr_size_t size,
+ apr_pool_t* result_pool,
+ apr_pool_t* scratch_pool);
/* I/O interface. */