FreeBSD/contrib/subversion/subversion/libsvn_fs_x/cached_data.c
/* Read all txdelta / plain windows following REP_HEADER in FS as described
 * by ENTRY.  Read the data from the already open FILE and the wrapping
 * STREAM object.  If MAX_OFFSET is not -1, don't read windows that start
 * at or beyond that offset.  Use SCRATCH_POOL for temporary allocations.
 * If caching is not enabled, this is a no-op.
 */
Read all txdelta / plain windows following REP_HEADER in FS as described
by ENTRY.  Read the data from the already open FILE and the wrapping
STREAM object.  If MAX_OFFSET is not -1, don't read windows that start
at or beyond that offset.  Use SCRATCH_POOL for temporary allocations.
If caching is not enabled, this is a no-op.
Read all txdelta / plain windows following REP_HEADER in FS as described by ENTRY . Read the data from the already open FILE and the wrapping STREAM object . If MAX_OFFSET is not - 1 don ' t read windows that start at or beyond that offset . Use SCRATCH_POOL for temporary allocations . If caching is not enabled this is a no - op .
static svn_error_t *
block_read_changes(apr_array_header_t **changes,
                   svn_fs_t *fs,
                   svn_fs_x__revision_file_t *rev_file,
                   svn_fs_x__p2l_entry_t* entry,
                   svn_boolean_t must_read,
                   apr_pool_t *result_pool,
                   apr_pool_t *scratch_pool)
{
  svn_fs_x__data_t *ffd = fs->fsap_data;
  svn_stream_t *stream;
  svn_revnum_t revision = svn_fs_x__get_revnum(entry->items[0].change_set);
  if (!must_read && !ffd->changes_cache)
    return SVN_NO_ERROR;
  SVN_ERR_ASSERT(entry->item_count == 1);
  if (!must_read && ffd->changes_cache)
    {
      svn_boolean_t is_cached = FALSE;
      SVN_ERR(svn_cache__has_key(&is_cached, ffd->changes_cache, &revision,
                                 scratch_pool));
      if (is_cached)
        return SVN_NO_ERROR;
    }
  SVN_ERR(read_item(&stream, fs, rev_file, entry, scratch_pool));
  SVN_ERR(svn_fs_x__read_changes(changes, stream, result_pool, scratch_pool));
  if (ffd->changes_cache)
    {
      apr_size_t estimated_size = (apr_size_t)250 * (*changes)->nelts;
      if (svn_cache__is_cachable(ffd->changes_cache, estimated_size))
        SVN_ERR(svn_cache__set(ffd->changes_cache, &revision, *changes,
                               scratch_pool));
    }
  return SVN_NO_ERROR;
}
static svn_error_t * block_read_changes ( apr_array_header_t * * changes , svn_fs_t * fs , svn_fs_x__revision_file_t * rev_file , svn_fs_x__p2l_entry_t * entry , svn_boolean_t must_read , apr_pool_t * result_pool , apr_pool_t * scratch_pool ) { svn_fs_x__data_t * ffd = fs -> fsap_data ; svn_stream_t * stream ; svn_revnum_t revision = svn_fs_x__get_revnum ( entry -> items [ 0 ] . change_set ) ; if ( ! must_read && ! ffd -> changes_cache ) return SVN_NO_ERROR ; SVN_ERR_ASSERT ( entry -> item_count == 1 ) ; if ( ! must_read && ffd -> changes_cache ) { svn_boolean_t is_cached = FALSE ; SVN_ERR ( svn_cache__has_key ( & is_cached , ffd -> changes_cache , & revision , scratch_pool ) ) ; if ( is_cached ) return SVN_NO_ERROR ; } SVN_ERR ( read_item ( & stream , fs , rev_file , entry , scratch_pool ) ) ; SVN_ERR ( svn_fs_x__read_changes ( changes , stream , result_pool , scratch_pool ) ) ; if ( ffd -> changes_cache ) { apr_size_t estimated_size = ( apr_size_t ) 250 * ( * changes ) -> nelts ; if ( svn_cache__is_cachable ( ffd -> changes_cache , estimated_size ) ) SVN_ERR ( svn_cache__set ( ffd -> changes_cache , & revision , * changes , scratch_pool ) ) ; } return SVN_NO_ERROR ; }
Read all txdelta / plain windows following REP_HEADER in FS as described
 by ENTRY.
Read all txdelta / plain windows following REP_HEADER in FS as described by ENTRY .
/* we don't support containers, yet */ /* already in cache? */ /* read changes from revision file */ /* cache for future reference */ /* Guesstimate for the size of the in-cache representation. */ /* Don't even serialize data that probably won't fit into the
        * cache.  This often implies that either CHANGES is very
        * large, memory is scarce or both.  Having a huge temporary
        * copy would not be a good thing in either case. */