]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/libsvn_fs_x/fs_x.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.git] / contrib / subversion / subversion / libsvn_fs_x / fs_x.h
1 /* fs_x.h : interface to the native filesystem 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__FS_X_H
24 #define SVN_LIBSVN_FS__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 /* 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. */
48 svn_error_t *
49 svn_fs_x__upgrade(svn_fs_t *fs,
50                   svn_fs_upgrade_notify_t notify_func,
51                   void *notify_baton,
52                   svn_cancel_func_t cancel_func,
53                   void *cancel_baton,
54                   apr_pool_t *scratch_pool);
55
56 /* Set *YOUNGEST to the youngest revision in filesystem FS.  Do any
57    temporary allocation in SCRATCH_POOL. */
58 svn_error_t *
59 svn_fs_x__youngest_rev(svn_revnum_t *youngest,
60                        svn_fs_t *fs,
61                        apr_pool_t *scratch_pool);
62
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
66    allocations. */
67 svn_error_t *
68 svn_fs_x__ensure_revision_exists(svn_revnum_t rev,
69                                  svn_fs_t *fs,
70                                  apr_pool_t *scratch_pool);
71
72 /* Set *LENGTH to the be fulltext length of the node revision
73    specified by NODEREV. */
74 svn_error_t *
75 svn_fs_x__file_length(svn_filesize_t *length,
76                       svn_fs_x__noderev_t *noderev);
77
78 /* Return TRUE if the representations in A and B have equal contents, else
79    return FALSE. */
80 svn_boolean_t
81 svn_fs_x__file_text_rep_equal(svn_fs_x__representation_t *a,
82                               svn_fs_x__representation_t *b);
83
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
86    for false negatives.
87    Use SCRATCH_POOL for temporary allocations. */
88 svn_error_t *
89 svn_fs_x__prop_rep_equal(svn_boolean_t *equal,
90                          svn_fs_t *fs,
91                          svn_fs_x__noderev_t *a,
92                          svn_fs_x__noderev_t *b,
93                          svn_boolean_t strict,
94                          apr_pool_t *scratch_pool);
95
96
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);
101
102
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. */
106 svn_error_t *
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);
111
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.
115  *
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.
119  *
120  * Use SCRATCH_POOL for temporary allocations.
121  */
122 svn_error_t *
123 svn_fs_x__create_file_tree(svn_fs_t *fs,
124                            const char *path,
125                            int format,
126                            int shard_size,
127                            apr_pool_t *scratch_pool);
128
129 /* Create a fs_x fileysystem referenced by FS at path PATH.  Get any
130    temporary allocations from SCRATCH_POOL.
131
132    ### Some parts of *FS must have been initialized beforehand; some parts
133        (including FS->path) are initialized by this function. */
134 svn_error_t *
135 svn_fs_x__create(svn_fs_t *fs,
136                  const char *path,
137                  apr_pool_t *scratch_pool);
138
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. */
142 svn_error_t *
143 svn_fs_x__set_uuid(svn_fs_t *fs,
144                    const char *uuid,
145                    const char *instance_id,
146                    apr_pool_t *scratch_pool);
147
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
150    respectively.
151
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.
154
155    Use SCRATCH_POOL for temporary allocation. */
156 svn_error_t *
157 svn_fs_x__write_format(svn_fs_t *fs,
158                        svn_boolean_t overwrite,
159                        apr_pool_t *scratch_pool);
160
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. */
164 svn_error_t *
165 svn_fs_x__revision_prop(svn_string_t **value_p,
166                         svn_fs_t *fs,
167                         svn_revnum_t rev,
168                         const char *propname,
169                         apr_pool_t *result_pool,
170                         apr_pool_t *scratch_pool);
171
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.  */
178 svn_error_t *
179 svn_fs_x__change_rev_prop(svn_fs_t *fs,
180                           svn_revnum_t rev,
181                           const char *name,
182                           const svn_string_t *const *old_value_p,
183                           const svn_string_t *value,
184                           apr_pool_t *scratch_pool);
185
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. */
188 svn_error_t *
189 svn_fs_x__ensure_dir_exists(const char *path,
190                             const char *fs_path,
191                             apr_pool_t *scratch_pool);
192
193 /* Initialize all session-local caches in FS according to the global
194    cache settings. Use SCRATCH_POOL for temporary allocations.
195
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. */
198 svn_error_t *
199 svn_fs_x__initialize_caches(svn_fs_t *fs,
200                             apr_pool_t *scratch_pool);
201
202 #endif