1289177Speter/* rep-cache.h : interface to rep cache db functions 2289177Speter * 3289177Speter * ==================================================================== 4289177Speter * Licensed to the Apache Software Foundation (ASF) under one 5289177Speter * or more contributor license agreements. See the NOTICE file 6289177Speter * distributed with this work for additional information 7289177Speter * regarding copyright ownership. The ASF licenses this file 8289177Speter * to you under the Apache License, Version 2.0 (the 9289177Speter * "License"); you may not use this file except in compliance 10289177Speter * with the License. You may obtain a copy of the License at 11289177Speter * 12289177Speter * http://www.apache.org/licenses/LICENSE-2.0 13289177Speter * 14289177Speter * Unless required by applicable law or agreed to in writing, 15289177Speter * software distributed under the License is distributed on an 16289177Speter * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17289177Speter * KIND, either express or implied. See the License for the 18289177Speter * specific language governing permissions and limitations 19289177Speter * under the License. 20289177Speter * ==================================================================== 21289177Speter */ 22289177Speter 23289177Speter#ifndef SVN_LIBSVN_FS_X_REP_CACHE_H 24289177Speter#define SVN_LIBSVN_FS_X_REP_CACHE_H 25289177Speter 26289177Speter#include "svn_error.h" 27289177Speter 28289177Speter#include "fs.h" 29289177Speter 30289177Speter#ifdef __cplusplus 31289177Speterextern "C" { 32289177Speter#endif /* __cplusplus */ 33289177Speter 34289177Speter 35289177Speter#define REP_CACHE_DB_NAME "rep-cache.db" 36289177Speter 37289177Speter/* Open and create, if needed, the rep cache database associated with FS. 38289177Speter Use SCRATCH_POOL for temporary allocations. */ 39289177Spetersvn_error_t * 40289177Spetersvn_fs_x__open_rep_cache(svn_fs_t *fs, 41289177Speter apr_pool_t *scratch_pool); 42289177Speter 43362181Sdim/* Close the rep cache database associated with FS. */ 44362181Sdimsvn_error_t * 45362181Sdimsvn_fs_x__close_rep_cache(svn_fs_t *fs); 46362181Sdim 47289177Speter/* Set *EXISTS to TRUE iff the rep-cache DB file exists. */ 48289177Spetersvn_error_t * 49289177Spetersvn_fs_x__exists_rep_cache(svn_boolean_t *exists, 50289177Speter svn_fs_t *fs, 51289177Speter apr_pool_t *scratch_pool); 52289177Speter 53289177Speter/* Iterate all representations currently in FS's cache. */ 54289177Spetersvn_error_t * 55289177Spetersvn_fs_x__walk_rep_reference(svn_fs_t *fs, 56289177Speter svn_revnum_t start, 57289177Speter svn_revnum_t end, 58289177Speter svn_error_t *(*walker)(svn_fs_x__representation_t *rep, 59289177Speter void *walker_baton, 60289177Speter svn_fs_t *fs, 61289177Speter apr_pool_t *scratch_pool), 62289177Speter void *walker_baton, 63289177Speter svn_cancel_func_t cancel_func, 64289177Speter void *cancel_baton, 65289177Speter apr_pool_t *scratch_pool); 66289177Speter 67289177Speter/* Return the representation REP in FS which has fulltext CHECKSUM. 68362181Sdim *REP_P is allocated in RESULT_POOL. If the rep cache database has not 69362181Sdim been opened, just set *REP_P to NULL. Returns SVN_ERR_FS_CORRUPT if 70362181Sdim a reference beyond HEAD is detected. Uses SCRATCH_POOL for temporary 71362181Sdim allocations.*/ 72289177Spetersvn_error_t * 73362181Sdimsvn_fs_x__get_rep_reference(svn_fs_x__representation_t **rep_p, 74289177Speter svn_fs_t *fs, 75289177Speter svn_checksum_t *checksum, 76289177Speter apr_pool_t *result_pool, 77289177Speter apr_pool_t *scratch_pool); 78289177Speter 79289177Speter/* Set the representation REP in FS, using REP->CHECKSUM. 80289177Speter Use SCRATCH_POOL for temporary allocations. Returns SVN_ERR_FS_CORRUPT 81289177Speter if an existing reference beyond HEAD is detected. 82289177Speter 83289177Speter If the rep cache database has not been opened, this may be a no op. */ 84289177Spetersvn_error_t * 85289177Spetersvn_fs_x__set_rep_reference(svn_fs_t *fs, 86289177Speter svn_fs_x__representation_t *rep, 87289177Speter apr_pool_t *scratch_pool); 88289177Speter 89289177Speter/* Delete from the cache all reps corresponding to revisions younger 90289177Speter than YOUNGEST. */ 91289177Spetersvn_error_t * 92289177Spetersvn_fs_x__del_rep_reference(svn_fs_t *fs, 93289177Speter svn_revnum_t youngest, 94289177Speter apr_pool_t *scratch_pool); 95289177Speter 96289177Speter 97289177Speter/* Start a transaction to take an SQLite reserved lock that prevents 98289177Speter other writes, call BODY, end the transaction, and return what BODY returned. 99289177Speter */ 100289177Spetersvn_error_t * 101289177Spetersvn_fs_x__with_rep_cache_lock(svn_fs_t *fs, 102289177Speter svn_error_t *(*body)(void *baton, 103289177Speter apr_pool_t *pool), 104289177Speter void *baton, 105289177Speter apr_pool_t *pool); 106289177Speter#ifdef __cplusplus 107289177Speter} 108289177Speter#endif /* __cplusplus */ 109289177Speter 110289177Speter#endif /* SVN_LIBSVN_FS_X_REP_CACHE_H */ 111