revprops.h revision 302408
1/* revprops.h --- everything needed to handle revprops in FSX 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__REVPROPS_H 24#define SVN_LIBSVN_FS__REVPROPS_H 25 26#include "svn_fs.h" 27 28#ifdef __cplusplus 29extern "C" { 30#endif /* __cplusplus */ 31 32/* Auto-create / replace the revprop generation file in FS with its 33 * initial contents. In any case, FS will not hold an open handle to 34 * it after this function succeeds. 35 * 36 * Use SCRATCH_POOL for temporary allocations. 37 */ 38svn_error_t * 39svn_fs_x__reset_revprop_generation_file(svn_fs_t *fs, 40 apr_pool_t *scratch_pool); 41 42/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev. 43 * 44 * NOTE: Keep the old non-packed shards around until after the format bump. 45 * Otherwise, re-running upgrade will drop the packed revprop shard but 46 * have no unpacked data anymore. Call upgrade_cleanup_pack_revprops after 47 * the bump. 48 * 49 * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are 50 * used in the usual way. Temporary allocations are done in SCRATCH_POOL. 51 */ 52svn_error_t * 53svn_fs_x__upgrade_pack_revprops(svn_fs_t *fs, 54 svn_fs_upgrade_notify_t notify_func, 55 void *notify_baton, 56 svn_cancel_func_t cancel_func, 57 void *cancel_baton, 58 apr_pool_t *scratch_pool); 59 60/* In the filesystem FS, remove all non-packed revprop shards up to 61 * min_unpacked_rev. Temporary allocations are done in SCRATCH_POOL. 62 * 63 * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are 64 * used in the usual way. Cancellation is supported in the sense that we 65 * will cleanly abort the operation. However, there will be remnant shards 66 * that must be removed manually. 67 * 68 * See upgrade_pack_revprops for more info. 69 */ 70svn_error_t * 71svn_fs_x__upgrade_cleanup_pack_revprops(svn_fs_t *fs, 72 svn_fs_upgrade_notify_t notify_func, 73 void *notify_baton, 74 svn_cancel_func_t cancel_func, 75 void *cancel_baton, 76 apr_pool_t *scratch_pool); 77 78/* Read the revprops for revision REV in FS and return them in *PROPLIST_P. 79 * If BYPASS_CACHE is set, don't consult the disks but always read from disk. 80 * 81 * Allocate the *PROPLIST_P in RESULT_POOL and use SCRATCH_POOL for temporary 82 * allocations. 83 */ 84svn_error_t * 85svn_fs_x__get_revision_proplist(apr_hash_t **proplist_p, 86 svn_fs_t *fs, 87 svn_revnum_t rev, 88 svn_boolean_t bypass_cache, 89 apr_pool_t *result_pool, 90 apr_pool_t *scratch_pool); 91 92/* Set the revision property list of revision REV in filesystem FS to 93 PROPLIST. Use SCRATCH_POOL for temporary allocations. */ 94svn_error_t * 95svn_fs_x__set_revision_proplist(svn_fs_t *fs, 96 svn_revnum_t rev, 97 apr_hash_t *proplist, 98 apr_pool_t *scratch_pool); 99 100 101/* Return TRUE, if for REVISION in FS, we can find the revprop pack file. 102 * Use SCRATCH_POOL for temporary allocations. 103 * Set *MISSING, if the reason is a missing manifest or pack file. 104 */ 105svn_boolean_t 106svn_fs_x__packed_revprop_available(svn_boolean_t *missing, 107 svn_fs_t *fs, 108 svn_revnum_t revision, 109 apr_pool_t *scratch_pool); 110 111 112/****** Packing FSX shards *********/ 113 114/* Copy revprop files for revisions [START_REV, END_REV) from SHARD_PATH 115 * to the pack file at PACK_FILE_NAME in PACK_FILE_DIR. 116 * 117 * The file sizes have already been determined and written to SIZES. 118 * Please note that this function will be executed while the filesystem 119 * has been locked and that revprops files will therefore not be modified 120 * while the pack is in progress. 121 * 122 * COMPRESSION_LEVEL defines how well the resulting pack file shall be 123 * compressed or whether is shall be compressed at all. TOTAL_SIZE is 124 * a hint on which initial buffer size we should use to hold the pack file 125 * content. 126 * 127 * CANCEL_FUNC and CANCEL_BATON are used as usual. Temporary allocations 128 * are done in SCRATCH_POOL. 129 */ 130svn_error_t * 131svn_fs_x__copy_revprops(const char *pack_file_dir, 132 const char *pack_filename, 133 const char *shard_path, 134 svn_revnum_t start_rev, 135 svn_revnum_t end_rev, 136 apr_array_header_t *sizes, 137 apr_size_t total_size, 138 int compression_level, 139 svn_cancel_func_t cancel_func, 140 void *cancel_baton, 141 apr_pool_t *scratch_pool); 142 143/* For the revprop SHARD at SHARD_PATH with exactly MAX_FILES_PER_DIR 144 * revprop files in it, create a packed shared at PACK_FILE_DIR. 145 * 146 * COMPRESSION_LEVEL defines how well the resulting pack file shall be 147 * compressed or whether is shall be compressed at all. Individual pack 148 * file containing more than one revision will be limited to a size of 149 * MAX_PACK_SIZE bytes before compression. 150 * 151 * CANCEL_FUNC and CANCEL_BATON are used in the usual way. Temporary 152 * allocations are done in SCRATCH_POOL. 153 */ 154svn_error_t * 155svn_fs_x__pack_revprops_shard(const char *pack_file_dir, 156 const char *shard_path, 157 apr_int64_t shard, 158 int max_files_per_dir, 159 apr_off_t max_pack_size, 160 int compression_level, 161 svn_cancel_func_t cancel_func, 162 void *cancel_baton, 163 apr_pool_t *scratch_pool); 164 165/* Delete the non-packed revprop SHARD at SHARD_PATH with exactly 166 * MAX_FILES_PER_DIR revprop files in it. If this is shard 0, keep the 167 * revprop file for revision 0. 168 * 169 * CANCEL_FUNC and CANCEL_BATON are used in the usual way. Temporary 170 * allocations are done in SCRATCH_POOL. 171 */ 172svn_error_t * 173svn_fs_x__delete_revprops_shard(const char *shard_path, 174 apr_int64_t shard, 175 int max_files_per_dir, 176 svn_cancel_func_t cancel_func, 177 void *cancel_baton, 178 apr_pool_t *scratch_pool); 179 180#ifdef __cplusplus 181} 182#endif /* __cplusplus */ 183 184#endif /* SVN_LIBSVN_FS__REVPROPS_H */ 185