1/* changes-table.h : internal interface to `changes' 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_CHANGES_TABLE_H
24#define SVN_LIBSVN_FS_CHANGES_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/* Open a `changes' table in ENV.  If CREATE is non-zero, create one
40   if it doesn't exist.  Set *CHANGES_P to the new table.  Return a
41   Berkeley DB error code.  */
42int svn_fs_bdb__open_changes_table(DB **changes_p,
43                                   DB_ENV *env,
44                                   svn_boolean_t create);
45
46
47/* Add CHANGE as a record to the `changes' table in FS as part of
48   TRAIL, keyed on KEY.
49
50   CHANGE->path is expected to be a canonicalized filesystem path (see
51   svn_fs__canonicalize_abspath).
52
53   Note that because the `changes' table uses duplicate keys, this
54   function will not overwrite prior additions that have the KEY
55   key, but simply adds this new record alongside previous ones.  */
56svn_error_t *svn_fs_bdb__changes_add(svn_fs_t *fs,
57                                     const char *key,
58                                     change_t *change,
59                                     trail_t *trail,
60                                     apr_pool_t *pool);
61
62
63/* Remove all changes associated with KEY from the `changes' table in
64   FS, as part of TRAIL. */
65svn_error_t *svn_fs_bdb__changes_delete(svn_fs_t *fs,
66                                        const char *key,
67                                        trail_t *trail,
68                                        apr_pool_t *pool);
69
70/* Return a hash *CHANGES_P, keyed on const char * paths, and
71   containing svn_fs_path_change2_t * values representing summarized
72   changed records associated with KEY in FS, as part of TRAIL.
73   Allocate the array and its items in POOL.  */
74svn_error_t *svn_fs_bdb__changes_fetch(apr_hash_t **changes_p,
75                                       svn_fs_t *fs,
76                                       const char *key,
77                                       trail_t *trail,
78                                       apr_pool_t *pool);
79
80/* Return an array *CHANGES_P of change_t * items representing
81   all the change records associated with KEY in FS, as part of TRAIL.
82   Allocate the array and its items in POOL.  */
83svn_error_t *svn_fs_bdb__changes_fetch_raw(apr_array_header_t **changes_p,
84                                           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_CHANGES_TABLE_H */
95