1 /* fs_x.h : interface to the native filesystem 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__FS_X_H
24 #define SVN_LIBSVN_FS__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 /* Upgrade the fsx filesystem FS. Indicate progress via the optional
45 * NOTIFY_FUNC callback using NOTIFY_BATON. The optional CANCEL_FUNC
46 * will periodically be called with CANCEL_BATON to allow for preemption.
47 * Use SCRATCH_POOL for temporary allocations. */
49 svn_fs_x__upgrade(svn_fs_t *fs,
50 svn_fs_upgrade_notify_t notify_func,
52 svn_cancel_func_t cancel_func,
54 apr_pool_t *scratch_pool);
56 /* Set *YOUNGEST to the youngest revision in filesystem FS. Do any
57 temporary allocation in SCRATCH_POOL. */
59 svn_fs_x__youngest_rev(svn_revnum_t *youngest,
61 apr_pool_t *scratch_pool);
63 /* Return SVN_ERR_FS_NO_SUCH_REVISION if the given revision REV is newer
64 than the current youngest revision in FS or is simply not a valid
65 revision number, else return success. Use SCRATCH_POOL for temporary
68 svn_fs_x__ensure_revision_exists(svn_revnum_t rev,
70 apr_pool_t *scratch_pool);
72 /* Set *LENGTH to the be fulltext length of the node revision
73 specified by NODEREV. */
75 svn_fs_x__file_length(svn_filesize_t *length,
76 svn_fs_x__noderev_t *noderev);
78 /* Return TRUE if the representations in A and B have equal contents, else
81 svn_fs_x__file_text_rep_equal(svn_fs_x__representation_t *a,
82 svn_fs_x__representation_t *b);
84 /* Set *EQUAL to TRUE if the property representations in A and B within FS
85 have equal contents, else set it to FALSE. If STRICT is not set, allow
87 Use SCRATCH_POOL for temporary allocations. */
89 svn_fs_x__prop_rep_equal(svn_boolean_t *equal,
91 svn_fs_x__noderev_t *a,
92 svn_fs_x__noderev_t *b,
94 apr_pool_t *scratch_pool);
97 /* Return a copy of the representation REP allocated from RESULT_POOL. */
98 svn_fs_x__representation_t *
99 svn_fs_x__rep_copy(svn_fs_x__representation_t *rep,
100 apr_pool_t *result_pool);
103 /* Return the recorded checksum of type KIND for the text representation
104 of NODREV into CHECKSUM, allocating from RESULT_POOL. If no stored
105 checksum is available, put all NULL into CHECKSUM. */
107 svn_fs_x__file_checksum(svn_checksum_t **checksum,
108 svn_fs_x__noderev_t *noderev,
109 svn_checksum_kind_t kind,
110 apr_pool_t *result_pool);
112 /* Under the repository db PATH, create a FSFS repository with FORMAT,
113 * the given SHARD_SIZE. If not supported by the respective format,
114 * the latter two parameters will be ignored. FS will be updated.
116 * The only file not being written is the 'format' file. This allows
117 * callers such as hotcopy to modify the contents before turning the
118 * tree into an accessible repository.
120 * Use SCRATCH_POOL for temporary allocations.
123 svn_fs_x__create_file_tree(svn_fs_t *fs,
127 apr_pool_t *scratch_pool);
129 /* Create a fs_x fileysystem referenced by FS at path PATH. Get any
130 temporary allocations from SCRATCH_POOL.
132 ### Some parts of *FS must have been initialized beforehand; some parts
133 (including FS->path) are initialized by this function. */
135 svn_fs_x__create(svn_fs_t *fs,
137 apr_pool_t *scratch_pool);
139 /* Set the uuid of repository FS to UUID and the instance ID to INSTANCE_ID.
140 If any of them is NULL, use a newly generated UUID / ID instead.
141 Perform temporary allocations in SCRATCH_POOL. */
143 svn_fs_x__set_uuid(svn_fs_t *fs,
145 const char *instance_id,
146 apr_pool_t *scratch_pool);
148 /* Read the format number and maximum number of files per directory
149 from PATH and return them in *PFORMAT and *MAX_FILES_PER_DIR
152 *MAX_FILES_PER_DIR is obtained from the 'layout' format option, and
153 will be set to zero if a linear scheme should be used.
155 Use SCRATCH_POOL for temporary allocation. */
157 svn_fs_x__write_format(svn_fs_t *fs,
158 svn_boolean_t overwrite,
159 apr_pool_t *scratch_pool);
161 /* Find the value of the property named PROPNAME in transaction REV.
162 Return the contents in *VALUE_P, allocated from RESULT_POOL.
163 Use SCRATCH_POOL for temporary allocations. */
165 svn_fs_x__revision_prop(svn_string_t **value_p,
168 const char *propname,
169 apr_pool_t *result_pool,
170 apr_pool_t *scratch_pool);
172 /* Change, add, or delete a property on a revision REV in filesystem
173 FS. NAME gives the name of the property, and value, if non-NULL,
174 gives the new contents of the property. If value is NULL, then the
175 property will be deleted. If OLD_VALUE_P is not NULL, do nothing unless
176 the preexisting value is *OLD_VALUE_P.
177 Do any temporary allocation in SCRATCH_POOL. */
179 svn_fs_x__change_rev_prop(svn_fs_t *fs,
182 const svn_string_t *const *old_value_p,
183 const svn_string_t *value,
184 apr_pool_t *scratch_pool);
186 /* If directory PATH does not exist, create it and give it the same
187 permissions as FS_PATH. Do any temporary allocation in SCRATCH_POOL. */
189 svn_fs_x__ensure_dir_exists(const char *path,
191 apr_pool_t *scratch_pool);
193 /* Initialize all session-local caches in FS according to the global
194 cache settings. Use SCRATCH_POOL for temporary allocations.
196 Please note that it is permissible for this function to set some
197 or all of these caches to NULL, regardless of any setting. */
199 svn_fs_x__initialize_caches(svn_fs_t *fs,
200 apr_pool_t *scratch_pool);