1 /* rep-cache.h : interface to rep cache db functions
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
20 * ====================================================================
23 #ifndef SVN_LIBSVN_FS_X_REP_CACHE_H
24 #define SVN_LIBSVN_FS_X_REP_CACHE_H
26 #include "svn_error.h"
32 #endif /* __cplusplus */
35 #define REP_CACHE_DB_NAME "rep-cache.db"
37 /* Open and create, if needed, the rep cache database associated with FS.
38 Use SCRATCH_POOL for temporary allocations. */
40 svn_fs_x__open_rep_cache(svn_fs_t *fs,
41 apr_pool_t *scratch_pool);
43 /* Set *EXISTS to TRUE iff the rep-cache DB file exists. */
45 svn_fs_x__exists_rep_cache(svn_boolean_t *exists,
47 apr_pool_t *scratch_pool);
49 /* Iterate all representations currently in FS's cache. */
51 svn_fs_x__walk_rep_reference(svn_fs_t *fs,
54 svn_error_t *(*walker)(svn_fs_x__representation_t *rep,
57 apr_pool_t *scratch_pool),
59 svn_cancel_func_t cancel_func,
61 apr_pool_t *scratch_pool);
63 /* Return the representation REP in FS which has fulltext CHECKSUM.
64 REP is allocated in RESULT_POOL. If the rep cache database has not been
65 opened, just set *REP to NULL. Returns SVN_ERR_FS_CORRUPT if a reference
66 beyond HEAD is detected. Uses SCRATCH_POOL for temporary allocations. */
68 svn_fs_x__get_rep_reference(svn_fs_x__representation_t **rep,
70 svn_checksum_t *checksum,
71 apr_pool_t *result_pool,
72 apr_pool_t *scratch_pool);
74 /* Set the representation REP in FS, using REP->CHECKSUM.
75 Use SCRATCH_POOL for temporary allocations. Returns SVN_ERR_FS_CORRUPT
76 if an existing reference beyond HEAD is detected.
78 If the rep cache database has not been opened, this may be a no op. */
80 svn_fs_x__set_rep_reference(svn_fs_t *fs,
81 svn_fs_x__representation_t *rep,
82 apr_pool_t *scratch_pool);
84 /* Delete from the cache all reps corresponding to revisions younger
87 svn_fs_x__del_rep_reference(svn_fs_t *fs,
88 svn_revnum_t youngest,
89 apr_pool_t *scratch_pool);
92 /* Start a transaction to take an SQLite reserved lock that prevents
93 other writes, call BODY, end the transaction, and return what BODY returned.
96 svn_fs_x__with_rep_cache_lock(svn_fs_t *fs,
97 svn_error_t *(*body)(void *baton,
103 #endif /* __cplusplus */
105 #endif /* SVN_LIBSVN_FS_X_REP_CACHE_H */