1 /* node-rev.c --- storing and retrieving NODE-REVISION skels
3 * ====================================================================
4 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
27 #include "reps-strings.h"
29 #include "../libsvn_fs/fs-loader.h"
31 #include "bdb/nodes-table.h"
32 #include "bdb/node-origins-table.h"
35 /* Creating completely new nodes. */
39 svn_fs_base__create_node(const svn_fs_id_t
**id_p
,
41 node_revision_t
*noderev
,
48 base_fs_data_t
*bfd
= fs
->fsap_data
;
50 /* Find an unused ID for the node. */
51 SVN_ERR(svn_fs_bdb__new_node_id(&id
, fs
, copy_id
, txn_id
, trail
, pool
));
53 /* Store its NODE-REVISION skel. */
54 SVN_ERR(svn_fs_bdb__put_node_revision(fs
, id
, noderev
, trail
, pool
));
56 /* Add a record in the node origins index table if our format
58 if (bfd
->format
>= SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT
)
60 SVN_ERR(svn_fs_bdb__set_node_origin(fs
, svn_fs_base__id_node_id(id
),
70 /* Creating new revisions of existing nodes. */
73 svn_fs_base__create_successor(const svn_fs_id_t
**new_id_p
,
75 const svn_fs_id_t
*old_id
,
76 node_revision_t
*new_noderev
,
84 /* Choose an ID for the new node, and store it in the database. */
85 SVN_ERR(svn_fs_bdb__new_successor_id(&new_id
, fs
, old_id
, copy_id
,
86 txn_id
, trail
, pool
));
88 /* Store the new skel under that ID. */
89 SVN_ERR(svn_fs_bdb__put_node_revision(fs
, new_id
, new_noderev
,
98 /* Deleting a node revision. */
101 svn_fs_base__delete_node_revision(svn_fs_t
*fs
,
102 const svn_fs_id_t
*id
,
103 svn_boolean_t origin_also
,
107 base_fs_data_t
*bfd
= fs
->fsap_data
;
109 /* ### todo: here, we should adjust other nodes to compensate for
112 /* Delete the node origin record, too, if asked to do so and our
113 format supports it. */
114 if (origin_also
&& (bfd
->format
>= SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT
))
116 SVN_ERR(svn_fs_bdb__delete_node_origin(fs
, svn_fs_base__id_node_id(id
),
120 return svn_fs_bdb__delete_nodes_entry(fs
, id
, trail
, pool
);