FreeBSD/contrib/subversion/subversion/libsvn_fs_base/bdb/nodes-table.c
/* Choosing node revision ID's.  */
Choosing node revision ID's.
Choosing node revision ID ' s .
svn_error_t *
svn_fs_bdb__new_node_id(svn_fs_id_t **id_p,
                        svn_fs_t *fs,
                        const char *copy_id,
                        const char *txn_id,
                        trail_t *trail,
                        apr_pool_t *pool)
{
  base_fs_data_t *bfd = fs->fsap_data;
  DBT query, result;
  apr_size_t len;
  char next_key[MAX_KEY_SIZE];
  int db_err;
  const char *next_node_id;
  SVN_ERR_ASSERT(txn_id);
  svn_fs_base__str_to_dbt(&query, NEXT_KEY_KEY);
  svn_fs_base__trail_debug(trail, "nodes", "get");
  SVN_ERR(BDB_WRAP(fs, N_("allocating new node ID (getting 'next-key')"),
                   bfd->nodes->get(bfd->nodes, trail->db_txn,
                                   &query,
                                   svn_fs_base__result_dbt(&result),
                                   0)));
  svn_fs_base__track_dbt(&result, pool);
  next_node_id = apr_pstrmemdup(pool, result.data, result.size);
  len = result.size;
  svn_fs_base__next_key(result.data, &len, next_key);
  svn_fs_base__trail_debug(trail, "nodes", "put");
  db_err = bfd->nodes->put(bfd->nodes, trail->db_txn,
                           svn_fs_base__str_to_dbt(&query, NEXT_KEY_KEY),
                           svn_fs_base__str_to_dbt(&result, next_key),
                           0);
  SVN_ERR(BDB_WRAP(fs, N_("bumping next node ID key"), db_err));
  *id_p = svn_fs_base__id_create(next_node_id, copy_id, txn_id, pool);
  return SVN_NO_ERROR;
}
svn_error_t * svn_fs_bdb__new_node_id ( svn_fs_id_t * * id_p , svn_fs_t * fs , const char * copy_id , const char * txn_id , trail_t * trail , apr_pool_t * pool ) { base_fs_data_t * bfd = fs -> fsap_data ; DBT query , result ; apr_size_t len ; char next_key [ MAX_KEY_SIZE ] ; int db_err ; const char * next_node_id ; SVN_ERR_ASSERT ( txn_id ) ; svn_fs_base__str_to_dbt ( & query , NEXT_KEY_KEY ) ; svn_fs_base__trail_debug ( trail , " " , " " ) ; SVN_ERR ( BDB_WRAP ( fs , N_ ( " " ) , bfd -> nodes -> get ( bfd -> nodes , trail -> db_txn , & query , svn_fs_base__result_dbt ( & result ) , 0 ) ) ) ; svn_fs_base__track_dbt ( & result , pool ) ; next_node_id = apr_pstrmemdup ( pool , result . data , result . size ) ; len = result . size ; svn_fs_base__next_key ( result . data , & len , next_key ) ; svn_fs_base__trail_debug ( trail , " " , " " ) ; db_err = bfd -> nodes -> put ( bfd -> nodes , trail -> db_txn , svn_fs_base__str_to_dbt ( & query , NEXT_KEY_KEY ) , svn_fs_base__str_to_dbt ( & result , next_key ) , 0 ) ; SVN_ERR ( BDB_WRAP ( fs , N_ ( " " ) , db_err ) ) ; * id_p = svn_fs_base__id_create ( next_node_id , copy_id , txn_id , pool ) ; return SVN_NO_ERROR ; }
Choosing node revision ID's.
Choosing node revision ID ' s .
/* Get the current value associated with the `next-key' key in the table.  */ /* Squirrel away our next node id value. */ /* Bump to future key. */ /* Create and return the new node id. */