1/* nodes-table.h : interface to `nodes' table 2 * 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 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 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 19 * under the License. 20 * ==================================================================== 21 */ 22 23#ifndef SVN_LIBSVN_FS_NODES_TABLE_H 24#define SVN_LIBSVN_FS_NODES_TABLE_H 25 26#define SVN_WANT_BDB 27#include "svn_private_config.h" 28 29#include "svn_fs.h" 30#include "../trail.h" 31 32#ifdef __cplusplus 33extern "C" { 34#endif /* __cplusplus */ 35 36 37/* Creating and opening the `nodes' table. */ 38 39 40/* Open a `nodes' table in ENV. If CREATE is non-zero, create 41 one if it doesn't exist. Set *NODES_P to the new table. 42 Return a Berkeley DB error code. */ 43int svn_fs_bdb__open_nodes_table(DB **nodes_p, 44 DB_ENV *env, 45 svn_boolean_t create); 46 47 48/* Check FS's `nodes' table to find an unused node number, and set 49 *ID_P to the ID of the first revision of an entirely new node in 50 FS, with copy_id COPY_ID, created in transaction TXN_ID, as part 51 of TRAIL. Allocate the new ID, and do all temporary allocation, 52 in POOL. */ 53svn_error_t *svn_fs_bdb__new_node_id(svn_fs_id_t **id_p, 54 svn_fs_t *fs, 55 const char *copy_id, 56 const char *txn_id, 57 trail_t *trail, 58 apr_pool_t *pool); 59 60 61/* Delete node revision ID from FS's `nodes' table, as part of TRAIL. 62 WARNING: This does not check that the node revision is mutable! 63 Callers should do that check themselves. 64 65 todo: Jim and Karl are both not sure whether it would be better for 66 this to check mutability or not. On the one hand, having the 67 lowest level do that check would seem intuitively good. On the 68 other hand, we'll need a way to delete even immutable nodes someday 69 -- for example, someone accidentally commits NDA-protected data to 70 a public repository and wants to remove it. Thoughts? */ 71svn_error_t *svn_fs_bdb__delete_nodes_entry(svn_fs_t *fs, 72 const svn_fs_id_t *id, 73 trail_t *trail, 74 apr_pool_t *pool); 75 76 77/* Set *SUCCESSOR_P to the ID of an immediate successor to node 78 revision ID in FS that does not exist yet, as part of TRAIL. 79 Allocate *SUCCESSOR_P in POOL. 80 81 Use the current Subversion transaction name TXN_ID, and optionally 82 a copy id COPY_ID, in the determination of the new node revision 83 ID. */ 84svn_error_t *svn_fs_bdb__new_successor_id(svn_fs_id_t **successor_p, 85 svn_fs_t *fs, 86 const svn_fs_id_t *id, 87 const char *copy_id, 88 const char *txn_id, 89 trail_t *trail, 90 apr_pool_t *pool); 91 92 93/* Set *NODEREV_P to the node-revision for the node ID in FS, as 94 part of TRAIL. Do any allocations in POOL. Allow NODEREV_P 95 to be NULL, in which case it is not used, and this function acts as 96 an existence check for ID in FS. */ 97svn_error_t *svn_fs_bdb__get_node_revision(node_revision_t **noderev_p, 98 svn_fs_t *fs, 99 const svn_fs_id_t *id, 100 trail_t *trail, 101 apr_pool_t *pool); 102 103 104/* Store NODEREV as the node-revision for the node whose id 105 is ID in FS, as part of TRAIL. Do any necessary temporary 106 allocation in POOL. 107 108 After this call, the node table manager assumes that NODE's 109 contents will change frequently. */ 110svn_error_t *svn_fs_bdb__put_node_revision(svn_fs_t *fs, 111 const svn_fs_id_t *id, 112 node_revision_t *noderev, 113 trail_t *trail, 114 apr_pool_t *pool); 115 116 117#ifdef __cplusplus 118} 119#endif /* __cplusplus */ 120 121#endif /* SVN_LIBSVN_FS_NODES_TABLE_H */ 122