FreeBSD/contrib/subversion/subversion/libsvn_fs_x/tree.c
/* Try a short-cut for the open_path() function using the last node accessed.
 * If that ROOT is that nodes's "created rev" and PATH of PATH_LEN chars is
 * its "created path", return the node in *NODE_P.  Set it to NULL otherwise.
 *
 * This function is used to support ra_serf-style access patterns where we
 * are first asked for path@rev and then for path@c_rev of the same node.
 * The shortcut works by ignoring the "rev" part of the cache key and then
 * checking whether we got lucky.  Lookup and verification are both quick
 * plus there are many early outs for common types of mismatch.
 */
Try a short-cut for the open_path() function using the last node accessed.
If that ROOT is that nodes's "created rev" and PATH of PATH_LEN chars is
its "created path", return the node in *NODE_P.  Set it to NULL otherwise.

This function is used to support ra_serf-style access patterns where we
are first asked for path@rev and then for path@c_rev of the same node.
The shortcut works by ignoring the "rev" part of the cache key and then
checking whether we got lucky.  Lookup and verification are both quick
plus there are many early outs for common types of mismatch.
Try a short - cut for the open_path () function using the last node accessed . If that ROOT is that nodes ' s " created rev " and PATH of PATH_LEN chars is its " created path " return the node in * NODE_P . Set it to NULL otherwise . This function is used to support ra_serf - style access patterns where we are first asked for path@rev and then for path@c_rev of the same node . The shortcut works by ignoring the " rev " part of the cache key and then checking whether we got lucky . Lookup and verification are both quick plus there are many early outs for common types of mismatch .
static svn_error_t *
try_match_last_node(dag_node_t **node_p,
                    svn_fs_root_t *root,
                    const char *path,
                    apr_size_t path_len,
                    apr_pool_t *scratch_pool)
{
  svn_fs_x__data_t *ffd = root->fs->fsap_data;
  dag_node_t *node
    = cache_lookup_last_path(ffd->dag_node_cache, path, path_len);
  if (node && !svn_fs_x__dag_check_mutable(node))
    {
      const char *created_path
        = svn_fs_x__dag_get_created_path(node);
      svn_revnum_t revision = svn_fs_x__dag_get_revision(node);
      if (revision == root->rev && strcmp(created_path, path) == 0)
        {
          SVN_ERR(dag_node_cache_set(root, path, node, scratch_pool));
          *node_p = node;
          return SVN_NO_ERROR;
        }
    }
  *node_p = NULL;
  return SVN_NO_ERROR;
}
static svn_error_t * try_match_last_node ( dag_node_t * * node_p , svn_fs_root_t * root , const char * path , apr_size_t path_len , apr_pool_t * scratch_pool ) { svn_fs_x__data_t * ffd = root -> fs -> fsap_data ; dag_node_t * node = cache_lookup_last_path ( ffd -> dag_node_cache , path , path_len ) ; if ( node && ! svn_fs_x__dag_check_mutable ( node ) ) { const char * created_path = svn_fs_x__dag_get_created_path ( node ) ; svn_revnum_t revision = svn_fs_x__dag_get_revision ( node ) ; if ( revision == root -> rev && strcmp ( created_path , path ) == 0 ) { SVN_ERR ( dag_node_cache_set ( root , path , node , scratch_pool ) ) ; * node_p = node ; return SVN_NO_ERROR ; } } * node_p = NULL ; return SVN_NO_ERROR ; }
Try a short-cut for the open_path() function using the last node accessed.
Try a short - cut for the open_path () function using the last node accessed .
/* Optimistic lookup: if the last node returned from the cache applied to
     the same PATH, return it in NODE. */ /* Did we get a bucket with a committed node? */ /* Get the path&rev pair at which this node was created.
         This is repository location for which this node is _known_ to be
         the right lookup result irrespective of how we found it. */ /* Is it an exact match? */ /* Cache it under its full path@rev access path. */