1251881Speter/* changes-table.h : internal interface to `changes' 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_CHANGES_TABLE_H
24251881Speter#define SVN_LIBSVN_FS_CHANGES_TABLE_H
25251881Speter
26251881Speter#define SVN_WANT_BDB
27251881Speter#include "svn_private_config.h"
28251881Speter
29251881Speter#include "svn_io.h"
30251881Speter#include "svn_fs.h"
31251881Speter#include "../fs.h"
32251881Speter#include "../trail.h"
33251881Speter
34251881Speter#ifdef __cplusplus
35251881Speterextern "C" {
36251881Speter#endif /* __cplusplus */
37251881Speter
38251881Speter
39251881Speter/* Open a `changes' table in ENV.  If CREATE is non-zero, create one
40251881Speter   if it doesn't exist.  Set *CHANGES_P to the new table.  Return a
41251881Speter   Berkeley DB error code.  */
42251881Speterint svn_fs_bdb__open_changes_table(DB **changes_p,
43251881Speter                                   DB_ENV *env,
44251881Speter                                   svn_boolean_t create);
45251881Speter
46251881Speter
47251881Speter/* Add CHANGE as a record to the `changes' table in FS as part of
48251881Speter   TRAIL, keyed on KEY.
49251881Speter
50251881Speter   CHANGE->path is expected to be a canonicalized filesystem path (see
51251881Speter   svn_fs__canonicalize_abspath).
52251881Speter
53251881Speter   Note that because the `changes' table uses duplicate keys, this
54251881Speter   function will not overwrite prior additions that have the KEY
55251881Speter   key, but simply adds this new record alongside previous ones.  */
56251881Spetersvn_error_t *svn_fs_bdb__changes_add(svn_fs_t *fs,
57251881Speter                                     const char *key,
58251881Speter                                     change_t *change,
59251881Speter                                     trail_t *trail,
60251881Speter                                     apr_pool_t *pool);
61251881Speter
62251881Speter
63251881Speter/* Remove all changes associated with KEY from the `changes' table in
64251881Speter   FS, as part of TRAIL. */
65251881Spetersvn_error_t *svn_fs_bdb__changes_delete(svn_fs_t *fs,
66251881Speter                                        const char *key,
67251881Speter                                        trail_t *trail,
68251881Speter                                        apr_pool_t *pool);
69251881Speter
70251881Speter/* Return a hash *CHANGES_P, keyed on const char * paths, and
71251881Speter   containing svn_fs_path_change2_t * values representing summarized
72251881Speter   changed records associated with KEY in FS, as part of TRAIL.
73251881Speter   Allocate the array and its items in POOL.  */
74251881Spetersvn_error_t *svn_fs_bdb__changes_fetch(apr_hash_t **changes_p,
75251881Speter                                       svn_fs_t *fs,
76251881Speter                                       const char *key,
77251881Speter                                       trail_t *trail,
78251881Speter                                       apr_pool_t *pool);
79251881Speter
80251881Speter/* Return an array *CHANGES_P of change_t * items representing
81251881Speter   all the change records associated with KEY in FS, as part of TRAIL.
82251881Speter   Allocate the array and its items in POOL.  */
83251881Spetersvn_error_t *svn_fs_bdb__changes_fetch_raw(apr_array_header_t **changes_p,
84251881Speter                                           svn_fs_t *fs,
85251881Speter                                           const char *key,
86251881Speter                                           trail_t *trail,
87251881Speter                                           apr_pool_t *pool);
88251881Speter
89251881Speter
90251881Speter#ifdef __cplusplus
91251881Speter}
92251881Speter#endif /* __cplusplus */
93251881Speter
94251881Speter#endif /* SVN_LIBSVN_FS_CHANGES_TABLE_H */
95