]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/libsvn_fs_fs/rep-cache.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / libsvn_fs_fs / 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_FS_REP_CACHE_H
24 #define SVN_LIBSVN_FS_FS_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 POOL for temporary allocations. */
39 svn_error_t *
40 svn_fs_fs__open_rep_cache(svn_fs_t *fs,
41                           apr_pool_t *pool);
42
43 /* Set *EXISTS to TRUE iff the rep-cache DB file exists. */
44 svn_error_t *
45 svn_fs_fs__exists_rep_cache(svn_boolean_t *exists,
46                             svn_fs_t *fs, apr_pool_t *pool);
47
48 /* Iterate all representations currently in FS's cache. */
49 svn_error_t *
50 svn_fs_fs__walk_rep_reference(svn_fs_t *fs,
51                               svn_revnum_t start,
52                               svn_revnum_t end,
53                               svn_error_t *(*walker)(representation_t *rep,
54                                                      void *walker_baton,
55                                                      svn_fs_t *fs,
56                                                      apr_pool_t *scratch_pool),
57                               void *walker_baton,
58                               svn_cancel_func_t cancel_func,
59                               void *cancel_baton,
60                               apr_pool_t *pool);
61
62 /* Return the representation REP in FS which has fulltext CHECKSUM.
63    REP is allocated in POOL.  If the rep cache database has not been
64    opened, just set *REP to NULL. */
65 svn_error_t *
66 svn_fs_fs__get_rep_reference(representation_t **rep,
67                              svn_fs_t *fs,
68                              svn_checksum_t *checksum,
69                              apr_pool_t *pool);
70
71 /* Set the representation REP in FS, using REP->CHECKSUM.
72    Use POOL for temporary allocations.
73
74    If the rep cache database has not been opened, this may be a no op.
75
76    If REJECT_DUP is TRUE, return an error if there is an existing
77    match for REP->CHECKSUM. */
78 svn_error_t *
79 svn_fs_fs__set_rep_reference(svn_fs_t *fs,
80                              representation_t *rep,
81                              svn_boolean_t reject_dup,
82                              apr_pool_t *pool);
83
84 /* Delete from the cache all reps corresponding to revisions younger
85    than YOUNGEST. */
86 svn_error_t *
87 svn_fs_fs__del_rep_reference(svn_fs_t *fs,
88                              svn_revnum_t youngest,
89                              apr_pool_t *pool);
90
91 /* Start a transaction to take an SQLite reserved lock that prevents
92    other writes. */
93 svn_error_t *
94 svn_fs_fs__lock_rep_cache(svn_fs_t *fs,
95                           apr_pool_t *pool);
96
97 #ifdef __cplusplus
98 }
99 #endif /* __cplusplus */
100
101 #endif /* SVN_LIBSVN_FS_FS_REP_CACHE_H */