1/* copies-table.h : internal interface to ops on `copies' 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_COPIES_TABLE_H
24#define SVN_LIBSVN_FS_COPIES_TABLE_H
25
26#include "svn_fs.h"
27#include "../fs.h"
28#include "../trail.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif /* __cplusplus */
33
34
35/* Open a `copies' table in ENV.  If CREATE is non-zero, create
36   one if it doesn't exist.  Set *COPIES_P to the new table.
37   Return a Berkeley DB error code.  */
38int svn_fs_bdb__open_copies_table(DB **copies_p,
39                                  DB_ENV *env,
40                                  svn_boolean_t create);
41
42/* Reserve a slot in the `copies' table in FS for a new copy operation
43   as part of TRAIL.  Return the slot's id in *COPY_ID_P, allocated in
44   POOL.  */
45svn_error_t *svn_fs_bdb__reserve_copy_id(const char **copy_id_p,
46                                         svn_fs_t *fs,
47                                         trail_t *trail,
48                                         apr_pool_t *pool);
49
50/* Create a new copy with id COPY_ID in FS as part of TRAIL.
51   SRC_PATH/SRC_TXN_ID are the path/transaction ID (respectively) of
52   the copy source, and DST_NODEREV_ID is the node revision id of the
53   copy destination.  KIND describes the type of copy operation.
54
55   SRC_PATH is expected to be a canonicalized filesystem path (see
56   svn_fs__canonicalize_abspath).
57
58   COPY_ID should generally come from a call to
59   svn_fs_bdb__reserve_copy_id().  */
60svn_error_t *svn_fs_bdb__create_copy(svn_fs_t *fs,
61                                     const char *copy_id,
62                                     const char *src_path,
63                                     const char *src_txn_id,
64                                     const svn_fs_id_t *dst_noderev_id,
65                                     copy_kind_t kind,
66                                     trail_t *trail,
67                                     apr_pool_t *pool);
68
69/* Remove the copy whose name is COPY_ID from the `copies' table of
70   FS, as part of TRAIL.  If there is no such copy,
71   SVN_ERR_FS_NO_SUCH_COPY is the error returned.  */
72svn_error_t *svn_fs_bdb__delete_copy(svn_fs_t *fs,
73                                     const char *copy_id,
74                                     trail_t *trail,
75                                     apr_pool_t *pool);
76
77/* Retrieve the copy *COPY_P named COPY_ID from the `copies' table of
78   FS, as part of TRAIL.  Perform all allocations in POOL.  If
79   there is no such copy, SVN_ERR_FS_NO_SUCH_COPY is the error
80   returned.  */
81svn_error_t *svn_fs_bdb__get_copy(copy_t **copy_p,
82                                  svn_fs_t *fs,
83                                  const char *copy_id,
84                                  trail_t *trail,
85                                  apr_pool_t *pool);
86
87
88
89#ifdef __cplusplus
90}
91#endif /* __cplusplus */
92
93#endif /* SVN_LIBSVN_FS_COPIES_TABLE_H */
94