revprops.h revision 289177
1289177Speter/* revprops.h --- everything needed to handle revprops in FSFS 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#include "svn_fs.h" 24289177Speter 25289177Speter/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev. 26289177Speter * 27289177Speter * NOTE: Keep the old non-packed shards around until after the format bump. 28289177Speter * Otherwise, re-running upgrade will drop the packed revprop shard but 29289177Speter * have no unpacked data anymore. Call upgrade_cleanup_pack_revprops after 30289177Speter * the bump. 31289177Speter * 32289177Speter * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are 33289177Speter * used in the usual way. Temporary allocations are done in SCRATCH_POOL. 34289177Speter */ 35289177Spetersvn_error_t * 36289177Spetersvn_fs_fs__upgrade_pack_revprops(svn_fs_t *fs, 37289177Speter svn_fs_upgrade_notify_t notify_func, 38289177Speter void *notify_baton, 39289177Speter svn_cancel_func_t cancel_func, 40289177Speter void *cancel_baton, 41289177Speter apr_pool_t *scratch_pool); 42289177Speter 43289177Speter/* In the filesystem FS, remove all non-packed revprop shards up to 44289177Speter * min_unpacked_rev. Temporary allocations are done in SCRATCH_POOL. 45289177Speter * 46289177Speter * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are 47289177Speter * used in the usual way. Cancellation is supported in the sense that we 48289177Speter * will cleanly abort the operation. However, there will be remnant shards 49289177Speter * that must be removed manually. 50289177Speter * 51289177Speter * See upgrade_pack_revprops for more info. 52289177Speter */ 53289177Spetersvn_error_t * 54289177Spetersvn_fs_fs__upgrade_cleanup_pack_revprops(svn_fs_t *fs, 55289177Speter svn_fs_upgrade_notify_t notify_func, 56289177Speter void *notify_baton, 57289177Speter svn_cancel_func_t cancel_func, 58289177Speter void *cancel_baton, 59289177Speter apr_pool_t *scratch_pool); 60289177Speter 61289177Speter/* Read the revprops for revision REV in FS and return them in *PROPERTIES_P. 62289177Speter * 63289177Speter * Allocations will be done in POOL. 64289177Speter */ 65289177Spetersvn_error_t * 66289177Spetersvn_fs_fs__get_revision_proplist(apr_hash_t **proplist_p, 67289177Speter svn_fs_t *fs, 68289177Speter svn_revnum_t rev, 69289177Speter apr_pool_t *pool); 70289177Speter 71289177Speter/* Set the revision property list of revision REV in filesystem FS to 72289177Speter PROPLIST. Use POOL for temporary allocations. */ 73289177Spetersvn_error_t * 74289177Spetersvn_fs_fs__set_revision_proplist(svn_fs_t *fs, 75289177Speter svn_revnum_t rev, 76289177Speter apr_hash_t *proplist, 77289177Speter apr_pool_t *pool); 78289177Speter 79289177Speter 80289177Speter/* Return TRUE, if for REVISION in FS, we can find the revprop pack file. 81289177Speter * Use POOL for temporary allocations. 82289177Speter * Set *MISSING, if the reason is a missing manifest or pack file. 83289177Speter */ 84289177Spetersvn_boolean_t 85289177Spetersvn_fs_fs__packed_revprop_available(svn_boolean_t *missing, 86289177Speter svn_fs_t *fs, 87289177Speter svn_revnum_t revision, 88289177Speter apr_pool_t *pool); 89289177Speter 90289177Speter 91289177Speter/****** Packing FSFS shards *********/ 92289177Speter 93289177Speter/* Copy revprop files for revisions [START_REV, END_REV) from SHARD_PATH 94289177Speter * to the pack file at PACK_FILE_NAME in PACK_FILE_DIR. 95289177Speter * 96289177Speter * The file sizes have already been determined and written to SIZES. 97289177Speter * Please note that this function will be executed while the filesystem 98289177Speter * has been locked and that revprops files will therefore not be modified 99289177Speter * while the pack is in progress. 100289177Speter * 101289177Speter * COMPRESSION_LEVEL defines how well the resulting pack file shall be 102289177Speter * compressed or whether is shall be compressed at all. TOTAL_SIZE is 103289177Speter * a hint on which initial buffer size we should use to hold the pack file 104289177Speter * content. 105289177Speter * 106289177Speter * CANCEL_FUNC and CANCEL_BATON are used as usual. Temporary allocations 107289177Speter * are done in SCRATCH_POOL. 108289177Speter */ 109289177Spetersvn_error_t * 110289177Spetersvn_fs_fs__copy_revprops(const char *pack_file_dir, 111289177Speter const char *pack_filename, 112289177Speter const char *shard_path, 113289177Speter svn_revnum_t start_rev, 114289177Speter svn_revnum_t end_rev, 115289177Speter apr_array_header_t *sizes, 116289177Speter apr_size_t total_size, 117289177Speter int compression_level, 118289177Speter svn_cancel_func_t cancel_func, 119289177Speter void *cancel_baton, 120289177Speter apr_pool_t *scratch_pool); 121289177Speter 122289177Speter/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev. 123289177Speter * 124289177Speter * NOTE: Keep the old non-packed shards around until after the format bump. 125289177Speter * Otherwise, re-running upgrade will drop the packed revprop shard but 126289177Speter * have no unpacked data anymore. Call upgrade_cleanup_pack_revprops after 127289177Speter * the bump. 128289177Speter * 129289177Speter * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are 130289177Speter * used in the usual way. Temporary allocations are done in SCRATCH_POOL. 131289177Speter */ 132289177Spetersvn_error_t * 133289177Spetersvn_fs_fs__pack_revprops_shard(const char *pack_file_dir, 134289177Speter const char *shard_path, 135289177Speter apr_int64_t shard, 136289177Speter int max_files_per_dir, 137289177Speter apr_off_t max_pack_size, 138289177Speter int compression_level, 139289177Speter svn_cancel_func_t cancel_func, 140289177Speter void *cancel_baton, 141289177Speter apr_pool_t *scratch_pool); 142289177Speter 143289177Speter/* In the filesystem FS, remove all non-packed revprop shards up to 144289177Speter * min_unpacked_rev. Temporary allocations are done in SCRATCH_POOL. 145289177Speter * 146289177Speter * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are 147289177Speter * used in the usual way. Cancellation is supported in the sense that we 148289177Speter * will cleanly abort the operation. However, there will be remnant shards 149289177Speter * that must be removed manually. 150289177Speter * 151289177Speter * See upgrade_pack_revprops for more info. 152289177Speter */ 153289177Spetersvn_error_t * 154289177Spetersvn_fs_fs__delete_revprops_shard(const char *shard_path, 155289177Speter apr_int64_t shard, 156289177Speter int max_files_per_dir, 157289177Speter svn_cancel_func_t cancel_func, 158289177Speter void *cancel_baton, 159289177Speter apr_pool_t *scratch_pool); 160