]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/subversion/subversion/libsvn_fs_fs/revprops.h
Import lib9p 7ddb1164407da19b9b1afb83df83ae65a71a9a66.
[FreeBSD/FreeBSD.git] / contrib / subversion / subversion / libsvn_fs_fs / revprops.h
1 /* revprops.h --- everything needed to handle revprops in FSFS
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 #include "svn_fs.h"
24
25 /* In the filesystem FS, pack all revprop shards up to min_unpacked_rev.
26  *
27  * NOTE: Keep the old non-packed shards around until after the format bump.
28  * Otherwise, re-running upgrade will drop the packed revprop shard but
29  * have no unpacked data anymore.  Call upgrade_cleanup_pack_revprops after
30  * the bump.
31  *
32  * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are
33  * used in the usual way.  Temporary allocations are done in SCRATCH_POOL.
34  */
35 svn_error_t *
36 svn_fs_fs__upgrade_pack_revprops(svn_fs_t *fs,
37                                  svn_fs_upgrade_notify_t notify_func,
38                                  void *notify_baton,
39                                  svn_cancel_func_t cancel_func,
40                                  void *cancel_baton,
41                                  apr_pool_t *scratch_pool);
42
43 /* In the filesystem FS, remove all non-packed revprop shards up to
44  * min_unpacked_rev.  Temporary allocations are done in SCRATCH_POOL.
45  *
46  * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are
47  * used in the usual way.  Cancellation is supported in the sense that we
48  * will cleanly abort the operation.  However, there will be remnant shards
49  * that must be removed manually.
50  *
51  * See upgrade_pack_revprops for more info.
52  */
53 svn_error_t *
54 svn_fs_fs__upgrade_cleanup_pack_revprops(svn_fs_t *fs,
55                                          svn_fs_upgrade_notify_t notify_func,
56                                          void *notify_baton,
57                                          svn_cancel_func_t cancel_func,
58                                          void *cancel_baton,
59                                          apr_pool_t *scratch_pool);
60
61 /* Invalidate the revprop cache in FS. */
62 void
63 svn_fs_fs__reset_revprop_cache(svn_fs_t *fs);
64
65 /* Read the revprops for revision REV in FS and return them in *PROPERTIES_P.
66  * If REFRESH is set, clear the revprop cache before accessing the data.
67  *
68  * The result will be allocated in RESULT_POOL; SCRATCH_POOL is used for
69  * temporaries.
70  */
71 svn_error_t *
72 svn_fs_fs__get_revision_proplist(apr_hash_t **proplist_p,
73                                  svn_fs_t *fs,
74                                  svn_revnum_t rev,
75                                  svn_boolean_t refresh,
76                                  apr_pool_t *result_pool,
77                                  apr_pool_t *scratch_pool);
78
79 /* Set the revision property list of revision REV in filesystem FS to
80    PROPLIST.  Use POOL for temporary allocations. */
81 svn_error_t *
82 svn_fs_fs__set_revision_proplist(svn_fs_t *fs,
83                                  svn_revnum_t rev,
84                                  apr_hash_t *proplist,
85                                  apr_pool_t *pool);
86
87
88 /* Return TRUE, if for REVISION in FS, we can find the revprop pack file.
89  * Use POOL for temporary allocations.
90  * Set *MISSING, if the reason is a missing manifest or pack file.
91  */
92 svn_boolean_t
93 svn_fs_fs__packed_revprop_available(svn_boolean_t *missing,
94                                     svn_fs_t *fs,
95                                     svn_revnum_t revision,
96                                     apr_pool_t *pool);
97
98 \f
99 /****** Packing FSFS shards *********/
100
101 /* Copy revprop files for revisions [START_REV, END_REV) from SHARD_PATH
102  * to the pack file at PACK_FILE_NAME in PACK_FILE_DIR.
103  *
104  * The file sizes have already been determined and written to SIZES.
105  * Please note that this function will be executed while the filesystem
106  * has been locked and that revprops files will therefore not be modified
107  * while the pack is in progress.
108  *
109  * COMPRESSION_LEVEL defines how well the resulting pack file shall be
110  * compressed or whether is shall be compressed at all.  TOTAL_SIZE is
111  * a hint on which initial buffer size we should use to hold the pack file
112  * content.
113  *
114  * If FLUSH_TO_DISK is non-zero, do not return until the data has actually
115  * been written on the disk.  CANCEL_FUNC and CANCEL_BATON are used as usual.
116  * Temporary allocations are done in SCRATCH_POOL.
117  */
118 svn_error_t *
119 svn_fs_fs__copy_revprops(const char *pack_file_dir,
120                          const char *pack_filename,
121                          const char *shard_path,
122                          svn_revnum_t start_rev,
123                          svn_revnum_t end_rev,
124                          apr_array_header_t *sizes,
125                          apr_size_t total_size,
126                          int compression_level,
127                          svn_boolean_t flush_to_disk,
128                          svn_cancel_func_t cancel_func,
129                          void *cancel_baton,
130                          apr_pool_t *scratch_pool);
131
132 /* In the filesystem FS, pack all revprop shards up to min_unpacked_rev.
133  *
134  * NOTE: Keep the old non-packed shards around until after the format bump.
135  * Otherwise, re-running upgrade will drop the packed revprop shard but
136  * have no unpacked data anymore.  Call upgrade_cleanup_pack_revprops after
137  * the bump.
138  *
139  * If FLUSH_TO_DISK is non-zero, do not return until the data has actually
140  * been written on the disk.  CANCEL_FUNC and CANCEL_BATON areused in the
141  * usual way.  Temporary allocations are done in SCRATCH_POOL.
142  */
143 svn_error_t *
144 svn_fs_fs__pack_revprops_shard(const char *pack_file_dir,
145                                const char *shard_path,
146                                apr_int64_t shard,
147                                int max_files_per_dir,
148                                apr_int64_t max_pack_size,
149                                int compression_level,
150                                svn_boolean_t flush_to_disk,
151                                svn_cancel_func_t cancel_func,
152                                void *cancel_baton,
153                                apr_pool_t *scratch_pool);
154
155 /* In the filesystem FS, remove all non-packed revprop shards up to
156  * min_unpacked_rev.  Temporary allocations are done in SCRATCH_POOL.
157  *
158  * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are
159  * used in the usual way.  Cancellation is supported in the sense that we
160  * will cleanly abort the operation.  However, there will be remnant shards
161  * that must be removed manually.
162  *
163  * See upgrade_pack_revprops for more info.
164  */
165 svn_error_t *
166 svn_fs_fs__delete_revprops_shard(const char *shard_path,
167                                  apr_int64_t shard,
168                                  int max_files_per_dir,
169                                  svn_cancel_func_t cancel_func,
170                                  void *cancel_baton,
171                                  apr_pool_t *scratch_pool);