示例#1
0
svn_error_t *
svn_fs_bdb__write_rep(svn_fs_t *fs,
                      const char *key,
                      const representation_t *rep,
                      trail_t *trail,
                      apr_pool_t *pool)
{
  base_fs_data_t *bfd = fs->fsap_data;
  DBT query, result;
  skel_t *skel;

  /* Convert from native type to skel. */
  SVN_ERR(svn_fs_base__unparse_representation_skel(&skel, rep, pool));

  /* Now write the record. */
  svn_fs_base__trail_debug(trail, "representations", "put");
  SVN_ERR(BDB_WRAP(fs, _("storing representation"),
                   bfd->representations->put
                   (bfd->representations, trail->db_txn,
                    svn_fs_base__str_to_dbt(&query, key),
                    svn_fs_base__skel_to_dbt(&result, skel, pool),
                    0)));

  return SVN_NO_ERROR;
}
示例#2
0
svn_error_t *
svn_fs_bdb__lock_add(svn_fs_t *fs,
                     const char *lock_token,
                     svn_lock_t *lock,
                     trail_t *trail,
                     apr_pool_t *pool)
{
  base_fs_data_t *bfd = fs->fsap_data;
  svn_skel_t *lock_skel;
  DBT key, value;

  /* Convert native type to skel. */
  SVN_ERR(svn_fs_base__unparse_lock_skel(&lock_skel, lock, pool));

  svn_fs_base__str_to_dbt(&key, lock_token);
  svn_fs_base__skel_to_dbt(&value, lock_skel, pool);
  svn_fs_base__trail_debug(trail, "lock", "add");
  return BDB_WRAP(fs, "storing lock record",
                  bfd->locks->put(bfd->locks, trail->db_txn,
                                  &key, &value, 0));
}
示例#3
0
svn_error_t *
svn_fs_bdb__changes_add(svn_fs_t *fs,
                        const char *key,
                        change_t *change,
                        trail_t *trail,
                        apr_pool_t *pool)
{
  base_fs_data_t *bfd = fs->fsap_data;
  DBT query, value;
  svn_skel_t *skel;

  /* Convert native type to skel. */
  SVN_ERR(svn_fs_base__unparse_change_skel(&skel, change, pool));

  /* Store a new record into the database. */
  svn_fs_base__str_to_dbt(&query, key);
  svn_fs_base__skel_to_dbt(&value, skel, pool);
  svn_fs_base__trail_debug(trail, "changes", "put");
  return BDB_WRAP(fs, N_("creating change"),
                  bfd->changes->put(bfd->changes, trail->db_txn,
                                    &query, &value, 0));
}
示例#4
0
svn_error_t *
svn_fs_bdb__put_txn(svn_fs_t *fs,
                    const transaction_t *txn,
                    const char *txn_name,
                    trail_t *trail,
                    apr_pool_t *pool)
{
  base_fs_data_t *bfd = fs->fsap_data;
  svn_skel_t *txn_skel;
  DBT key, value;

  /* Convert native type to skel. */
  SVN_ERR(svn_fs_base__unparse_transaction_skel(&txn_skel, txn, pool));

  /* Only in the context of this function do we know that the DB call
     will not attempt to modify txn_name, so the cast belongs here.  */
  svn_fs_base__str_to_dbt(&key, txn_name);
  svn_fs_base__skel_to_dbt(&value, txn_skel, pool);
  svn_fs_base__trail_debug(trail, "transactions", "put");
  return BDB_WRAP(fs, _("storing transaction record"),
                  bfd->transactions->put(bfd->transactions, trail->db_txn,
                                         &key, &value, 0));
}
示例#5
0
/* ### only has one caller; might not need to be abstracted */
static svn_error_t *
put_copy(svn_fs_t *fs,
         const copy_t *copy,
         const char *copy_id,
         trail_t *trail,
         apr_pool_t *pool)
{
    base_fs_data_t *bfd = fs->fsap_data;
    svn_skel_t *copy_skel;
    DBT key, value;

    /* Convert native type to skel. */
    SVN_ERR(svn_fs_base__unparse_copy_skel(&copy_skel, copy, pool));

    /* Only in the context of this function do we know that the DB call
       will not attempt to modify COPY_ID, so the cast belongs here.  */
    svn_fs_base__str_to_dbt(&key, copy_id);
    svn_fs_base__skel_to_dbt(&value, copy_skel, pool);
    svn_fs_base__trail_debug(trail, "copies", "put");
    return BDB_WRAP(fs, N_("storing copy record"),
                    bfd->copies->put(bfd->copies, trail->db_txn,
                                     &key, &value, 0));
}
示例#6
0
svn_error_t *
svn_fs_bdb__put_node_revision(svn_fs_t *fs,
                              const svn_fs_id_t *id,
                              node_revision_t *noderev,
                              trail_t *trail,
                              apr_pool_t *pool)
{
  base_fs_data_t *bfd = fs->fsap_data;
  DB_TXN *db_txn = trail->db_txn;
  DBT key, value;
  svn_skel_t *skel;

  /* Convert from native type into skel */
  SVN_ERR(svn_fs_base__unparse_node_revision_skel(&skel, noderev,
                                                  bfd->format, pool));
  svn_fs_base__trail_debug(trail, "nodes", "put");
  return BDB_WRAP(fs, N_("storing node revision"),
                  bfd->nodes->put(bfd->nodes, db_txn,
                                  svn_fs_base__id_to_dbt(&key, id, pool),
                                  svn_fs_base__skel_to_dbt(&value, skel,
                                                           pool),
                                  0));
}