1 /* node-rev.c --- storing and retrieving NODE-REVISION skels
3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
26 #include "svn_private_config.h"
32 #include "reps-strings.h"
34 #include "../libsvn_fs/fs-loader.h"
36 #include "bdb/nodes-table.h"
37 #include "bdb/node-origins-table.h"
40 /* Creating completely new nodes. */
44 svn_fs_base__create_node(const svn_fs_id_t **id_p,
46 node_revision_t *noderev,
53 base_fs_data_t *bfd = fs->fsap_data;
55 /* Find an unused ID for the node. */
56 SVN_ERR(svn_fs_bdb__new_node_id(&id, fs, copy_id, txn_id, trail, pool));
58 /* Store its NODE-REVISION skel. */
59 SVN_ERR(svn_fs_bdb__put_node_revision(fs, id, noderev, trail, pool));
61 /* Add a record in the node origins index table if our format
63 if (bfd->format >= SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT)
65 SVN_ERR(svn_fs_bdb__set_node_origin(fs, svn_fs_base__id_node_id(id),
75 /* Creating new revisions of existing nodes. */
78 svn_fs_base__create_successor(const svn_fs_id_t **new_id_p,
80 const svn_fs_id_t *old_id,
81 node_revision_t *new_noderev,
89 /* Choose an ID for the new node, and store it in the database. */
90 SVN_ERR(svn_fs_bdb__new_successor_id(&new_id, fs, old_id, copy_id,
91 txn_id, trail, pool));
93 /* Store the new skel under that ID. */
94 SVN_ERR(svn_fs_bdb__put_node_revision(fs, new_id, new_noderev,
103 /* Deleting a node revision. */
106 svn_fs_base__delete_node_revision(svn_fs_t *fs,
107 const svn_fs_id_t *id,
108 svn_boolean_t origin_also,
112 base_fs_data_t *bfd = fs->fsap_data;
114 /* ### todo: here, we should adjust other nodes to compensate for
117 /* Delete the node origin record, too, if asked to do so and our
118 format supports it. */
119 if (origin_also && (bfd->format >= SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT))
121 SVN_ERR(svn_fs_bdb__delete_node_origin(fs, svn_fs_base__id_node_id(id),
125 return svn_fs_bdb__delete_nodes_entry(fs, id, trail, pool);