FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c
/* After a fulltext cache lookup failure, we will continue to read from
 * combined delta or plain windows.  However, we must first make that data
 * stream in BATON catch up tho the position LEN already delivered from the
 * fulltext cache.  Also, we need to store the reconstructed fulltext if we
 * want to cache it at the end.
 */
After a fulltext cache lookup failure, we will continue to read from
combined delta or plain windows.  However, we must first make that data
stream in BATON catch up tho the position LEN already delivered from the
fulltext cache.  Also, we need to store the reconstructed fulltext if we
want to cache it at the end.
After a fulltext cache lookup failure we will continue to read from combined delta or plain windows . However we must first make that data stream in BATON catch up tho the position LEN already delivered from the fulltext cache . Also we need to store the reconstructed fulltext if we want to cache it at the end .
static svn_error_t *
skip_contents(struct rep_read_baton *baton,
              svn_filesize_t len)
{
  svn_error_t *err = SVN_NO_ERROR;
  if (SVN_IS_VALID_REVNUM(baton->fulltext_cache_key.revision))
    {
      char *buffer;
      svn_filesize_t to_alloc = MAX(len, baton->len);
      SVN_ERR_ASSERT((apr_size_t)to_alloc == to_alloc);
      baton->current_fulltext = svn_stringbuf_create_ensure(
                        optimimal_allocation_size((apr_size_t)to_alloc),
                        baton->filehandle_pool);
      baton->current_fulltext->len = (apr_size_t)len;
      baton->current_fulltext->data[(apr_size_t)len] = 0;
      buffer = baton->current_fulltext->data;
      while (len > 0 && !err)
        {
          apr_size_t to_read = (apr_size_t)len;
          err = get_contents_from_windows(baton, buffer, &to_read);
          len -= to_read;
          buffer += to_read;
        }
    }
  else if (len > 0)
    {
      apr_pool_t *subpool = subpool = svn_pool_create(baton->pool);
      char *buffer = apr_palloc(subpool, SVN__STREAM_CHUNK_SIZE);
      while (len > 0 && !err)
        {
          apr_size_t to_read = len > SVN__STREAM_CHUNK_SIZE
                            ? SVN__STREAM_CHUNK_SIZE
                            : (apr_size_t)len;
          err = get_contents_from_windows(baton, buffer, &to_read);
          len -= to_read;
        }
      svn_pool_destroy(subpool);
    }
  return svn_error_trace(err);
}
static svn_error_t * skip_contents ( struct rep_read_baton * baton , svn_filesize_t len ) { svn_error_t * err = SVN_NO_ERROR ; if ( SVN_IS_VALID_REVNUM ( baton -> fulltext_cache_key . revision ) ) { char * buffer ; svn_filesize_t to_alloc = MAX ( len , baton -> len ) ; SVN_ERR_ASSERT ( ( apr_size_t ) to_alloc == to_alloc ) ; baton -> current_fulltext = svn_stringbuf_create_ensure ( optimimal_allocation_size ( ( apr_size_t ) to_alloc ) , baton -> filehandle_pool ) ; baton -> current_fulltext -> len = ( apr_size_t ) len ; baton -> current_fulltext -> data [ ( apr_size_t ) len ] = 0 ; buffer = baton -> current_fulltext -> data ; while ( len > 0 && ! err ) { apr_size_t to_read = ( apr_size_t ) len ; err = get_contents_from_windows ( baton , buffer , & to_read ) ; len -= to_read ; buffer += to_read ; } } else if ( len > 0 ) { apr_pool_t * subpool = subpool = svn_pool_create ( baton -> pool ) ; char * buffer = apr_palloc ( subpool , SVN__STREAM_CHUNK_SIZE ) ; while ( len > 0 && ! err ) { apr_size_t to_read = len > SVN__STREAM_CHUNK_SIZE ? SVN__STREAM_CHUNK_SIZE : ( apr_size_t ) len ; err = get_contents_from_windows ( baton , buffer , & to_read ) ; len -= to_read ; } svn_pool_destroy ( subpool ) ; } return svn_error_trace ( err ) ; }
After a fulltext cache lookup failure, we will continue to read from
 combined delta or plain windows.
After a fulltext cache lookup failure we will continue to read from combined delta or plain windows .
/* Do we want to cache the reconstructed fulltext? */ /* This should only be happening if BATON->LEN and LEN are
       * cacheable, implying they fit into memory. */ /* Allocate the fulltext buffer. */ /* Read LEN bytes from the window stream and store the data
       * in the fulltext buffer (will be filled by further reads later). */ /* Simply drain LEN bytes from the window stream. */