]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - subversion/libsvn_fs_x/rep-cache.h
Import Subversion-1.10.0
[FreeBSD/FreeBSD.git] / subversion / libsvn_fs_x / rep-cache.h
1 /* rep-cache.h : interface to rep cache db functions
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_X_REP_CACHE_H
24 #define SVN_LIBSVN_FS_X_REP_CACHE_H
25
26 #include "svn_error.h"
27
28 #include "fs.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34 \f
35 #define REP_CACHE_DB_NAME        "rep-cache.db"
36
37 /* Open and create, if needed, the rep cache database associated with FS.
38    Use SCRATCH_POOL for temporary allocations. */
39 svn_error_t *
40 svn_fs_x__open_rep_cache(svn_fs_t *fs,
41                          apr_pool_t *scratch_pool);
42
43 /* Close the rep cache database associated with FS. */
44 svn_error_t *
45 svn_fs_x__close_rep_cache(svn_fs_t *fs);
46
47 /* Set *EXISTS to TRUE iff the rep-cache DB file exists. */
48 svn_error_t *
49 svn_fs_x__exists_rep_cache(svn_boolean_t *exists,
50                            svn_fs_t *fs,
51                            apr_pool_t *scratch_pool);
52
53 /* Iterate all representations currently in FS's cache. */
54 svn_error_t *
55 svn_fs_x__walk_rep_reference(svn_fs_t *fs,
56                              svn_revnum_t start,
57                              svn_revnum_t end,
58                              svn_error_t *(*walker)(svn_fs_x__representation_t *rep,
59                                                     void *walker_baton,
60                                                     svn_fs_t *fs,
61                                                     apr_pool_t *scratch_pool),
62                              void *walker_baton,
63                              svn_cancel_func_t cancel_func,
64                              void *cancel_baton,
65                              apr_pool_t *scratch_pool);
66
67 /* Return the representation REP in FS which has fulltext CHECKSUM.
68    *REP_P is allocated in RESULT_POOL.  If the rep cache database has not
69    been opened, just set *REP_P to NULL.  Returns SVN_ERR_FS_CORRUPT if
70    a reference beyond HEAD is detected.  Uses SCRATCH_POOL for temporary
71    allocations.*/
72 svn_error_t *
73 svn_fs_x__get_rep_reference(svn_fs_x__representation_t **rep_p,
74                             svn_fs_t *fs,
75                             svn_checksum_t *checksum,
76                             apr_pool_t *result_pool,
77                             apr_pool_t *scratch_pool);
78
79 /* Set the representation REP in FS, using REP->CHECKSUM.
80    Use SCRATCH_POOL for temporary allocations.  Returns SVN_ERR_FS_CORRUPT
81    if an existing reference beyond HEAD is detected.
82
83    If the rep cache database has not been opened, this may be a no op. */
84 svn_error_t *
85 svn_fs_x__set_rep_reference(svn_fs_t *fs,
86                             svn_fs_x__representation_t *rep,
87                             apr_pool_t *scratch_pool);
88
89 /* Delete from the cache all reps corresponding to revisions younger
90    than YOUNGEST. */
91 svn_error_t *
92 svn_fs_x__del_rep_reference(svn_fs_t *fs,
93                             svn_revnum_t youngest,
94                             apr_pool_t *scratch_pool);
95
96
97 /* Start a transaction to take an SQLite reserved lock that prevents
98    other writes, call BODY, end the transaction, and return what BODY returned.
99  */
100 svn_error_t *
101 svn_fs_x__with_rep_cache_lock(svn_fs_t *fs,
102                               svn_error_t *(*body)(void *baton,
103                                                    apr_pool_t *pool),
104                               void *baton,
105                               apr_pool_t *pool);
106 #ifdef __cplusplus
107 }
108 #endif /* __cplusplus */
109
110 #endif /* SVN_LIBSVN_FS_X_REP_CACHE_H */