1 /* fs_x.h : interface to the FSX layer
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_FS_X_H
24 #define SVN_LIBSVN_FS_X_FS_X_H
28 /* Read the 'format' file of fsx filesystem FS and store its info in FS.
29 * Use SCRATCH_POOL for temporary allocations. */
31 svn_fs_x__read_format_file(svn_fs_t *fs,
32 apr_pool_t *scratch_pool);
34 /* Open the fsx filesystem pointed to by PATH and associate it with
35 filesystem object FS. Use SCRATCH_POOL for temporary allocations.
37 ### Some parts of *FS must have been initialized beforehand; some parts
38 (including FS->path) are initialized by this function. */
40 svn_fs_x__open(svn_fs_t *fs,
42 apr_pool_t *scratch_pool);
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. */
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);
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. */
59 svn_fs_x__upgrade(svn_fs_t *fs,
60 svn_fs_upgrade_notify_t notify_func,
62 svn_cancel_func_t cancel_func,
64 apr_pool_t *scratch_pool);
66 /* Set *YOUNGEST to the youngest revision in filesystem FS. Do any
67 temporary allocation in SCRATCH_POOL. */
69 svn_fs_x__youngest_rev(svn_revnum_t *youngest,
71 apr_pool_t *scratch_pool);
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
78 svn_fs_x__ensure_revision_exists(svn_revnum_t rev,
80 apr_pool_t *scratch_pool);
82 /* Set *LENGTH to the be fulltext length of the node revision
83 specified by NODEREV. */
85 svn_fs_x__file_length(svn_filesize_t *length,
86 svn_fs_x__noderev_t *noderev);
88 /* Return TRUE if the representations in A and B have equal contents, else
91 svn_fs_x__file_text_rep_equal(svn_fs_x__representation_t *a,
92 svn_fs_x__representation_t *b);
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
97 Use SCRATCH_POOL for temporary allocations. */
99 svn_fs_x__prop_rep_equal(svn_boolean_t *equal,
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);
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);
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. */
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);
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.
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.
130 * Use SCRATCH_POOL for temporary allocations.
133 svn_fs_x__create_file_tree(svn_fs_t *fs,
137 apr_pool_t *scratch_pool);
139 /* Create a fs_x fileysystem referenced by FS at path PATH. Get any
140 temporary allocations from SCRATCH_POOL.
142 ### Some parts of *FS must have been initialized beforehand; some parts
143 (including FS->path) are initialized by this function. */
145 svn_fs_x__create(svn_fs_t *fs,
147 apr_pool_t *scratch_pool);
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.
152 If OVERWRITE is not set, the uuid file must not exist yet implying this
153 is a fresh repository.
155 Perform temporary allocations in SCRATCH_POOL. */
157 svn_fs_x__set_uuid(svn_fs_t *fs,
159 const char *instance_id,
160 svn_boolean_t overwrite,
161 apr_pool_t *scratch_pool);
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
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.
170 Use SCRATCH_POOL for temporary allocation. */
172 svn_fs_x__write_format(svn_fs_t *fs,
173 svn_boolean_t overwrite,
174 apr_pool_t *scratch_pool);
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. */
182 svn_fs_x__revision_prop(svn_string_t **value_p,
185 const char *propname,
186 svn_boolean_t refresh,
187 apr_pool_t *result_pool,
188 apr_pool_t *scratch_pool);
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. */
197 svn_fs_x__change_rev_prop(svn_fs_t *fs,
200 const svn_string_t *const *old_value_p,
201 const svn_string_t *value,
202 apr_pool_t *scratch_pool);
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. */
207 svn_fs_x__ensure_dir_exists(const char *path,
209 apr_pool_t *scratch_pool);
211 /* Initialize all session-local caches in FS according to the global
212 cache settings. Use SCRATCH_POOL for temporary allocations.
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. */
217 svn_fs_x__initialize_caches(svn_fs_t *fs,
218 apr_pool_t *scratch_pool);