1/* reps-table.h : internal interface to `representations' 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_REPS_TABLE_H
24#define SVN_LIBSVN_FS_REPS_TABLE_H
25
26#define SVN_WANT_BDB
27#include "svn_private_config.h"
28
29#include "svn_io.h"
30#include "svn_fs.h"
31#include "../fs.h"
32#include "../trail.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* __cplusplus */
37
38
39/*** Creating the `representations' table. ***/
40
41/* Open a `representations' table in ENV.  If CREATE is non-zero,
42   create one if it doesn't exist.  Set *REPS_P to the new table.
43   Return a Berkeley DB error code.  */
44int svn_fs_bdb__open_reps_table(DB **reps_p,
45                                DB_ENV *env,
46                                svn_boolean_t create);
47
48
49
50/*** Storing and retrieving reps.  ***/
51
52/* Set *REP_P to point to the representation for the key KEY in
53   FS, as part of TRAIL.  Perform all allocations in POOL.
54
55   If KEY is not a representation in FS, the error
56   SVN_ERR_FS_NO_SUCH_REPRESENTATION is returned.  */
57svn_error_t *svn_fs_bdb__read_rep(representation_t **rep_p,
58                                  svn_fs_t *fs,
59                                  const char *key,
60                                  trail_t *trail,
61                                  apr_pool_t *pool);
62
63
64/* Store REP as the representation for KEY in FS, as part of
65   TRAIL.  Do any necessary temporary allocation in POOL.  */
66svn_error_t *svn_fs_bdb__write_rep(svn_fs_t *fs,
67                                   const char *key,
68                                   const representation_t *rep,
69                                   trail_t *trail,
70                                   apr_pool_t *pool);
71
72
73/* Store REP as a new representation in FS, and the new rep's key in
74   *KEY, as part of trail.  The new key is allocated in POOL.  */
75svn_error_t *svn_fs_bdb__write_new_rep(const char **key,
76                                       svn_fs_t *fs,
77                                       const representation_t *rep,
78                                       trail_t *trail,
79                                       apr_pool_t *pool);
80
81/* Delete representation KEY from FS, as part of TRAIL.
82   WARNING: This does not ensure that no one references this
83   representation!  Callers should ensure that themselves.  */
84svn_error_t *svn_fs_bdb__delete_rep(svn_fs_t *fs,
85                                    const char *key,
86                                    trail_t *trail,
87                                    apr_pool_t *pool);
88
89
90#ifdef __cplusplus
91}
92#endif /* __cplusplus */
93
94#endif /* SVN_LIBSVN_FS_REPS_TABLE_H */
95