1251881Speter/* nodes-table.h : interface to `nodes' table 2251881Speter * 3251881Speter * ==================================================================== 4251881Speter * Licensed to the Apache Software Foundation (ASF) under one 5251881Speter * or more contributor license agreements. See the NOTICE file 6251881Speter * distributed with this work for additional information 7251881Speter * regarding copyright ownership. The ASF licenses this file 8251881Speter * to you under the Apache License, Version 2.0 (the 9251881Speter * "License"); you may not use this file except in compliance 10251881Speter * with the License. You may obtain a copy of the License at 11251881Speter * 12251881Speter * http://www.apache.org/licenses/LICENSE-2.0 13251881Speter * 14251881Speter * Unless required by applicable law or agreed to in writing, 15251881Speter * software distributed under the License is distributed on an 16251881Speter * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17251881Speter * KIND, either express or implied. See the License for the 18251881Speter * specific language governing permissions and limitations 19251881Speter * under the License. 20251881Speter * ==================================================================== 21251881Speter */ 22251881Speter 23251881Speter#ifndef SVN_LIBSVN_FS_NODES_TABLE_H 24251881Speter#define SVN_LIBSVN_FS_NODES_TABLE_H 25251881Speter 26251881Speter#define SVN_WANT_BDB 27251881Speter#include "svn_private_config.h" 28251881Speter 29251881Speter#include "svn_fs.h" 30251881Speter#include "../trail.h" 31251881Speter 32251881Speter#ifdef __cplusplus 33251881Speterextern "C" { 34251881Speter#endif /* __cplusplus */ 35251881Speter 36251881Speter 37251881Speter/* Creating and opening the `nodes' table. */ 38251881Speter 39251881Speter 40251881Speter/* Open a `nodes' table in ENV. If CREATE is non-zero, create 41251881Speter one if it doesn't exist. Set *NODES_P to the new table. 42251881Speter Return a Berkeley DB error code. */ 43251881Speterint svn_fs_bdb__open_nodes_table(DB **nodes_p, 44251881Speter DB_ENV *env, 45251881Speter svn_boolean_t create); 46251881Speter 47251881Speter 48251881Speter/* Check FS's `nodes' table to find an unused node number, and set 49251881Speter *ID_P to the ID of the first revision of an entirely new node in 50251881Speter FS, with copy_id COPY_ID, created in transaction TXN_ID, as part 51251881Speter of TRAIL. Allocate the new ID, and do all temporary allocation, 52251881Speter in POOL. */ 53251881Spetersvn_error_t *svn_fs_bdb__new_node_id(svn_fs_id_t **id_p, 54251881Speter svn_fs_t *fs, 55251881Speter const char *copy_id, 56251881Speter const char *txn_id, 57251881Speter trail_t *trail, 58251881Speter apr_pool_t *pool); 59251881Speter 60251881Speter 61251881Speter/* Delete node revision ID from FS's `nodes' table, as part of TRAIL. 62251881Speter WARNING: This does not check that the node revision is mutable! 63251881Speter Callers should do that check themselves. 64251881Speter 65251881Speter todo: Jim and Karl are both not sure whether it would be better for 66251881Speter this to check mutability or not. On the one hand, having the 67251881Speter lowest level do that check would seem intuitively good. On the 68251881Speter other hand, we'll need a way to delete even immutable nodes someday 69251881Speter -- for example, someone accidentally commits NDA-protected data to 70251881Speter a public repository and wants to remove it. Thoughts? */ 71251881Spetersvn_error_t *svn_fs_bdb__delete_nodes_entry(svn_fs_t *fs, 72251881Speter const svn_fs_id_t *id, 73251881Speter trail_t *trail, 74251881Speter apr_pool_t *pool); 75251881Speter 76251881Speter 77251881Speter/* Set *SUCCESSOR_P to the ID of an immediate successor to node 78251881Speter revision ID in FS that does not exist yet, as part of TRAIL. 79251881Speter Allocate *SUCCESSOR_P in POOL. 80251881Speter 81251881Speter Use the current Subversion transaction name TXN_ID, and optionally 82251881Speter a copy id COPY_ID, in the determination of the new node revision 83251881Speter ID. */ 84251881Spetersvn_error_t *svn_fs_bdb__new_successor_id(svn_fs_id_t **successor_p, 85251881Speter svn_fs_t *fs, 86251881Speter const svn_fs_id_t *id, 87251881Speter const char *copy_id, 88251881Speter const char *txn_id, 89251881Speter trail_t *trail, 90251881Speter apr_pool_t *pool); 91251881Speter 92251881Speter 93251881Speter/* Set *NODEREV_P to the node-revision for the node ID in FS, as 94251881Speter part of TRAIL. Do any allocations in POOL. Allow NODEREV_P 95251881Speter to be NULL, in which case it is not used, and this function acts as 96251881Speter an existence check for ID in FS. */ 97251881Spetersvn_error_t *svn_fs_bdb__get_node_revision(node_revision_t **noderev_p, 98251881Speter svn_fs_t *fs, 99251881Speter const svn_fs_id_t *id, 100251881Speter trail_t *trail, 101251881Speter apr_pool_t *pool); 102251881Speter 103251881Speter 104251881Speter/* Store NODEREV as the node-revision for the node whose id 105251881Speter is ID in FS, as part of TRAIL. Do any necessary temporary 106251881Speter allocation in POOL. 107251881Speter 108251881Speter After this call, the node table manager assumes that NODE's 109251881Speter contents will change frequently. */ 110251881Spetersvn_error_t *svn_fs_bdb__put_node_revision(svn_fs_t *fs, 111251881Speter const svn_fs_id_t *id, 112251881Speter node_revision_t *noderev, 113251881Speter trail_t *trail, 114251881Speter apr_pool_t *pool); 115251881Speter 116251881Speter 117251881Speter#ifdef __cplusplus 118251881Speter} 119251881Speter#endif /* __cplusplus */ 120251881Speter 121251881Speter#endif /* SVN_LIBSVN_FS_NODES_TABLE_H */ 122