1 /* fs_x.h : interface to the FSX layer 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_X_FS_X_H 24 #define SVN_LIBSVN_FS_X_FS_X_H 25 26 #include "fs.h" 27 28 /* Read the 'format' file of fsx filesystem FS and store its info in FS. 29 * Use SCRATCH_POOL for temporary allocations. */ 30 svn_error_t * 31 svn_fs_x__read_format_file(svn_fs_t *fs, 32 apr_pool_t *scratch_pool); 33 34 /* Open the fsx filesystem pointed to by PATH and associate it with 35 filesystem object FS. Use SCRATCH_POOL for temporary allocations. 36 37 ### Some parts of *FS must have been initialized beforehand; some parts 38 (including FS->path) are initialized by this function. */ 39 svn_error_t * 40 svn_fs_x__open(svn_fs_t *fs, 41 const char *path, 42 apr_pool_t *scratch_pool); 43 44 /* Initialize parts of the FS data that are being shared across multiple 45 filesystem objects. Use COMMON_POOL for process-wide and SCRATCH_POOL 46 for temporary allocations. Use COMMON_POOL_LOCK to ensure that the 47 initialization is serialized. */ 48 svn_error_t * 49 svn_fs_x__initialize_shared_data(svn_fs_t *fs, 50 svn_mutex__t *common_pool_lock, 51 apr_pool_t *scratch_pool, 52 apr_pool_t *common_pool); 53 54 /* Upgrade the fsx filesystem FS. Indicate progress via the optional 55 * NOTIFY_FUNC callback using NOTIFY_BATON. The optional CANCEL_FUNC 56 * will periodically be called with CANCEL_BATON to allow for preemption. 57 * Use SCRATCH_POOL for temporary allocations. */ 58 svn_error_t * 59 svn_fs_x__upgrade(svn_fs_t *fs, 60 svn_fs_upgrade_notify_t notify_func, 61 void *notify_baton, 62 svn_cancel_func_t cancel_func, 63 void *cancel_baton, 64 apr_pool_t *scratch_pool); 65 66 /* Set *YOUNGEST to the youngest revision in filesystem FS. Do any 67 temporary allocation in SCRATCH_POOL. */ 68 svn_error_t * 69 svn_fs_x__youngest_rev(svn_revnum_t *youngest, 70 svn_fs_t *fs, 71 apr_pool_t *scratch_pool); 72 73 /* Return SVN_ERR_FS_NO_SUCH_REVISION if the given revision REV is newer 74 than the current youngest revision in FS or is simply not a valid 75 revision number, else return success. Use SCRATCH_POOL for temporary 76 allocations. */ 77 svn_error_t * 78 svn_fs_x__ensure_revision_exists(svn_revnum_t rev, 79 svn_fs_t *fs, 80 apr_pool_t *scratch_pool); 81 82 /* Set *LENGTH to the be fulltext length of the node revision 83 specified by NODEREV. */ 84 svn_error_t * 85 svn_fs_x__file_length(svn_filesize_t *length, 86 svn_fs_x__noderev_t *noderev); 87 88 /* Return TRUE if the representations in A and B have equal contents, else 89 return FALSE. */ 90 svn_boolean_t 91 svn_fs_x__file_text_rep_equal(svn_fs_x__representation_t *a, 92 svn_fs_x__representation_t *b); 93 94 /* Set *EQUAL to TRUE if the property representations in A and B within FS 95 have equal contents, else set it to FALSE. If STRICT is not set, allow 96 for false negatives. 97 Use SCRATCH_POOL for temporary allocations. */ 98 svn_error_t * 99 svn_fs_x__prop_rep_equal(svn_boolean_t *equal, 100 svn_fs_t *fs, 101 svn_fs_x__noderev_t *a, 102 svn_fs_x__noderev_t *b, 103 svn_boolean_t strict, 104 apr_pool_t *scratch_pool); 105 106 107 /* Return a copy of the representation REP allocated from RESULT_POOL. */ 108 svn_fs_x__representation_t * 109 svn_fs_x__rep_copy(svn_fs_x__representation_t *rep, 110 apr_pool_t *result_pool); 111 112 113 /* Return the recorded checksum of type KIND for the text representation 114 of NODREV into CHECKSUM, allocating from RESULT_POOL. If no stored 115 checksum is available, put all NULL into CHECKSUM. */ 116 svn_error_t * 117 svn_fs_x__file_checksum(svn_checksum_t **checksum, 118 svn_fs_x__noderev_t *noderev, 119 svn_checksum_kind_t kind, 120 apr_pool_t *result_pool); 121 122 /* Under the repository db PATH, create a FSFS repository with FORMAT, 123 * the given SHARD_SIZE. If not supported by the respective format, 124 * the latter two parameters will be ignored. FS will be updated. 125 * 126 * The only file not being written is the 'format' file. This allows 127 * callers such as hotcopy to modify the contents before turning the 128 * tree into an accessible repository. 129 * 130 * Use SCRATCH_POOL for temporary allocations. 131 */ 132 svn_error_t * 133 svn_fs_x__create_file_tree(svn_fs_t *fs, 134 const char *path, 135 int format, 136 int shard_size, 137 apr_pool_t *scratch_pool); 138 139 /* Create a fs_x fileysystem referenced by FS at path PATH. Get any 140 temporary allocations from SCRATCH_POOL. 141 142 ### Some parts of *FS must have been initialized beforehand; some parts 143 (including FS->path) are initialized by this function. */ 144 svn_error_t * 145 svn_fs_x__create(svn_fs_t *fs, 146 const char *path, 147 apr_pool_t *scratch_pool); 148 149 /* Set the uuid of repository FS to UUID and the instance ID to INSTANCE_ID. 150 If any of them is NULL, use a newly generated UUID / ID instead. 151 152 If OVERWRITE is not set, the uuid file must not exist yet implying this 153 is a fresh repository. 154 155 Perform temporary allocations in SCRATCH_POOL. */ 156 svn_error_t * 157 svn_fs_x__set_uuid(svn_fs_t *fs, 158 const char *uuid, 159 const char *instance_id, 160 svn_boolean_t overwrite, 161 apr_pool_t *scratch_pool); 162 163 /* Read the format number and maximum number of files per directory 164 from PATH and return them in *PFORMAT and *MAX_FILES_PER_DIR 165 respectively. 166 167 *MAX_FILES_PER_DIR is obtained from the 'layout' format option, and 168 will be set to zero if a linear scheme should be used. 169 170 Use SCRATCH_POOL for temporary allocation. */ 171 svn_error_t * 172 svn_fs_x__write_format(svn_fs_t *fs, 173 svn_boolean_t overwrite, 174 apr_pool_t *scratch_pool); 175 176 /* Find the value of the property named PROPNAME in transaction REV. 177 Return the contents in *VALUE_P, allocated from RESULT_POOL. 178 If REFRESH is not set, continue using the potentially outdated 179 revprop generation value in FS->FSAP_DATA. 180 Use SCRATCH_POOL for temporary allocations. */ 181 svn_error_t * 182 svn_fs_x__revision_prop(svn_string_t **value_p, 183 svn_fs_t *fs, 184 svn_revnum_t rev, 185 const char *propname, 186 svn_boolean_t refresh, 187 apr_pool_t *result_pool, 188 apr_pool_t *scratch_pool); 189 190 /* Change, add, or delete a property on a revision REV in filesystem 191 FS. NAME gives the name of the property, and value, if non-NULL, 192 gives the new contents of the property. If value is NULL, then the 193 property will be deleted. If OLD_VALUE_P is not NULL, do nothing unless 194 the preexisting value is *OLD_VALUE_P. 195 Do any temporary allocation in SCRATCH_POOL. */ 196 svn_error_t * 197 svn_fs_x__change_rev_prop(svn_fs_t *fs, 198 svn_revnum_t rev, 199 const char *name, 200 const svn_string_t *const *old_value_p, 201 const svn_string_t *value, 202 apr_pool_t *scratch_pool); 203 204 /* If directory PATH does not exist, create it and give it the same 205 permissions as FS_PATH. Do any temporary allocation in SCRATCH_POOL. */ 206 svn_error_t * 207 svn_fs_x__ensure_dir_exists(const char *path, 208 const char *fs_path, 209 apr_pool_t *scratch_pool); 210 211 /* Initialize all session-local caches in FS according to the global 212 cache settings. Use SCRATCH_POOL for temporary allocations. 213 214 Please note that it is permissible for this function to set some 215 or all of these caches to NULL, regardless of any setting. */ 216 svn_error_t * 217 svn_fs_x__initialize_caches(svn_fs_t *fs, 218 apr_pool_t *scratch_pool); 219 220 #endif 221