svn_fs.h

Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  *    Licensed to the Apache Software Foundation (ASF) under one
00005  *    or more contributor license agreements.  See the NOTICE file
00006  *    distributed with this work for additional information
00007  *    regarding copyright ownership.  The ASF licenses this file
00008  *    to you under the Apache License, Version 2.0 (the
00009  *    "License"); you may not use this file except in compliance
00010  *    with the License.  You may obtain a copy of the License at
00011  *
00012  *      http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  *    Unless required by applicable law or agreed to in writing,
00015  *    software distributed under the License is distributed on an
00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  *    KIND, either express or implied.  See the License for the
00018  *    specific language governing permissions and limitations
00019  *    under the License.
00020  * ====================================================================
00021  * @endcopyright
00022  *
00023  * @file svn_fs.h
00024  * @brief Interface to the Subversion filesystem.
00025  */
00026 
00027 #ifndef SVN_FS_H
00028 #define SVN_FS_H
00029 
00030 #include <apr.h>
00031 #include <apr_pools.h>
00032 #include <apr_hash.h>
00033 #include <apr_tables.h>
00034 #include <apr_time.h>    /* for apr_time_t */
00035 
00036 #include "svn_types.h"
00037 #include "svn_string.h"
00038 #include "svn_delta.h"
00039 #include "svn_io.h"
00040 #include "svn_mergeinfo.h"
00041 #include "svn_checksum.h"
00042 
00043 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif /* __cplusplus */
00047 
00048 
00049 /**
00050  * Get libsvn_fs version information.
00051  *
00052  * @since New in 1.1.
00053  */
00054 const svn_version_t *
00055 svn_fs_version(void);
00056 
00057 /**
00058  * @defgroup fs_handling Filesystem interaction subsystem
00059  * @{
00060  */
00061 
00062 /* Opening and creating filesystems.  */
00063 
00064 
00065 /** An object representing a Subversion filesystem.  */
00066 typedef struct svn_fs_t svn_fs_t;
00067 
00068 /**
00069  * @defgroup svn_fs_backend_names Built-in back-ends
00070  * Constants defining the currently supported built-in filesystem backends.
00071  *
00072  * @see svn_fs_type
00073  * @{
00074  */
00075 /** @since New in 1.1. */
00076 #define SVN_FS_TYPE_BDB                         "bdb"
00077 /** @since New in 1.1. */
00078 #define SVN_FS_TYPE_FSFS                        "fsfs"
00079 
00080 /**
00081  * EXPERIMENTAL filesystem backend.
00082  *
00083  * It is not ready for general production use.  Please consult the
00084  * respective release notes on suggested usage scenarios.
00085  *
00086  * @since New in 1.9.
00087  */
00088 #define SVN_FS_TYPE_FSX                         "fsx"
00089 
00090 /** @} */
00091 
00092 
00093 /**
00094  * @name Filesystem configuration options
00095  * @{
00096  */
00097 #define SVN_FS_CONFIG_BDB_TXN_NOSYNC            "bdb-txn-nosync"
00098 #define SVN_FS_CONFIG_BDB_LOG_AUTOREMOVE        "bdb-log-autoremove"
00099 
00100 /** Enable / disable text delta caching for a FSFS repository.
00101  *
00102  * @since New in 1.7.
00103  */
00104 #define SVN_FS_CONFIG_FSFS_CACHE_DELTAS         "fsfs-cache-deltas"
00105 
00106 /** Enable / disable full-text caching for a FSFS repository.
00107  *
00108  * @since New in 1.7.
00109  */
00110 #define SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS      "fsfs-cache-fulltexts"
00111 
00112 /** Enable / disable revprop caching for a FSFS repository.
00113  *
00114  * "2" is allowed, too and means "enable if efficient",
00115  * i.e. this will not create warning at runtime if there
00116  * if no efficient support for revprop caching.
00117  *
00118  * @since New in 1.8.
00119  */
00120 #define SVN_FS_CONFIG_FSFS_CACHE_REVPROPS       "fsfs-cache-revprops"
00121 
00122 /** Select the cache namespace.  If you potentially share the cache with
00123  * another FS object for the same repository, objects read through one FS
00124  * will not need to be read again for the other.  In most cases, that is
00125  * a very desirable behavior and the default is, therefore, an empty
00126  * namespace.
00127  *
00128  * If you want to be sure that your FS instance will actually read all
00129  * requested data at least once, you need to specify a separate namespace
00130  * for it.  All repository verification code, for instance, should use
00131  * some GUID here that is different each time you open an FS instance.
00132  *
00133  * @since New in 1.8.
00134  */
00135 #define SVN_FS_CONFIG_FSFS_CACHE_NS             "fsfs-cache-namespace"
00136 
00137 /** Enable / disable the FSFS format 7 "block read" feature.
00138  *
00139  * @since New in 1.9.
00140  */
00141 #define SVN_FS_CONFIG_FSFS_BLOCK_READ           "fsfs-block-read"
00142 
00143 /** String with a decimal representation of the FSFS format shard size.
00144  * Zero ("0") means that a repository with linear layout should be created.
00145  *
00146  * This option will only be used during the creation of new repositories
00147  * and is otherwise ignored.
00148  *
00149  * @since New in 1.9.
00150  */
00151 #define SVN_FS_CONFIG_FSFS_SHARD_SIZE           "fsfs-shard-size"
00152 
00153 /** Enable / disable the FSFS format 7 logical addressing feature for a
00154  * newly created repository.
00155  *
00156  * This option will only be used during the creation of new repositories
00157  * and is otherwise ignored.
00158  *
00159  * @since New in 1.9.
00160  */
00161 #define SVN_FS_CONFIG_FSFS_LOG_ADDRESSING       "fsfs-log-addressing"
00162 
00163 /* Note to maintainers: if you add further SVN_FS_CONFIG_FSFS_CACHE_* knobs,
00164    update fs_fs.c:verify_as_revision_before_current_plus_plus(). */
00165 
00166 /** Select the filesystem type. See also #svn_fs_type().
00167  *
00168  * @since New in 1.1. */
00169 #define SVN_FS_CONFIG_FS_TYPE                   "fs-type"
00170 
00171 /** Create repository format compatible with Subversion versions
00172  * earlier than 1.4.
00173  *
00174  *  @since New in 1.4.
00175  */
00176 #define SVN_FS_CONFIG_PRE_1_4_COMPATIBLE        "pre-1.4-compatible"
00177 
00178 /** Create repository format compatible with Subversion versions
00179  * earlier than 1.5.
00180  *
00181  * @since New in 1.5.
00182  */
00183 #define SVN_FS_CONFIG_PRE_1_5_COMPATIBLE        "pre-1.5-compatible"
00184 
00185 /** Create repository format compatible with Subversion versions
00186  * earlier than 1.6.
00187  *
00188  * @since New in 1.6.
00189  */
00190 #define SVN_FS_CONFIG_PRE_1_6_COMPATIBLE        "pre-1.6-compatible"
00191 
00192 /** Create repository format compatible with Subversion versions
00193  * earlier than 1.8.
00194  *
00195  * @since New in 1.8.
00196  */
00197 #define SVN_FS_CONFIG_PRE_1_8_COMPATIBLE        "pre-1.8-compatible"
00198 
00199 /** Create repository format compatible with the specified Subversion
00200  * release.  The value must be a version in the same format as
00201  * #SVN_VER_NUMBER and cannot exceed the current version.
00202  *
00203  * @note The @c patch component would often be ignored, due to our forward
00204  * compatibility promises within minor release lines.  It should therefore
00205  * usually be set to @c 0.
00206  *
00207  * @since New in 1.9.
00208  */
00209 #define SVN_FS_CONFIG_COMPATIBLE_VERSION        "compatible-version"
00210 /** @} */
00211 
00212 
00213 /**
00214  * Callers should invoke this function to initialize global state in
00215  * the FS library before creating FS objects.  If this function is
00216  * invoked, no FS objects may be created in another thread at the same
00217  * time as this invocation, and the provided @a pool must last longer
00218  * than any FS object created subsequently.
00219  *
00220  * If this function is not called, the FS library will make a best
00221  * effort to bootstrap a mutex for protecting data common to FS
00222  * objects; however, there is a small window of failure.  Also, a
00223  * small amount of data will be leaked if the Subversion FS library is
00224  * dynamically unloaded, and using the bdb FS can potentially segfault
00225  * or invoke other undefined behavior if this function is not called
00226  * with an appropriate pool (such as the pool the module was loaded into)
00227  * when loaded dynamically.
00228  *
00229  * If this function is called multiple times before the pool passed to
00230  * the first call is destroyed or cleared, the later calls will have
00231  * no effect.
00232  *
00233  * @since New in 1.2.
00234  */
00235 svn_error_t *
00236 svn_fs_initialize(apr_pool_t *pool);
00237 
00238 
00239 /** The type of a warning callback function.  @a baton is the value specified
00240  * in the call to svn_fs_set_warning_func(); the filesystem passes it through
00241  * to the callback.  @a err contains the warning message.
00242  *
00243  * The callback function should not clear the error that is passed to it;
00244  * its caller should do that.
00245  */
00246 typedef void (*svn_fs_warning_callback_t)(void *baton, svn_error_t *err);
00247 
00248 
00249 /** Provide a callback function, @a warning, that @a fs should use to
00250  * report (non-fatal) errors.  To print an error, the filesystem will call
00251  * @a warning, passing it @a warning_baton and the error.
00252  *
00253  * By default, this is set to a function that will crash the process.
00254  * Dumping to @c stderr or <tt>/dev/tty</tt> is not acceptable default
00255  * behavior for server processes, since those may both be equivalent to
00256  * <tt>/dev/null</tt>.
00257  */
00258 void
00259 svn_fs_set_warning_func(svn_fs_t *fs,
00260                         svn_fs_warning_callback_t warning,
00261                         void *warning_baton);
00262 
00263 
00264 
00265 /**
00266  * Create a new, empty Subversion filesystem, stored in the directory
00267  * @a path, and return a pointer to it in @a *fs_p.  @a path must not
00268  * currently exist, but its parent must exist.  If @a fs_config is not
00269  * @c NULL, the options it contains modify the behavior of the
00270  * filesystem.  The interpretation of @a fs_config is specific to the
00271  * filesystem back-end.  The new filesystem may be closed by
00272  * destroying @a pool.
00273  *
00274  * @note The lifetime of @a fs_config must not be shorter than @a
00275  * pool's. It's a good idea to allocate @a fs_config from @a pool or
00276  * one of its ancestors.
00277  *
00278  * If @a fs_config contains a value for #SVN_FS_CONFIG_FS_TYPE, that
00279  * value determines the filesystem type for the new filesystem.
00280  * Currently defined values are:
00281  *
00282  *   SVN_FS_TYPE_BDB   Berkeley-DB implementation
00283  *   SVN_FS_TYPE_FSFS  Native-filesystem implementation
00284  *   SVN_FS_TYPE_FSX   Experimental filesystem implementation
00285  *
00286  * If @a fs_config is @c NULL or does not contain a value for
00287  * #SVN_FS_CONFIG_FS_TYPE then the default filesystem type will be used.
00288  * This will typically be BDB for version 1.1 and FSFS for later versions,
00289  * though the caller should not rely upon any particular default if they
00290  * wish to ensure that a filesystem of a specific type is created.
00291  *
00292  * @since New in 1.1.
00293  */
00294 svn_error_t *
00295 svn_fs_create(svn_fs_t **fs_p,
00296               const char *path,
00297               apr_hash_t *fs_config,
00298               apr_pool_t *pool);
00299 
00300 /**
00301  * Open a Subversion filesystem located in the directory @a path, and
00302  * return a pointer to it in @a *fs_p.  If @a fs_config is not @c
00303  * NULL, the options it contains modify the behavior of the
00304  * filesystem.  The interpretation of @a fs_config is specific to the
00305  * filesystem back-end.  The opened filesystem will be allocated in
00306  * @a result_pool may be closed by clearing or destroying that pool.
00307  * Use @a scratch_pool for temporary allocations.
00308  *
00309  * @note The lifetime of @a fs_config must not be shorter than @a
00310  * result_pool's. It's a good idea to allocate @a fs_config from
00311  * @a result_pool or one of its ancestors.
00312  *
00313  * Only one thread may operate on any given filesystem object at once.
00314  * Two threads may access the same filesystem simultaneously only if
00315  * they open separate filesystem objects.
00316  *
00317  * @note You probably don't want to use this directly.  Take a look at
00318  * svn_repos_open3() instead.
00319  *
00320  * @since New in 1.9.
00321  */
00322 svn_error_t *
00323 svn_fs_open2(svn_fs_t **fs_p,
00324              const char *path,
00325              apr_hash_t *fs_config,
00326              apr_pool_t *result_pool,
00327              apr_pool_t *scratch_pool);
00328 
00329 /**
00330  * Like svn_fs_open2(), but without @a scratch_pool.
00331  *
00332  * @deprecated Provided for backward compatibility with the 1.8 API.
00333  * @since New in 1.1.
00334  */
00335 SVN_DEPRECATED
00336 svn_error_t *
00337 svn_fs_open(svn_fs_t **fs_p,
00338             const char *path,
00339             apr_hash_t *fs_config,
00340             apr_pool_t *pool);
00341 
00342 /** The kind of action being taken by 'upgrade'.
00343  *
00344  * @since New in 1.9.
00345  */
00346 typedef enum svn_fs_upgrade_notify_action_t
00347 {
00348   /** Packing of the revprop shard has completed.
00349    *  The number parameter is the shard being processed. */
00350   svn_fs_upgrade_pack_revprops = 0,
00351 
00352   /** Removal of the non-packed revprop shard is completed.
00353    *  The number parameter is the shard being processed */
00354   svn_fs_upgrade_cleanup_revprops,
00355 
00356   /** DB format has been set to the new value.
00357    *  The number parameter is the new format number. */
00358   svn_fs_upgrade_format_bumped
00359 } svn_fs_upgrade_notify_action_t;
00360 
00361 /** The type of an upgrade notification function.  @a number is specifc
00362  * to @a action (see #svn_fs_upgrade_notify_action_t); @a action is the
00363  * type of action being performed.  @a baton is the corresponding baton
00364  * for the notification function, and @a scratch_pool can be used for
00365  * temporary allocations, but will be cleared between invocations.
00366  *
00367  * @since New in 1.9.
00368  */
00369 typedef svn_error_t *(*svn_fs_upgrade_notify_t)(void *baton,
00370                                       apr_uint64_t number,
00371                                       svn_fs_upgrade_notify_action_t action,
00372                                       apr_pool_t *scratch_pool);
00373 
00374 /**
00375  * Upgrade the Subversion filesystem located in the directory @a path
00376  * to the latest version supported by this library.  Return
00377  * #SVN_ERR_FS_UNSUPPORTED_UPGRADE and make no changes to the
00378  * filesystem if the requested upgrade is not supported.  Use
00379  * @a scratch_pool for temporary allocations.
00380  *
00381  * The optional @a notify_func callback is only a general feedback that
00382  * the operation is still in process but may be called in e.g. random shard
00383  * order and more than once for the same shard.
00384  *
00385  * The optional @a cancel_func callback will be invoked as usual to allow
00386  * the user to preempt this potentially lengthy operation.
00387  *
00388  * @note You probably don't want to use this directly.  Take a look at
00389  * svn_repos_upgrade2() instead.
00390  *
00391  * @note Canceling an upgrade is legal but may leave remnants of previous
00392  * format data that may not be cleaned up automatically by later calls.
00393  *
00394  * @since New in 1.9.
00395  */
00396 svn_error_t *
00397 svn_fs_upgrade2(const char *path,
00398                 svn_fs_upgrade_notify_t notify_func,
00399                 void *notify_baton,
00400                 svn_cancel_func_t cancel_func,
00401                 void *cancel_baton,
00402                 apr_pool_t *scratch_pool);
00403 
00404 /**
00405  * Like svn_fs_upgrade2 but with notify_func, notify_baton, cancel_func
00406  * and cancel_baton being set to NULL.
00407  *
00408  * @deprecated Provided for backward compatibility with the 1.8 API.
00409  * @since New in 1.5.
00410  */
00411 SVN_DEPRECATED
00412 svn_error_t *
00413 svn_fs_upgrade(const char *path,
00414                apr_pool_t *pool);
00415 
00416 /**
00417  * Callback function type for progress notification.
00418  *
00419  * @a revision is the number of the revision currently being processed,
00420  * #SVN_INVALID_REVNUM if the current stage is not linked to any specific
00421  * revision. @a baton is the callback baton.
00422  *
00423  * @since New in 1.8.
00424  */
00425 typedef void (*svn_fs_progress_notify_func_t)(svn_revnum_t revision,
00426                                               void *baton,
00427                                               apr_pool_t *pool);
00428 
00429 /**
00430  * Return, in @a *fs_type, a string identifying the back-end type of
00431  * the Subversion filesystem located in @a path.  Allocate @a *fs_type
00432  * in @a pool.
00433  *
00434  * The string should be equal to one of the @c SVN_FS_TYPE_* defined
00435  * constants, unless the filesystem is a new back-end type added in
00436  * a later version of Subversion.
00437  *
00438  * In general, the type should make no difference in the filesystem's
00439  * semantics, but there are a few situations (such as backups) where
00440  * it might matter.
00441  *
00442  * @since New in 1.3.
00443  */
00444 svn_error_t *
00445 svn_fs_type(const char **fs_type,
00446             const char *path,
00447             apr_pool_t *pool);
00448 
00449 /**
00450  * Return the path to @a fs's repository, allocated in @a pool.
00451  * @note This is just what was passed to svn_fs_create() or
00452  * svn_fs_open() -- might be absolute, might not.
00453  *
00454  * @since New in 1.1.
00455  */
00456 const char *
00457 svn_fs_path(svn_fs_t *fs,
00458             apr_pool_t *pool);
00459 
00460 /**
00461  * Return a shallow copy of the configuration parameters used to open
00462  * @a fs, allocated in @a pool.  It may be @c NULL.  The contents of the
00463  * hash contents remains valid only for @a fs's lifetime.
00464  *
00465  * @note This is just what was passed to svn_fs_create() or svn_fs_open().
00466  * You may not modify it.
00467  *
00468  * @since New in 1.8.
00469  */
00470 apr_hash_t *
00471 svn_fs_config(svn_fs_t *fs,
00472               apr_pool_t *pool);
00473 
00474 /**
00475  * Delete the filesystem at @a path.
00476  *
00477  * @note: Deleting a filesystem that has an open svn_fs_t is not
00478  * supported.  Clear/destroy all pools used to create/open @a path.
00479  * See issue 4264.
00480  *
00481  * @since New in 1.1.
00482  */
00483 svn_error_t *
00484 svn_fs_delete_fs(const char *path,
00485                  apr_pool_t *pool);
00486 
00487 /** The type of a hotcopy notification function.  @a start_revision and
00488  * @a end_revision indicate the copied revision range.  @a baton is the
00489  * corresponding baton for the notification function, and @a scratch_pool
00490  * can be used for temporary allocations, but will be cleared between
00491  * invocations.
00492  */
00493 typedef void (*svn_fs_hotcopy_notify_t)(void *baton,
00494                                         svn_revnum_t start_revision,
00495                                         svn_revnum_t end_revision,
00496                                         apr_pool_t *scratch_pool);
00497 
00498 /**
00499  * Copy a possibly live Subversion filesystem from @a src_path to
00500  * @a dest_path.  If @a clean is @c TRUE, perform cleanup on the
00501  * source filesystem as part of the copy operation; currently, this
00502  * means deleting copied, unused logfiles for a Berkeley DB source
00503  * filesystem.
00504  *
00505  * If @a incremental is TRUE, make an effort to avoid re-copying
00506  * information already present in the destination where possible.  If
00507  * incremental hotcopy is not implemented, raise
00508  * #SVN_ERR_UNSUPPORTED_FEATURE.
00509  *
00510  * For each revision range copied, @a notify_func will be called with
00511  * staring and ending revision numbers (both inclusive and not necessarily
00512  * different) and with the @a notify_baton.  Currently, this notification
00513  * is not triggered by the BDB backend.  @a notify_func may be @c NULL
00514  * if this notification is not required.
00515  *
00516  * The optional @a cancel_func callback will be invoked with
00517  * @a cancel_baton as usual to allow the user to preempt this potentially
00518  * lengthy operation.
00519  *
00520  * Use @a scratch_pool for temporary allocations.
00521  *
00522  * @since New in 1.9.
00523  */
00524 svn_error_t *
00525 svn_fs_hotcopy3(const char *src_path,
00526                 const char *dest_path,
00527                 svn_boolean_t clean,
00528                 svn_boolean_t incremental,
00529                 svn_fs_hotcopy_notify_t notify_func,
00530                 void *notify_baton,
00531                 svn_cancel_func_t cancel_func,
00532                 void *cancel_baton,
00533                 apr_pool_t *scratch_pool);
00534 
00535 /**
00536  * Like svn_fs_hotcopy3(), but with @a notify_func and @a notify_baton
00537  * always passed as @c NULL.
00538  *
00539  * @deprecated Provided for backward compatibility with the 1.8 API.
00540  * @since New in 1.8.
00541  */
00542 SVN_DEPRECATED
00543 svn_error_t *
00544 svn_fs_hotcopy2(const char *src_path,
00545                 const char *dest_path,
00546                 svn_boolean_t clean,
00547                 svn_boolean_t incremental,
00548                 svn_cancel_func_t cancel_func,
00549                 void *cancel_baton,
00550                 apr_pool_t *scratch_pool);
00551 
00552 /**
00553  * Like svn_fs_hotcopy2(), but with @a incremental always passed as @c
00554  * TRUE and without cancellation support.
00555  *
00556  * @deprecated Provided for backward compatibility with the 1.7 API.
00557  * @since New in 1.1.
00558  */
00559 SVN_DEPRECATED
00560 svn_error_t *
00561 svn_fs_hotcopy(const char *src_path,
00562                const char *dest_path,
00563                svn_boolean_t clean,
00564                apr_pool_t *pool);
00565 
00566 /** Perform any necessary non-catastrophic recovery on the Subversion
00567  * filesystem located at @a path.
00568  *
00569  * If @a cancel_func is not @c NULL, it is called periodically with
00570  * @a cancel_baton as argument to see if the client wishes to cancel
00571  * recovery.  BDB filesystems do not currently support cancellation.
00572  *
00573  * Do any necessary allocation within @a pool.
00574  *
00575  * For FSFS filesystems, recovery is currently limited to recreating
00576  * the db/current file, and does not require exclusive access.
00577  *
00578  * For BDB filesystems, recovery requires exclusive access, and is
00579  * described in detail below.
00580  *
00581  * After an unexpected server exit, due to a server crash or a system
00582  * crash, a Subversion filesystem based on Berkeley DB needs to run
00583  * recovery procedures to bring the database back into a consistent
00584  * state and release any locks that were held by the deceased process.
00585  * The recovery procedures require exclusive access to the database
00586  * --- while they execute, no other process or thread may access the
00587  * database.
00588  *
00589  * In a server with multiple worker processes, like Apache, if a
00590  * worker process accessing the filesystem dies, you must stop the
00591  * other worker processes, and run recovery.  Then, the other worker
00592  * processes can re-open the database and resume work.
00593  *
00594  * If the server exited cleanly, there is no need to run recovery, but
00595  * there is no harm in it, either, and it take very little time.  So
00596  * it's a fine idea to run recovery when the server process starts,
00597  * before it begins handling any requests.
00598  *
00599  * @since New in 1.5.
00600  */
00601 svn_error_t *
00602 svn_fs_recover(const char *path,
00603                svn_cancel_func_t cancel_func,
00604                void *cancel_baton,
00605                apr_pool_t *pool);
00606 
00607 
00608 /**
00609  * Callback for svn_fs_freeze().
00610  *
00611  * @since New in 1.8.
00612  */
00613 typedef svn_error_t *(*svn_fs_freeze_func_t)(void *baton, apr_pool_t *pool);
00614 
00615 /**
00616  * Take an exclusive lock on @a fs to prevent commits and then invoke
00617  * @a freeze_func passing @a freeze_baton.
00618  *
00619  * @note @a freeze_func must not, directly or indirectly, call any function
00620  * that attempts to take out a lock on the underlying repository.  These
00621  * include functions for packing, hotcopying, setting revprops and commits.
00622  * Attempts to do so may result in a deadlock.
00623  *
00624  * @note The BDB backend doesn't implement this feature so most
00625  * callers should not call this function directly but should use the
00626  * higher level svn_repos_freeze() instead.
00627  *
00628  * @see svn_repos_freeze()
00629  *
00630  * @since New in 1.8.
00631  */
00632 svn_error_t *
00633 svn_fs_freeze(svn_fs_t *fs,
00634               svn_fs_freeze_func_t freeze_func,
00635               void *freeze_baton,
00636               apr_pool_t *pool);
00637 
00638 
00639 /** Subversion filesystems based on Berkeley DB.
00640  *
00641  * The following functions are specific to Berkeley DB filesystems.
00642  *
00643  * @defgroup svn_fs_bdb Berkeley DB filesystems
00644  * @{
00645  */
00646 
00647 /** Register an error handling function for Berkeley DB error messages.
00648  *
00649  * @deprecated Provided for backward compatibility with the 1.2 API.
00650  *
00651  * Despite being first declared deprecated in Subversion 1.3, this API
00652  * is redundant in versions 1.1 and 1.2 as well.
00653  *
00654  * Berkeley DB's error codes are seldom sufficiently informative to allow
00655  * adequate troubleshooting.  Berkeley DB provides extra messages through
00656  * a callback function - if an error occurs, the @a handler will be called
00657  * with two strings: an error message prefix, which will be zero, and
00658  * an error message.  @a handler might print it out, log it somewhere,
00659  * etc.
00660  *
00661  * Subversion 1.1 and later install their own handler internally, and
00662  * wrap the messages from Berkeley DB into the standard svn_error_t object,
00663  * making any information gained through this interface redundant.
00664  *
00665  * It is only worth using this function if your program will be used
00666  * with Subversion 1.0.
00667  *
00668  * This function connects to the Berkeley DB @c DBENV->set_errcall interface.
00669  * Since that interface supports only a single callback, Subversion's internal
00670  * callback is registered with Berkeley DB, and will forward notifications to
00671  * a user provided callback after performing its own processing.
00672  */
00673 SVN_DEPRECATED
00674 svn_error_t *
00675 svn_fs_set_berkeley_errcall(svn_fs_t *fs,
00676                             void (*handler)(const char *errpfx,
00677                                             char *msg));
00678 
00679 /** Set @a *logfiles to an array of <tt>const char *</tt> log file names
00680  * of Berkeley DB-based Subversion filesystem.
00681  *
00682  * If @a only_unused is @c TRUE, set @a *logfiles to an array which
00683  * contains only the names of Berkeley DB log files no longer in use
00684  * by the filesystem.  Otherwise, all log files (used and unused) are
00685  * returned.
00686 
00687  * This function wraps the Berkeley DB 'log_archive' function
00688  * called by the db_archive binary.  Repository administrators may
00689  * want to run this function periodically and delete the unused log
00690  * files, as a way of reclaiming disk space.
00691  */
00692 svn_error_t *
00693 svn_fs_berkeley_logfiles(apr_array_header_t **logfiles,
00694                          const char *path,
00695                          svn_boolean_t only_unused,
00696                          apr_pool_t *pool);
00697 
00698 
00699 /**
00700  * The following functions are similar to their generic counterparts.
00701  *
00702  * In Subversion 1.2 and earlier, they only work on Berkeley DB filesystems.
00703  * In Subversion 1.3 and later, they perform largely as aliases for their
00704  * generic counterparts (with the exception of recover, which only gained
00705  * a generic counterpart in 1.5).
00706  *
00707  * @defgroup svn_fs_bdb_deprecated Berkeley DB filesystem compatibility
00708  * @{
00709  */
00710 
00711 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00712 SVN_DEPRECATED
00713 svn_fs_t *
00714 svn_fs_new(apr_hash_t *fs_config,
00715            apr_pool_t *pool);
00716 
00717 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00718 SVN_DEPRECATED
00719 svn_error_t *
00720 svn_fs_create_berkeley(svn_fs_t *fs,
00721                        const char *path);
00722 
00723 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00724 SVN_DEPRECATED
00725 svn_error_t *
00726 svn_fs_open_berkeley(svn_fs_t *fs,
00727                      const char *path);
00728 
00729 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00730 SVN_DEPRECATED
00731 const char *
00732 svn_fs_berkeley_path(svn_fs_t *fs,
00733                      apr_pool_t *pool);
00734 
00735 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00736 SVN_DEPRECATED
00737 svn_error_t *
00738 svn_fs_delete_berkeley(const char *path,
00739                        apr_pool_t *pool);
00740 
00741 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00742 SVN_DEPRECATED
00743 svn_error_t *
00744 svn_fs_hotcopy_berkeley(const char *src_path,
00745                         const char *dest_path,
00746                         svn_boolean_t clean_logs,
00747                         apr_pool_t *pool);
00748 
00749 /** @deprecated Provided for backward compatibility with the 1.4 API. */
00750 SVN_DEPRECATED
00751 svn_error_t *
00752 svn_fs_berkeley_recover(const char *path,
00753                         apr_pool_t *pool);
00754 /** @} */
00755 
00756 /** @} */
00757 
00758 
00759 /** Filesystem Access Contexts.
00760  *
00761  * @since New in 1.2.
00762  *
00763  * At certain times, filesystem functions need access to temporary
00764  * user data.  For example, which user is changing a file?  If the
00765  * file is locked, has an appropriate lock-token been supplied?
00766  *
00767  * This temporary user data is stored in an "access context" object,
00768  * and the access context is then connected to the filesystem object.
00769  * Whenever a filesystem function requires information, it can pull
00770  * things out of the context as needed.
00771  *
00772  * @defgroup svn_fs_access_ctx Filesystem access contexts
00773  * @{
00774  */
00775 
00776 /** An opaque object representing temporary user data. */
00777 typedef struct svn_fs_access_t svn_fs_access_t;
00778 
00779 
00780 /** Set @a *access_ctx to a new #svn_fs_access_t object representing
00781  *  @a username, allocated in @a pool.  @a username is presumed to
00782  *  have been authenticated by the caller.
00783  *
00784  *  Make a deep copy of @a username.
00785  */
00786 svn_error_t *
00787 svn_fs_create_access(svn_fs_access_t **access_ctx,
00788                      const char *username,
00789                      apr_pool_t *pool);
00790 
00791 
00792 /** Associate @a access_ctx with an open @a fs.
00793  *
00794  * This function can be run multiple times on the same open
00795  * filesystem, in order to change the filesystem access context for
00796  * different filesystem operations.  Pass a NULL value for @a
00797  * access_ctx to disassociate the current access context from the
00798  * filesystem.
00799  */
00800 svn_error_t *
00801 svn_fs_set_access(svn_fs_t *fs,
00802                   svn_fs_access_t *access_ctx);
00803 
00804 
00805 /** Set @a *access_ctx to the current @a fs access context, or NULL if
00806  * there is no current fs access context.
00807  */
00808 svn_error_t *
00809 svn_fs_get_access(svn_fs_access_t **access_ctx,
00810                   svn_fs_t *fs);
00811 
00812 
00813 /** Accessors for the access context: */
00814 
00815 /** Set @a *username to the name represented by @a access_ctx. */
00816 svn_error_t *
00817 svn_fs_access_get_username(const char **username,
00818                            svn_fs_access_t *access_ctx);
00819 
00820 
00821 /** Push a lock-token @a token associated with path @a path into the
00822  * context @a access_ctx.  The context remembers all tokens it
00823  * receives, and makes them available to fs functions.  The token and
00824  * path are not duplicated into @a access_ctx's pool; make sure the
00825  * token's lifetime is at least as long as @a access_ctx.
00826  *
00827  * @since New in 1.6. */
00828 svn_error_t *
00829 svn_fs_access_add_lock_token2(svn_fs_access_t *access_ctx,
00830                               const char *path,
00831                               const char *token);
00832 
00833 /**
00834  * Same as svn_fs_access_add_lock_token2(), but with @a path set to value 1.
00835  *
00836  * @deprecated Provided for backward compatibility with the 1.5 API.
00837  */
00838 SVN_DEPRECATED
00839 svn_error_t *
00840 svn_fs_access_add_lock_token(svn_fs_access_t *access_ctx,
00841                              const char *token);
00842 
00843 /** @} */
00844 
00845 
00846 /** Filesystem Nodes and Node-Revisions.
00847  *
00848  * In a Subversion filesystem, a `node' corresponds roughly to an
00849  * `inode' in a Unix filesystem:
00850  * - A node is either a file or a directory.
00851  * - A node's contents change over time.
00852  * - When you change a node's contents, it's still the same node; it's
00853  *   just been changed.  So a node's identity isn't bound to a specific
00854  *   set of contents.
00855  * - If you rename a node, it's still the same node, just under a
00856  *   different name.  So a node's identity isn't bound to a particular
00857  *   filename.
00858  *
00859  * A `node revision' refers to one particular version of a node's contents,
00860  * that existed over a specific period of time (one or more repository
00861  * revisions).  Changing a node's contents always creates a new revision of
00862  * that node, which is to say creates a new `node revision'.  Once created,
00863  * a node revision's contents never change.
00864  *
00865  * When we create a node, its initial contents are the initial revision of
00866  * the node.  As users make changes to the node over time, we create new
00867  * revisions of that same node.  When a user commits a change that deletes
00868  * a file from the filesystem, we don't delete the node, or any revision
00869  * of it --- those stick around to allow us to recreate prior revisions of
00870  * the filesystem.  Instead, we just remove the reference to the node
00871  * from the directory.
00872  *
00873  * Each node revision is a part of exactly one node, and appears only once
00874  * in the history of that node.  It is uniquely identified by a node
00875  * revision id, #svn_fs_id_t.  Its node revision id also identifies which
00876  * node it is a part of.
00877  *
00878  * @note: Often when we talk about `the node' within the context of a single
00879  * revision (or transaction), we implicitly mean `the node as it appears in
00880  * this revision (or transaction)', or in other words `the node revision'.
00881  *
00882  * @note: Commonly, a node revision will have the same content as some other
00883  * node revisions in the same node and in different nodes.  The FS libraries
00884  * allow different node revisions to share the same data without storing a
00885  * separate copy of the data.
00886  *
00887  * @defgroup svn_fs_nodes Filesystem nodes
00888  * @{
00889  */
00890 
00891 /** Defines the possible ways two arbitrary (root, path)-pairs may be
00892  * related.
00893  *
00894  * @since New in 1.9.
00895  */
00896 typedef enum svn_fs_node_relation_t
00897 {
00898   /** The (root, path)-pairs are not related, i.e. none of the other cases
00899    * apply.  If the roots refer to different @c svn_fs_t instances, then
00900    * they are always considered unrelated - even if the underlying
00901    * repository is the same.
00902    */
00903   svn_fs_node_unrelated = 0,
00904 
00905   /** No changes have been made between the (root, path)-pairs, i.e. they
00906    * have the same (relative) nodes in their sub-trees, corresponding sub-
00907    * tree nodes have the same contents as well as properties and report the
00908    * same "created-path" and "created-rev" data.  This implies having a
00909    * common ancestor.
00910    *
00911    * However, due to efficiency considerations, the FS implementation may
00912    * report some combinations as merely having a common ancestor
00913    * (@a svn_fs_node_common_ancestor) instead of actually being unchanged.
00914    */
00915   svn_fs_node_unchanged,
00916 
00917   /** The (root, path)-pairs have a common ancestor (which may be one of
00918    * them) but there are changes between them, i.e. they don't fall into
00919    * the @c svn_fs_node_unchanged category.
00920    *
00921    * Due to efficiency considerations, the FS implementation may falsely
00922    * classify some combinations as merely having a common ancestor that
00923    * are, in fact, unchanged (@a svn_fs_node_unchanged).
00924    */
00925   svn_fs_node_common_ancestor
00926 
00927 } svn_fs_node_relation_t;
00928 
00929 /** An object representing a node-revision id.  */
00930 typedef struct svn_fs_id_t svn_fs_id_t;
00931 
00932 
00933 /** Return -1, 0, or 1 if node revisions @a a and @a b are respectively
00934  * unrelated, equivalent, or otherwise related (part of the same node).
00935  *
00936  * @note Consider using the more expressive #svn_fs_node_relation() instead.
00937  *
00938  * @see #svn_fs_node_relation
00939  */
00940 int
00941 svn_fs_compare_ids(const svn_fs_id_t *a,
00942                    const svn_fs_id_t *b);
00943 
00944 
00945 
00946 /** Return TRUE if node revisions @a id1 and @a id2 are related (part of the
00947  * same node), else return FALSE.
00948  *
00949  * @note Consider using the more expressive #svn_fs_node_relation() instead.
00950  *
00951  * @see #svn_fs_node_relation
00952  */
00953 svn_boolean_t
00954 svn_fs_check_related(const svn_fs_id_t *id1,
00955                      const svn_fs_id_t *id2);
00956 
00957 
00958 /**
00959  * @note This function is not guaranteed to work with all filesystem
00960  * types.  There is currently no un-deprecated equivalent; contact the
00961  * Subversion developers if you have a need for it.
00962  *
00963  * @deprecated Provided for backward compatibility with the 1.0 API.
00964  */
00965 SVN_DEPRECATED
00966 svn_fs_id_t *
00967 svn_fs_parse_id(const char *data,
00968                 apr_size_t len,
00969                 apr_pool_t *pool);
00970 
00971 
00972 /** Return a Subversion string containing the unparsed form of the
00973  * node revision id @a id.  Allocate the string containing the
00974  * unparsed form in @a pool.
00975  */
00976 svn_string_t *
00977 svn_fs_unparse_id(const svn_fs_id_t *id,
00978                   apr_pool_t *pool);
00979 
00980 /** @} */
00981 
00982 
00983 /** Filesystem Transactions.
00984  *
00985  * To make a change to a Subversion filesystem:
00986  * - Create a transaction object, using svn_fs_begin_txn().
00987  * - Call svn_fs_txn_root(), to get the transaction's root directory.
00988  * - Make whatever changes you like in that tree.
00989  * - Commit the transaction, using svn_fs_commit_txn().
00990  *
00991  * The filesystem implementation guarantees that your commit will
00992  * either:
00993  * - succeed completely, so that all of the changes are committed to
00994  *   create a new revision of the filesystem, or
00995  * - fail completely, leaving the filesystem unchanged.
00996  *
00997  * Until you commit the transaction, any changes you make are
00998  * invisible.  Only when your commit succeeds do they become visible
00999  * to the outside world, as a new revision of the filesystem.
01000  *
01001  * If you begin a transaction, and then decide you don't want to make
01002  * the change after all (say, because your net connection with the
01003  * client disappeared before the change was complete), you can call
01004  * svn_fs_abort_txn(), to cancel the entire transaction; this
01005  * leaves the filesystem unchanged.
01006  *
01007  * The only way to change the contents of files or directories, or
01008  * their properties, is by making a transaction and creating a new
01009  * revision, as described above.  Once a revision has been committed, it
01010  * never changes again; the filesystem interface provides no means to
01011  * go back and edit the contents of an old revision.  Once history has
01012  * been recorded, it is set in stone.  Clients depend on this property
01013  * to do updates and commits reliably; proxies depend on this property
01014  * to cache changes accurately; and so on.
01015  *
01016  * There are two kinds of nodes in the filesystem: mutable, and
01017  * immutable.  Revisions in the filesystem consist entirely of
01018  * immutable nodes, whose contents never change.  A transaction in
01019  * progress, which the user is still constructing, uses mutable nodes
01020  * for those nodes which have been changed so far, and refers to
01021  * immutable nodes from existing revisions for portions of the tree
01022  * which haven't been changed yet in that transaction.
01023  *
01024  * Immutable nodes, as part of revisions, never refer to mutable
01025  * nodes, which are part of uncommitted transactions.  Mutable nodes
01026  * may refer to immutable nodes, or other mutable nodes.
01027  *
01028  * Note that the terms "immutable" and "mutable" describe whether or
01029  * not the nodes have been changed as part of a transaction --- not
01030  * the permissions on the nodes they refer to.  Even if you aren't
01031  * authorized to modify the filesystem's root directory, you might be
01032  * authorized to change some descendant of the root; doing so would
01033  * create a new mutable copy of the root directory.  Mutability refers
01034  * to the role of the node: part of an existing revision, or part of a
01035  * new one.  This is independent of your authorization to make changes
01036  * to a given node.
01037  *
01038  * Transactions are actually persistent objects, stored in the
01039  * database.  You can open a filesystem, begin a transaction, and
01040  * close the filesystem, and then a separate process could open the
01041  * filesystem, pick up the same transaction, and continue work on it.
01042  * When a transaction is successfully committed, it is removed from
01043  * the database.
01044  *
01045  * Every transaction is assigned a name.  You can open a transaction
01046  * by name, and resume work on it, or find out the name of a
01047  * transaction you already have open.  You can also list all the
01048  * transactions currently present in the database.
01049  *
01050  * You may assign properties to transactions; these are name/value
01051  * pairs.  When you commit a transaction, all of its properties become
01052  * unversioned revision properties of the new revision.  (There is one
01053  * exception: the svn:date property will be automatically set on new
01054  * transactions to the date that the transaction was created, and can
01055  * be overwritten when the transaction is committed by the current
01056  * time; see svn_fs_commit_txn.)
01057  *
01058  * Transaction names are guaranteed to contain only letters (upper-
01059  * and lower-case), digits, `-', and `.', from the ASCII character
01060  * set.
01061  *
01062  * The Subversion filesystem will make a best effort to not reuse
01063  * transaction names.  The Berkeley DB backend generates transaction
01064  * names using a sequence, or a counter, which is stored in the BDB
01065  * database.  Each new transaction increments the counter.  The
01066  * current value of the counter is not serialized into a filesystem
01067  * dump file, so dumping and restoring the repository will reset the
01068  * sequence and reuse transaction names.  The FSFS backend generates a
01069  * transaction name using the hostname, process ID and current time in
01070  * microseconds since 00:00:00 January 1, 1970 UTC.  So it is
01071  * extremely unlikely that a transaction name will be reused.
01072  *
01073  * @defgroup svn_fs_txns Filesystem transactions
01074  * @{
01075  */
01076 
01077 /** The type of a Subversion transaction object.  */
01078 typedef struct svn_fs_txn_t svn_fs_txn_t;
01079 
01080 
01081 /** @defgroup svn_fs_begin_txn2_flags Bitmask flags for svn_fs_begin_txn2()
01082  * @since New in 1.2.
01083  * @{ */
01084 
01085 /** Do on-the-fly out-of-dateness checks.  That is, an fs routine may
01086  * throw error if a caller tries to edit an out-of-date item in the
01087  * transaction.
01088  *
01089  * @warning ### Not yet implemented.
01090  */
01091 #define SVN_FS_TXN_CHECK_OOD                     0x00001
01092 
01093 /** Do on-the-fly lock checks.  That is, an fs routine may throw error
01094  * if a caller tries to edit a locked item without having rights to the lock.
01095  */
01096 #define SVN_FS_TXN_CHECK_LOCKS                   0x00002
01097 
01098 /** Allow the client to specify the final svn:date of the revision by
01099  * setting or deleting the corresponding transaction property rather
01100  * than have it set automatically when the transaction is committed.
01101  *
01102  * @since New in 1.9.
01103  */
01104 #define SVN_FS_TXN_CLIENT_DATE                   0x00004
01105 
01106 /** @} */
01107 
01108 /**
01109  * Begin a new transaction on the filesystem @a fs, based on existing
01110  * revision @a rev.  Set @a *txn_p to a pointer to the new transaction.
01111  * When committed, this transaction will create a new revision.
01112  *
01113  * Allocate the new transaction in @a pool; when @a pool is freed, the new
01114  * transaction will be closed (neither committed nor aborted).
01115  *
01116  * @a flags determines transaction enforcement behaviors, and is composed
01117  * from the constants SVN_FS_TXN_* (#SVN_FS_TXN_CHECK_OOD etc.).
01118  *
01119  * @note If you're building a txn for committing, you probably
01120  * don't want to call this directly.  Instead, call
01121  * svn_repos_fs_begin_txn_for_commit(), which honors the
01122  * repository's hook configurations.
01123  *
01124  * @since New in 1.2.
01125  */
01126 svn_error_t *
01127 svn_fs_begin_txn2(svn_fs_txn_t **txn_p,
01128                   svn_fs_t *fs,
01129                   svn_revnum_t rev,
01130                   apr_uint32_t flags,
01131                   apr_pool_t *pool);
01132 
01133 
01134 /**
01135  * Same as svn_fs_begin_txn2(), but with @a flags set to 0.
01136  *
01137  * @deprecated Provided for backward compatibility with the 1.1 API.
01138  */
01139 SVN_DEPRECATED
01140 svn_error_t *
01141 svn_fs_begin_txn(svn_fs_txn_t **txn_p,
01142                  svn_fs_t *fs,
01143                  svn_revnum_t rev,
01144                  apr_pool_t *pool);
01145 
01146 
01147 
01148 /** Commit @a txn.
01149  *
01150  * @note You usually don't want to call this directly.
01151  * Instead, call svn_repos_fs_commit_txn(), which honors the
01152  * repository's hook configurations.
01153  *
01154  * If the transaction conflicts with other changes committed to the
01155  * repository, return an #SVN_ERR_FS_CONFLICT error.  Otherwise, create
01156  * a new filesystem revision containing the changes made in @a txn,
01157  * storing that new revision number in @a *new_rev, and return zero.
01158  *
01159  * If #SVN_FS_TXN_CLIENT_DATE was passed to #svn_fs_begin_txn2 any
01160  * svn:date on the transaction will be become the unversioned property
01161  * svn:date on the revision.  svn:date can have any value, it does not
01162  * have to be a timestamp.  If the transaction has no svn:date the
01163  * revision will have no svn:date.
01164  *
01165  * If #SVN_FS_TXN_CLIENT_DATE was not passed to #svn_fs_begin_txn2 the
01166  * new revision will have svn:date set to the current time at some
01167  * point during the commit and any svn:date on the transaction will be
01168  * lost.
01169  *
01170  * If @a conflict_p is non-zero, use it to provide details on any
01171  * conflicts encountered merging @a txn with the most recent committed
01172  * revisions.  If a conflict occurs, set @a *conflict_p to the path of
01173  * the conflict in @a txn, allocated within @a pool;
01174  * otherwise, set @a *conflict_p to NULL.
01175  *
01176  * If the commit succeeds, @a txn is invalid.
01177  *
01178  * If the commit fails for any reason, @a *new_rev is an invalid
01179  * revision number, an error other than #SVN_NO_ERROR is returned and
01180  * @a txn is still valid; you can make more operations to resolve the
01181  * conflict, or call svn_fs_abort_txn() to abort the transaction.
01182  *
01183  * @note Success or failure of the commit of @a txn is determined by
01184  * examining the value of @a *new_rev upon this function's return.  If
01185  * the value is a valid revision number, the commit was successful,
01186  * even though a non-@c NULL function return value may indicate that
01187  * something else went wrong in post commit FS processing.
01188  *
01189  * @note See api-errata/1.8/fs001.txt for information on how this
01190  * function was documented in versions prior to 1.8.
01191  *
01192  * ### need to document this better. there are four combinations of
01193  * ### return values:
01194  * ### 1) err=NULL. conflict=NULL. new_rev is valid
01195  * ### 2) err=SVN_ERR_FS_CONFLICT. conflict is set. new_rev=SVN_INVALID_REVNUM
01196  * ### 3) err=!NULL. conflict=NULL. new_rev is valid
01197  * ### 4) err=!NULL. conflict=NULL. new_rev=SVN_INVALID_REVNUM
01198  * ###
01199  * ### some invariants:
01200  * ###   *conflict_p will be non-NULL IFF SVN_ERR_FS_CONFLICT
01201  * ###   if *conflict_p is set (and SVN_ERR_FS_CONFLICT), then new_rev
01202  * ###     will always be SVN_INVALID_REVNUM
01203  * ###   *conflict_p will always be initialized to NULL, or to a valid
01204  * ###     conflict string
01205  * ###   *new_rev will always be initialized to SVN_INVALID_REVNUM, or
01206  * ###     to a valid, committed revision number
01207  *
01208  */
01209 svn_error_t *
01210 svn_fs_commit_txn(const char **conflict_p,
01211                   svn_revnum_t *new_rev,
01212                   svn_fs_txn_t *txn,
01213                   apr_pool_t *pool);
01214 
01215 
01216 /** Abort the transaction @a txn.  Any changes made in @a txn are
01217  * discarded, and the filesystem is left unchanged.  Use @a pool for
01218  * any necessary allocations.
01219  *
01220  * @note This function first sets the state of @a txn to "dead", and
01221  * then attempts to purge it and any related data from the filesystem.
01222  * If some part of the cleanup process fails, @a txn and some portion
01223  * of its data may remain in the database after this function returns.
01224  * Use svn_fs_purge_txn() to retry the transaction cleanup.
01225  */
01226 svn_error_t *
01227 svn_fs_abort_txn(svn_fs_txn_t *txn,
01228                  apr_pool_t *pool);
01229 
01230 
01231 /** Cleanup the dead transaction in @a fs whose ID is @a txn_id.  Use
01232  * @a pool for all allocations.  If the transaction is not yet dead,
01233  * the error #SVN_ERR_FS_TRANSACTION_NOT_DEAD is returned.  (The
01234  * caller probably forgot to abort the transaction, or the cleanup
01235  * step of that abort failed for some reason.)
01236  */
01237 svn_error_t *
01238 svn_fs_purge_txn(svn_fs_t *fs,
01239                  const char *txn_id,
01240                  apr_pool_t *pool);
01241 
01242 
01243 /** Set @a *name_p to the name of the transaction @a txn, as a
01244  * NULL-terminated string.  Allocate the name in @a pool.
01245  */
01246 svn_error_t *
01247 svn_fs_txn_name(const char **name_p,
01248                 svn_fs_txn_t *txn,
01249                 apr_pool_t *pool);
01250 
01251 /** Return @a txn's base revision. */
01252 svn_revnum_t
01253 svn_fs_txn_base_revision(svn_fs_txn_t *txn);
01254 
01255 
01256 
01257 /** Open the transaction named @a name in the filesystem @a fs.  Set @a *txn
01258  * to the transaction.
01259  *
01260  * If there is no such transaction, #SVN_ERR_FS_NO_SUCH_TRANSACTION is
01261  * the error returned.
01262  *
01263  * Allocate the new transaction in @a pool; when @a pool is freed, the new
01264  * transaction will be closed (neither committed nor aborted).
01265  */
01266 svn_error_t *
01267 svn_fs_open_txn(svn_fs_txn_t **txn,
01268                 svn_fs_t *fs,
01269                 const char *name,
01270                 apr_pool_t *pool);
01271 
01272 
01273 /** Set @a *names_p to an array of <tt>const char *</tt> ids which are the
01274  * names of all the currently active transactions in the filesystem @a fs.
01275  * Allocate the array in @a pool.
01276  */
01277 svn_error_t *
01278 svn_fs_list_transactions(apr_array_header_t **names_p,
01279                          svn_fs_t *fs,
01280                          apr_pool_t *pool);
01281 
01282 /* Transaction properties */
01283 
01284 /** Set @a *value_p to the value of the property named @a propname on
01285  * transaction @a txn.  If @a txn has no property by that name, set
01286  * @a *value_p to zero.  Allocate the result in @a pool.
01287  */
01288 svn_error_t *
01289 svn_fs_txn_prop(svn_string_t **value_p,
01290                 svn_fs_txn_t *txn,
01291                 const char *propname,
01292                 apr_pool_t *pool);
01293 
01294 
01295 /** Set @a *table_p to the entire property list of transaction @a txn, as
01296  * an APR hash table allocated in @a pool.  The resulting table maps property
01297  * names to pointers to #svn_string_t objects containing the property value.
01298  */
01299 svn_error_t *
01300 svn_fs_txn_proplist(apr_hash_t **table_p,
01301                     svn_fs_txn_t *txn,
01302                     apr_pool_t *pool);
01303 
01304 
01305 /** Change a transactions @a txn's property's value, or add/delete a
01306  * property.  @a name is the name of the property to change, and @a value
01307  * is the new value of the property, or zero if the property should be
01308  * removed altogether.  Do any necessary temporary allocation in @a pool.
01309  */
01310 svn_error_t *
01311 svn_fs_change_txn_prop(svn_fs_txn_t *txn,
01312                        const char *name,
01313                        const svn_string_t *value,
01314                        apr_pool_t *pool);
01315 
01316 
01317 /** Change, add, and/or delete transaction property values in
01318  * transaction @a txn.  @a props is an array of <tt>svn_prop_t</tt>
01319  * elements.  This is equivalent to calling svn_fs_change_txn_prop()
01320  * multiple times with the @c name and @c value fields of each
01321  * successive <tt>svn_prop_t</tt>, but may be more efficient.
01322  * (Properties not mentioned are left alone.)  Do any necessary
01323  * temporary allocation in @a pool.
01324  *
01325  * @since New in 1.5.
01326  */
01327 svn_error_t *
01328 svn_fs_change_txn_props(svn_fs_txn_t *txn,
01329                         const apr_array_header_t *props,
01330                         apr_pool_t *pool);
01331 
01332 /** @} */
01333 
01334 
01335 /** Roots.
01336  *
01337  * An #svn_fs_root_t object represents the root directory of some
01338  * revision or transaction in a filesystem.  To refer to particular
01339  * node or node revision, you provide a root, and a directory path
01340  * relative to that root.
01341  *
01342  * @defgroup svn_fs_roots Filesystem roots
01343  * @{
01344  */
01345 
01346 /** The Filesystem Root object. */
01347 typedef struct svn_fs_root_t svn_fs_root_t;
01348 
01349 
01350 /** Set @a *root_p to the root directory of revision @a rev in filesystem @a fs.
01351  * Allocate @a *root_p in a private subpool of @a pool; the root can be
01352  * destroyed earlier than @a pool by calling #svn_fs_close_root.
01353  */
01354 svn_error_t *
01355 svn_fs_revision_root(svn_fs_root_t **root_p,
01356                      svn_fs_t *fs,
01357                      svn_revnum_t rev,
01358                      apr_pool_t *pool);
01359 
01360 
01361 /** Set @a *root_p to the root directory of @a txn.  Allocate @a *root_p in a
01362  * private subpool of @a pool; the root can be destroyed earlier than @a pool by
01363  * calling #svn_fs_close_root.
01364  */
01365 svn_error_t *
01366 svn_fs_txn_root(svn_fs_root_t **root_p,
01367                 svn_fs_txn_t *txn,
01368                 apr_pool_t *pool);
01369 
01370 
01371 /** Free the root directory @a root; this only needs to be used if you want to
01372  * free the memory associated with @a root earlier than the time you destroy
01373  * the pool passed to the function that created it (svn_fs_revision_root() or
01374  * svn_fs_txn_root()).
01375  */
01376 void
01377 svn_fs_close_root(svn_fs_root_t *root);
01378 
01379 
01380 /** Return the filesystem to which @a root belongs.  */
01381 svn_fs_t *
01382 svn_fs_root_fs(svn_fs_root_t *root);
01383 
01384 
01385 /** Return @c TRUE iff @a root is a transaction root.  */
01386 svn_boolean_t
01387 svn_fs_is_txn_root(svn_fs_root_t *root);
01388 
01389 /** Return @c TRUE iff @a root is a revision root.  */
01390 svn_boolean_t
01391 svn_fs_is_revision_root(svn_fs_root_t *root);
01392 
01393 
01394 /** If @a root is the root of a transaction, return the name of the
01395  * transaction, allocated in @a pool; otherwise, return NULL.
01396  */
01397 const char *
01398 svn_fs_txn_root_name(svn_fs_root_t *root,
01399                      apr_pool_t *pool);
01400 
01401 /** If @a root is the root of a transaction, return the number of the
01402  * revision on which is was based when created.  Otherwise, return
01403  * #SVN_INVALID_REVNUM.
01404  *
01405  * @since New in 1.5.
01406  */
01407 svn_revnum_t
01408 svn_fs_txn_root_base_revision(svn_fs_root_t *root);
01409 
01410 /** If @a root is the root of a revision, return the revision number.
01411  * Otherwise, return #SVN_INVALID_REVNUM.
01412  */
01413 svn_revnum_t
01414 svn_fs_revision_root_revision(svn_fs_root_t *root);
01415 
01416 /** @} */
01417 
01418 
01419 /** Directory entry names and directory paths.
01420  *
01421  * Here are the rules for directory entry names, and directory paths:
01422  *
01423  * A directory entry name is a Unicode string encoded in UTF-8, and
01424  * may not contain the NULL character (U+0000).  The name should be in
01425  * Unicode canonical decomposition and ordering.  No directory entry
01426  * may be named '.', '..', or the empty string.  Given a directory
01427  * entry name which fails to meet these requirements, a filesystem
01428  * function returns an SVN_ERR_FS_PATH_SYNTAX error.
01429  *
01430  * A directory path is a sequence of zero or more directory entry
01431  * names, separated by slash characters (U+002f), and possibly ending
01432  * with slash characters.  Sequences of two or more consecutive slash
01433  * characters are treated as if they were a single slash.  If a path
01434  * ends with a slash, it refers to the same node it would without the
01435  * slash, but that node must be a directory, or else the function
01436  * returns an SVN_ERR_FS_NOT_DIRECTORY error.
01437  *
01438  * A path consisting of the empty string, or a string containing only
01439  * slashes, refers to the root directory.
01440  *
01441  * @defgroup svn_fs_directories Filesystem directories
01442  * @{
01443  */
01444 
01445 
01446 
01447 /** The kind of change that occurred on the path. */
01448 typedef enum svn_fs_path_change_kind_t
01449 {
01450   /** path modified in txn */
01451   svn_fs_path_change_modify = 0,
01452 
01453   /** path added in txn */
01454   svn_fs_path_change_add,
01455 
01456   /** path removed in txn */
01457   svn_fs_path_change_delete,
01458 
01459   /** path removed and re-added in txn */
01460   svn_fs_path_change_replace,
01461 
01462   /** ignore all previous change items for path (internal-use only) */
01463   svn_fs_path_change_reset
01464 } svn_fs_path_change_kind_t;
01465 
01466 /** Change descriptor.
01467  *
01468  * @note Fields may be added to the end of this structure in future
01469  * versions.  Therefore, to preserve binary compatibility, users
01470  * should not directly allocate structures of this type.
01471  *
01472  * @note The @c text_mod, @c prop_mod and @c mergeinfo_mod flags mean the
01473  * text, properties and mergeinfo property (respectively) were "touched"
01474  * by the commit API; this does not mean the new value is different from
01475  * the old value.
01476  *
01477  * @since New in 1.6. */
01478 typedef struct svn_fs_path_change2_t
01479 {
01480   /** node revision id of changed path */
01481   const svn_fs_id_t *node_rev_id;
01482 
01483   /** kind of change */
01484   svn_fs_path_change_kind_t change_kind;
01485 
01486   /** was the text touched?
01487    * For node_kind=dir: always false. For node_kind=file:
01488    *   modify:      true iff text touched.
01489    *   add (copy):  true iff text touched.
01490    *   add (plain): always true.
01491    *   delete:      always false.
01492    *   replace:     as for the add/copy part of the replacement.
01493    */
01494   svn_boolean_t text_mod;
01495 
01496   /** were the properties touched?
01497    *   modify:      true iff props touched.
01498    *   add (copy):  true iff props touched.
01499    *   add (plain): true iff props touched.
01500    *   delete:      always false.
01501    *   replace:     as for the add/copy part of the replacement.
01502    */
01503   svn_boolean_t prop_mod;
01504 
01505   /** what node kind is the path?
01506       (Note: it is legal for this to be #svn_node_unknown.) */
01507   svn_node_kind_t node_kind;
01508 
01509   /** Copyfrom revision and path; this is only valid if copyfrom_known
01510    * is true. */
01511   svn_boolean_t copyfrom_known;
01512   svn_revnum_t copyfrom_rev;
01513   const char *copyfrom_path;
01514 
01515   /** was the mergeinfo property touched?
01516    *   modify:      } true iff svn:mergeinfo property add/del/mod
01517    *   add (copy):  }          and fs format supports this flag.
01518    *   add (plain): }
01519    *   delete:      always false.
01520    *   replace:     as for the add/copy part of the replacement.
01521    * (Note: Pre-1.9 repositories will report #svn_tristate_unknown.)
01522    * @since New in 1.9. */
01523   svn_tristate_t mergeinfo_mod;
01524   /* NOTE! Please update svn_fs_path_change2_create() when adding new
01525      fields here. */
01526 } svn_fs_path_change2_t;
01527 
01528 
01529 /** Similar to #svn_fs_path_change2_t, but without kind and copyfrom
01530  * information.
01531  *
01532  * @deprecated Provided for backwards compatibility with the 1.5 API.
01533  */
01534 
01535 typedef struct svn_fs_path_change_t
01536 {
01537   /** node revision id of changed path */
01538   const svn_fs_id_t *node_rev_id;
01539 
01540   /** kind of change */
01541   svn_fs_path_change_kind_t change_kind;
01542 
01543   /** were there text mods? */
01544   svn_boolean_t text_mod;
01545 
01546   /** were there property mods? */
01547   svn_boolean_t prop_mod;
01548 
01549 } svn_fs_path_change_t;
01550 
01551 /**
01552  * Allocate an #svn_fs_path_change2_t structure in @a pool, initialize and
01553  * return it.
01554  *
01555  * Set the @c node_rev_id field of the created struct to @a node_rev_id, and
01556  * @c change_kind to @a change_kind.  Set all other fields to their
01557  * @c _unknown, @c NULL or invalid value, respectively.
01558  *
01559  * @since New in 1.6.
01560  */
01561 svn_fs_path_change2_t *
01562 svn_fs_path_change2_create(const svn_fs_id_t *node_rev_id,
01563                            svn_fs_path_change_kind_t change_kind,
01564                            apr_pool_t *pool);
01565 
01566 /** Determine what has changed under a @a root.
01567  *
01568  * Allocate and return a hash @a *changed_paths2_p containing descriptions
01569  * of the paths changed under @a root.  The hash is keyed with
01570  * <tt>const char *</tt> paths, and has #svn_fs_path_change2_t * values.
01571  *
01572  * Callers can assume that this function takes time proportional to
01573  * the amount of data output, and does not need to do tree crawls;
01574  * however, it is possible that some of the @c node_kind fields in the
01575  * #svn_fs_path_change2_t * values will be #svn_node_unknown or
01576  * that and some of the @c copyfrom_known fields will be FALSE.
01577  *
01578  * Use @a pool for all allocations, including the hash and its values.
01579  *
01580  * @since New in 1.6.
01581  */
01582 svn_error_t *
01583 svn_fs_paths_changed2(apr_hash_t **changed_paths2_p,
01584                       svn_fs_root_t *root,
01585                       apr_pool_t *pool);
01586 
01587 
01588 /** Same as svn_fs_paths_changed2(), only with #svn_fs_path_change_t * values
01589  * in the hash (and thus no kind or copyfrom data).
01590  *
01591  * @deprecated Provided for backward compatibility with the 1.5 API.
01592  */
01593 SVN_DEPRECATED
01594 svn_error_t *
01595 svn_fs_paths_changed(apr_hash_t **changed_paths_p,
01596                      svn_fs_root_t *root,
01597                      apr_pool_t *pool);
01598 
01599 /** @} */
01600 
01601 
01602 /* Operations appropriate to all kinds of nodes.  */
01603 
01604 /** Set @a *kind_p to the type of node present at @a path under @a
01605  * root.  If @a path does not exist under @a root, set @a *kind_p to
01606  * #svn_node_none.  Use @a pool for temporary allocation.
01607  */
01608 svn_error_t *
01609 svn_fs_check_path(svn_node_kind_t *kind_p,
01610                   svn_fs_root_t *root,
01611                   const char *path,
01612                   apr_pool_t *pool);
01613 
01614 
01615 /** An opaque node history object. */
01616 typedef struct svn_fs_history_t svn_fs_history_t;
01617 
01618 
01619 /** Set @a *history_p to an opaque node history object which
01620  * represents @a path under @a root.  @a root must be a revision root.
01621  * Allocate the result in @a result_pool and use @a scratch_pool for
01622  * temporary allocations.
01623  *
01624  * @since New in 1.9.
01625  */
01626 svn_error_t *
01627 svn_fs_node_history2(svn_fs_history_t **history_p,
01628                      svn_fs_root_t *root,
01629                      const char *path,
01630                      apr_pool_t *result_pool,
01631                      apr_pool_t *scratch_pool);
01632 
01633 /** Same as svn_fs_node_history2() but using a single @a pool for all
01634  * allocations.
01635  *
01636  * @deprecated Provided for backward compatibility with the 1.8 API.
01637  */
01638 SVN_DEPRECATED
01639 svn_error_t *
01640 svn_fs_node_history(svn_fs_history_t **history_p,
01641                     svn_fs_root_t *root,
01642                     const char *path,
01643                     apr_pool_t *pool);
01644 
01645 
01646 /** Set @a *prev_history_p to an opaque node history object which
01647  * represents the previous (or "next oldest") interesting history
01648  * location for the filesystem node represented by @a history, or @c
01649  * NULL if no such previous history exists.  If @a cross_copies is @c
01650  * FALSE, also return @c NULL if stepping backwards in history to @a
01651  * *prev_history_p would cross a filesystem copy operation.
01652  *
01653  * @note If this is the first call to svn_fs_history_prev() for the @a
01654  * history object, it could return a history object whose location is
01655  * the same as the original.  This will happen if the original
01656  * location was an interesting one (where the node was modified, or
01657  * took place in a copy event).  This behavior allows looping callers
01658  * to avoid the calling svn_fs_history_location() on the object
01659  * returned by svn_fs_node_history(), and instead go ahead and begin
01660  * calling svn_fs_history_prev().
01661  *
01662  * @note This function uses node-id ancestry alone to determine
01663  * modifiedness, and therefore does NOT claim that in any of the
01664  * returned revisions file contents changed, properties changed,
01665  * directory entries lists changed, etc.
01666  *
01667  * @note The revisions returned for @a path will be older than or
01668  * the same age as the revision of that path in @a root.  That is, if
01669  * @a root is a revision root based on revision X, and @a path was
01670  * modified in some revision(s) younger than X, those revisions
01671  * younger than X will not be included for @a path.
01672  *
01673  * Allocate the result in @a result_pool and use @a scratch_pool for
01674  * temporary allocations.
01675  *
01676  * @since New in 1.9. */
01677 svn_error_t *
01678 svn_fs_history_prev2(svn_fs_history_t **prev_history_p,
01679                      svn_fs_history_t *history,
01680                      svn_boolean_t cross_copies,
01681                      apr_pool_t *result_pool,
01682                      apr_pool_t *scratch_pool);
01683 
01684 /** Same as svn_fs_history_prev2() but using a single @a pool for all
01685  * allocations.
01686  *
01687  * @deprecated Provided for backward compatibility with the 1.8 API.
01688  */
01689 SVN_DEPRECATED
01690 svn_error_t *
01691 svn_fs_history_prev(svn_fs_history_t **prev_history_p,
01692                     svn_fs_history_t *history,
01693                     svn_boolean_t cross_copies,
01694                     apr_pool_t *pool);
01695 
01696 
01697 /** Set @a *path and @a *revision to the path and revision,
01698  * respectively, of the @a history object.  Use @a pool for all
01699  * allocations.
01700  */
01701 svn_error_t *
01702 svn_fs_history_location(const char **path,
01703                         svn_revnum_t *revision,
01704                         svn_fs_history_t *history,
01705                         apr_pool_t *pool);
01706 
01707 
01708 /** Set @a *is_dir to @c TRUE iff @a path in @a root is a directory.
01709  * Do any necessary temporary allocation in @a pool.
01710  */
01711 svn_error_t *
01712 svn_fs_is_dir(svn_boolean_t *is_dir,
01713               svn_fs_root_t *root,
01714               const char *path,
01715               apr_pool_t *pool);
01716 
01717 
01718 /** Set @a *is_file to @c TRUE iff @a path in @a root is a file.
01719  * Do any necessary temporary allocation in @a pool.
01720  */
01721 svn_error_t *
01722 svn_fs_is_file(svn_boolean_t *is_file,
01723                svn_fs_root_t *root,
01724                const char *path,
01725                apr_pool_t *pool);
01726 
01727 
01728 /** Get the id of a node.
01729  *
01730  * Set @a *id_p to the node revision ID of @a path in @a root, allocated in
01731  * @a pool.
01732  *
01733  * If @a root is the root of a transaction, keep in mind that other
01734  * changes to the transaction can change which node @a path refers to,
01735  * and even whether the path exists at all.
01736  */
01737 svn_error_t *
01738 svn_fs_node_id(const svn_fs_id_t **id_p,
01739                svn_fs_root_t *root,
01740                const char *path,
01741                apr_pool_t *pool);
01742 
01743 /** Determine how @a path_a under @a root_a and @a path_b under @a root_b
01744  * are related and return the result in @a relation.  There is no restriction
01745  * concerning the roots: They may refer to different repositories, be in
01746  * arbitrary revision order and any of them may pertain to a transaction.
01747  * @a scratch_pool is used for temporary allocations.
01748  *
01749  * @note Paths from different svn_fs_t will be reported as unrelated even
01750  * if the underlying physical repository is the same.
01751  *
01752  * @since New in 1.9.
01753  */
01754 svn_error_t *
01755 svn_fs_node_relation(svn_fs_node_relation_t *relation,
01756                      svn_fs_root_t *root_a,
01757                      const char *path_a,
01758                      svn_fs_root_t *root_b,
01759                      const char *path_b,
01760                      apr_pool_t *scratch_pool);
01761 
01762 /** Set @a *revision to the revision in which the node-revision identified
01763  * by @a path under @a root was created; that is, to the revision in which
01764  * @a path under @a root was last modified.  @a *revision will
01765  * be set to #SVN_INVALID_REVNUM for uncommitted nodes (i.e. modified nodes
01766  * under a transaction root).  Note that the root of an unmodified transaction
01767  * is not itself considered to be modified; in that case, return the revision
01768  * upon which the transaction was based.
01769  *
01770  * Use @a pool for any temporary allocations.
01771  */
01772 svn_error_t *
01773 svn_fs_node_created_rev(svn_revnum_t *revision,
01774                         svn_fs_root_t *root,
01775                         const char *path,
01776                         apr_pool_t *pool);
01777 
01778 /** Set @a *revision to the revision in which the line of history
01779  * represented by @a path under @a root originated.  Use @a pool for
01780  * any temporary allocations.  If @a root is a transaction root, @a
01781  * *revision will be set to #SVN_INVALID_REVNUM for any nodes newly
01782  * added in that transaction (brand new files or directories created
01783  * using #svn_fs_make_dir or #svn_fs_make_file).
01784  *
01785  * @since New in 1.5.
01786  */
01787 svn_error_t *
01788 svn_fs_node_origin_rev(svn_revnum_t *revision,
01789                        svn_fs_root_t *root,
01790                        const char *path,
01791                        apr_pool_t *pool);
01792 
01793 /** Set @a *created_path to the path at which @a path under @a root was
01794  * created.  Use @a pool for all allocations.  Callers may use this
01795  * function in conjunction with svn_fs_node_created_rev() to perform a
01796  * reverse lookup of the mapping of (path, revision) -> node-id that
01797  * svn_fs_node_id() performs.
01798  */
01799 svn_error_t *
01800 svn_fs_node_created_path(const char **created_path,
01801                          svn_fs_root_t *root,
01802                          const char *path,
01803                          apr_pool_t *pool);
01804 
01805 
01806 /** Set @a *value_p to the value of the property named @a propname of
01807  * @a path in @a root.  If the node has no property by that name, set
01808  * @a *value_p to zero.  Allocate the result in @a pool.
01809  */
01810 svn_error_t *
01811 svn_fs_node_prop(svn_string_t **value_p,
01812                  svn_fs_root_t *root,
01813                  const char *path,
01814                  const char *propname,
01815                  apr_pool_t *pool);
01816 
01817 
01818 /** Set @a *table_p to the entire property list of @a path in @a root,
01819  * as an APR hash table allocated in @a pool.  The resulting table maps
01820  * property names to pointers to #svn_string_t objects containing the
01821  * property value.
01822  */
01823 svn_error_t *
01824 svn_fs_node_proplist(apr_hash_t **table_p,
01825                      svn_fs_root_t *root,
01826                      const char *path,
01827                      apr_pool_t *pool);
01828 
01829 /** Set @a *has_props to TRUE if the node @a path in @a root has properties
01830  * and to FALSE if it doesn't have properties. Perform temporary allocations
01831  * in @a scratch_pool.
01832  *
01833  * @since New in 1.9.
01834  */
01835 svn_error_t *
01836 svn_fs_node_has_props(svn_boolean_t *has_props,
01837                       svn_fs_root_t *root,
01838                       const char *path,
01839                       apr_pool_t *scratch_pool);
01840 
01841 
01842 /** Change a node's property's value, or add/delete a property.
01843  *
01844  * - @a root and @a path indicate the node whose property should change.
01845  *   @a root must be the root of a transaction, not the root of a revision.
01846  * - @a name is the name of the property to change.
01847  * - @a value is the new value of the property, or zero if the property should
01848  *   be removed altogether.
01849  * Do any necessary temporary allocation in @a pool.
01850  */
01851 svn_error_t *
01852 svn_fs_change_node_prop(svn_fs_root_t *root,
01853                         const char *path,
01854                         const char *name,
01855                         const svn_string_t *value,
01856                         apr_pool_t *pool);
01857 
01858 
01859 /** Determine if the properties of two path/root combinations are different.
01860  *
01861  * Set @a *different_p to #TRUE if the properties at @a path1 under @a root1
01862  * differ from those at @a path2 under @a root2, or set it to #FALSE if they
01863  * are the same.  Both paths must exist under their respective roots, and
01864  * both roots must be in the same filesystem.
01865  * Do any necessary temporary allocation in @a scratch_pool.
01866  *
01867  * @note For the purposes of preserving accurate history, certain bits of
01868  * code (such as the repository dump code) need to care about the distinction
01869  * between situations when the properties are "different" and "have changed
01870  * across two points in history".  We have a pair of functions that can
01871  * answer both of these questions, svn_fs_props_different() and
01872  * svn_fs_props_changed().  See issue 4598 for more details.
01873  *
01874  * @see svn_fs_props_changed
01875  *
01876  * @since New in 1.9.
01877  */
01878 svn_error_t *
01879 svn_fs_props_different(svn_boolean_t *different_p,
01880                        svn_fs_root_t *root1,
01881                        const char *path1,
01882                        svn_fs_root_t *root2,
01883                        const char *path2,
01884                        apr_pool_t *scratch_pool);
01885 
01886 
01887 /** Determine if the properties of two path/root combinations have changed.
01888  *
01889  * Set @a *changed_p to #TRUE if the properties at @a path1 under @a root1
01890  * differ from those at @a path2 under @a root2, or set it to #FALSE if they
01891  * are the same.  Both paths must exist under their respective roots, and
01892  * both roots must be in the same filesystem.
01893  * Do any necessary temporary allocation in @a pool.
01894  *
01895  * @note For the purposes of preserving accurate history, certain bits of
01896  * code (such as the repository dump code) need to care about the distinction
01897  * between situations when the properties are "different" and "have changed
01898  * across two points in history".  We have a pair of functions that can
01899  * answer both of these questions, svn_fs_props_different() and
01900  * svn_fs_props_changed().  See issue 4598 for more details.
01901  *
01902  * @note This function can currently return false negatives for FSFS:
01903  * If @a root1 and @a root2 were both transaction roots and the proplists
01904  * of both paths had been changed in their respective transactions,
01905  * @a changed_p would be set to #FALSE.
01906  *
01907  * @see svn_fs_props_different
01908  */
01909 svn_error_t *
01910 svn_fs_props_changed(svn_boolean_t *changed_p,
01911                      svn_fs_root_t *root1,
01912                      const char *path1,
01913                      svn_fs_root_t *root2,
01914                      const char *path2,
01915                      apr_pool_t *pool);
01916 
01917 
01918 /** Discover a node's copy ancestry, if any.
01919  *
01920  * If the node at @a path in @a root was copied from some other node, set
01921  * @a *rev_p and @a *path_p to the revision and path (expressed as an
01922  * absolute filesystem path) of the other node, allocating @a *path_p
01923  * in @a pool.
01924  *
01925  * Else if there is no copy ancestry for the node, set @a *rev_p to
01926  * #SVN_INVALID_REVNUM and @a *path_p to NULL.
01927  *
01928  * If an error is returned, the values of @a *rev_p and @a *path_p are
01929  * undefined, but otherwise, if one of them is set as described above,
01930  * you may assume the other is set correspondingly.
01931  *
01932  * @a root may be a revision root or a transaction root.
01933  *
01934  * Notes:
01935  *    - Copy ancestry does not descend.  After copying directory D to
01936  *      E, E will have copy ancestry referring to D, but E's children
01937  *      may not.  See also svn_fs_copy().
01938  *
01939  *    - Copy ancestry *under* a copy is preserved.  That is, if you
01940  *      copy /A/D/G/pi to /A/D/G/pi2, and then copy /A/D/G to /G, then
01941  *      /G/pi2 will still have copy ancestry pointing to /A/D/G/pi.
01942  *      We don't know if this is a feature or a bug yet; if it turns
01943  *      out to be a bug, then the fix is to make svn_fs_copied_from()
01944  *      observe the following logic, which currently callers may
01945  *      choose to follow themselves: if node X has copy history, but
01946  *      its ancestor A also has copy history, then you may ignore X's
01947  *      history if X's revision-of-origin is earlier than A's --
01948  *      because that would mean that X's copy history was preserved in
01949  *      a copy-under-a-copy scenario.  If X's revision-of-origin is
01950  *      the same as A's, then it was copied under A during the same
01951  *      transaction that created A.  (X's revision-of-origin cannot be
01952  *      greater than A's, if X has copy history.)  @todo See how
01953  *      people like this, it can always be hidden behind the curtain
01954  *      if necessary.
01955  *
01956  *    - Copy ancestry is not stored as a regular subversion property
01957  *      because it is not inherited.  Copying foo to bar results in a
01958  *      revision of bar with copy ancestry; but committing a text
01959  *      change to bar right after that results in a new revision of
01960  *      bar without copy ancestry.
01961  */
01962 svn_error_t *
01963 svn_fs_copied_from(svn_revnum_t *rev_p,
01964                    const char **path_p,
01965                    svn_fs_root_t *root,
01966                    const char *path,
01967                    apr_pool_t *pool);
01968 
01969 
01970 /** Set @a *root_p and @a *path_p to the revision root and path of the
01971  * destination of the most recent copy event that caused @a path to
01972  * exist where it does in @a root, or to NULL if no such copy exists.
01973  *
01974  * @a *path_p might be a parent of @a path, rather than @a path
01975  * itself.  However, it will always be the deepest relevant path.
01976  * That is, if a copy occurs underneath another copy in the same txn,
01977  * this function makes sure to set @a *path_p to the longest copy
01978  * destination path that is still a parent of or equal to @a path.
01979  *
01980  * Values returned in @a *root_p and @a *path_p will be allocated
01981  * from @a pool.
01982  *
01983  * @since New in 1.3.
01984  */
01985 svn_error_t *
01986 svn_fs_closest_copy(svn_fs_root_t **root_p,
01987                     const char **path_p,
01988                     svn_fs_root_t *root,
01989                     const char *path,
01990                     apr_pool_t *pool);
01991 
01992 
01993 /** Retrieve mergeinfo for multiple nodes.
01994  *
01995  * @a *catalog is a catalog for @a paths.  It will never be @c NULL,
01996  * but may be empty.
01997  *
01998  * @a root is revision root to use when looking up paths.
01999  *
02000  * @a paths are the paths you are requesting information for.
02001  *
02002  * @a inherit indicates whether to retrieve explicit,
02003  * explicit-or-inherited, or only inherited mergeinfo.
02004  *
02005  * If @a adjust_inherited_mergeinfo is @c TRUE, then any inherited
02006  * mergeinfo returned in @a *catalog is normalized to represent the
02007  * inherited mergeinfo on the path which inherits it.  This adjusted
02008  * mergeinfo is keyed by the path which inherits it.  If
02009  * @a adjust_inherited_mergeinfo is @c FALSE, then any inherited
02010  * mergeinfo is the raw explicit mergeinfo from the nearest parent
02011  * of the path with explicit mergeinfo, unadjusted for the path-wise
02012  * difference between the path and its parent.  This may include
02013  * non-inheritable mergeinfo.  This unadjusted mergeinfo is keyed by
02014  * the path at which it was found.
02015  *
02016  * If @a include_descendants is TRUE, then additionally return the
02017  * mergeinfo for any descendant of any element of @a paths which has
02018  * the #SVN_PROP_MERGEINFO property explicitly set on it.  (Note
02019  * that inheritance is only taken into account for the elements in @a
02020  * paths; descendants of the elements in @a paths which get their
02021  * mergeinfo via inheritance are not included in @a *catalog.)
02022  *
02023  * Allocate @a *catalog in result_pool.  Do any necessary temporary
02024  * allocations in @a scratch_pool.
02025  *
02026  * @since New in 1.8.
02027  */
02028 svn_error_t *
02029 svn_fs_get_mergeinfo2(svn_mergeinfo_catalog_t *catalog,
02030                       svn_fs_root_t *root,
02031                       const apr_array_header_t *paths,
02032                       svn_mergeinfo_inheritance_t inherit,
02033                       svn_boolean_t include_descendants,
02034                       svn_boolean_t adjust_inherited_mergeinfo,
02035                       apr_pool_t *result_pool,
02036                       apr_pool_t *scratch_pool);
02037 
02038 /**
02039  * Same as svn_fs_get_mergeinfo2(), but with @a adjust_inherited_mergeinfo
02040  * set always set to @c TRUE and with only one pool.
02041  *
02042  * @deprecated Provided for backward compatibility with the 1.5 API.
02043  */
02044 SVN_DEPRECATED
02045 svn_error_t *
02046 svn_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
02047                      svn_fs_root_t *root,
02048                      const apr_array_header_t *paths,
02049                      svn_mergeinfo_inheritance_t inherit,
02050                      svn_boolean_t include_descendants,
02051                      apr_pool_t *pool);
02052 
02053 /** Merge changes between two nodes into a third node.
02054  *
02055  * Given nodes @a source and @a target, and a common ancestor @a ancestor,
02056  * modify @a target to contain all the changes made between @a ancestor and
02057  * @a source, as well as the changes made between @a ancestor and @a target.
02058  * @a target_root must be the root of a transaction, not a revision.
02059  *
02060  * @a source, @a target, and @a ancestor are generally directories; this
02061  * function recursively merges the directories' contents.  If they are
02062  * files, this function simply returns an error whenever @a source,
02063  * @a target, and @a ancestor are all distinct node revisions.
02064  *
02065  * If there are differences between @a ancestor and @a source that conflict
02066  * with changes between @a ancestor and @a target, this function returns an
02067  * #SVN_ERR_FS_CONFLICT error.
02068  *
02069  * If the merge is successful, @a target is left in the merged state, and
02070  * the base root of @a target's txn is set to the root node of @a source.
02071  * If an error is returned (whether for conflict or otherwise), @a target
02072  * is left unaffected.
02073  *
02074  * If @a conflict_p is non-NULL, then: a conflict error sets @a *conflict_p
02075  * to the name of the node in @a target which couldn't be merged,
02076  * otherwise, success sets @a *conflict_p to NULL.
02077  *
02078  * Do any necessary temporary allocation in @a pool.
02079  */
02080 svn_error_t *
02081 svn_fs_merge(const char **conflict_p,
02082              svn_fs_root_t *source_root,
02083              const char *source_path,
02084              svn_fs_root_t *target_root,
02085              const char *target_path,
02086              svn_fs_root_t *ancestor_root,
02087              const char *ancestor_path,
02088              apr_pool_t *pool);
02089 
02090 
02091 
02092 /* Directories.  */
02093 
02094 
02095 /** The type of a Subversion directory entry.  */
02096 typedef struct svn_fs_dirent_t
02097 {
02098 
02099   /** The name of this directory entry.  */
02100   const char *name;
02101 
02102   /** The node revision ID it names.  */
02103   const svn_fs_id_t *id;
02104 
02105   /** The node kind. */
02106   svn_node_kind_t kind;
02107 
02108 } svn_fs_dirent_t;
02109 
02110 
02111 /** Set @a *entries_p to a newly allocated APR hash table containing the
02112  * entries of the directory at @a path in @a root.  The keys of the table
02113  * are entry names, as byte strings, excluding the final NULL
02114  * character; the table's values are pointers to #svn_fs_dirent_t
02115  * structures.  Allocate the table and its contents in @a pool.
02116  */
02117 svn_error_t *
02118 svn_fs_dir_entries(apr_hash_t **entries_p,
02119                    svn_fs_root_t *root,
02120                    const char *path,
02121                    apr_pool_t *pool);
02122 
02123 /** Take the #svn_fs_dirent_t structures in @a entries as returned by
02124  * #svn_fs_dir_entries for @a root and determine an optimized ordering
02125  * in which data access would most likely be efficient.  Set @a *ordered_p
02126  * to a newly allocated APR array of pointers to these #svn_fs_dirent_t
02127  * structures.  Allocate the array (but not its contents) in @a result_pool
02128  * and use @a scratch_pool for temporaries.
02129  *
02130  * @since New in 1.9.
02131  */
02132 svn_error_t *
02133 svn_fs_dir_optimal_order(apr_array_header_t **ordered_p,
02134                          svn_fs_root_t *root,
02135                          apr_hash_t *entries,
02136                          apr_pool_t *result_pool,
02137                          apr_pool_t *scratch_pool);
02138 
02139 /** Create a new directory named @a path in @a root.  The new directory has
02140  * no entries, and no properties.  @a root must be the root of a transaction,
02141  * not a revision.
02142  *
02143  * Do any necessary temporary allocation in @a pool.
02144  */
02145 svn_error_t *
02146 svn_fs_make_dir(svn_fs_root_t *root,
02147                 const char *path,
02148                 apr_pool_t *pool);
02149 
02150 
02151 /** Delete the node named @a path in @a root.  If the node being deleted is
02152  * a directory, its contents will be deleted recursively.  @a root must be
02153  * the root of a transaction, not of a revision.  Use @a pool for
02154  * temporary allocation.
02155  *
02156  * If return #SVN_ERR_FS_NO_SUCH_ENTRY, then the basename of @a path is
02157  * missing from its parent, that is, the final target of the deletion
02158  * is missing.
02159  *
02160  * Attempting to remove the root dir also results in an error,
02161  * #SVN_ERR_FS_ROOT_DIR, even if the dir is empty.
02162  */
02163 svn_error_t *
02164 svn_fs_delete(svn_fs_root_t *root,
02165               const char *path,
02166               apr_pool_t *pool);
02167 
02168 
02169 /** Create a copy of @a from_path in @a from_root named @a to_path in
02170  * @a to_root.  If @a from_path in @a from_root is a directory, copy the
02171  * tree it refers to recursively.
02172  *
02173  * The copy will remember its source; use svn_fs_copied_from() to
02174  * access this information.
02175  *
02176  * @a to_root must be the root of a transaction; @a from_root must be the
02177  * root of a revision.  (Requiring @a from_root to be the root of a
02178  * revision makes the implementation trivial: there is no detectable
02179  * difference (modulo node revision ID's) between copying @a from and
02180  * simply adding a reference to it.  So the operation takes place in
02181  * constant time.  However, there's no reason not to extend this to
02182  * mutable nodes --- it's just more code.)  Further, @a to_root and @a
02183  * from_root must represent the same filesystem.
02184  *
02185  * @note To do a copy without preserving copy history, use
02186  * svn_fs_revision_link().
02187  *
02188  * Do any necessary temporary allocation in @a pool.
02189  */
02190 svn_error_t *
02191 svn_fs_copy(svn_fs_root_t *from_root,
02192             const char *from_path,
02193             svn_fs_root_t *to_root,
02194             const char *to_path,
02195             apr_pool_t *pool);
02196 
02197 
02198 /** Like svn_fs_copy(), but doesn't record copy history, and preserves
02199  * the PATH.  You cannot use svn_fs_copied_from() later to find out
02200  * where this copy came from.
02201  *
02202  * Use svn_fs_revision_link() in situations where you don't care
02203  * about the copy history, and where @a to_path and @a from_path are
02204  * the same, because it is cheaper than svn_fs_copy().
02205  */
02206 svn_error_t *
02207 svn_fs_revision_link(svn_fs_root_t *from_root,
02208                      svn_fs_root_t *to_root,
02209                      const char *path,
02210                      apr_pool_t *pool);
02211 
02212 
02213 /* Files.  */
02214 
02215 /** Set @a *length_p to the length of the file @a path in @a root, in bytes.
02216  * Do any necessary temporary allocation in @a pool.
02217  */
02218 svn_error_t *
02219 svn_fs_file_length(svn_filesize_t *length_p,
02220                    svn_fs_root_t *root,
02221                    const char *path,
02222                    apr_pool_t *pool);
02223 
02224 
02225 /** Set @a *checksum to the checksum of type @a kind for the file @a path.
02226  * @a *checksum will be allocated out of @a pool, which will also be used
02227  * for temporary allocations.
02228  *
02229  * If the filesystem does not have a prerecorded checksum of @a kind for
02230  * @a path, and @a force is not TRUE, do not calculate a checksum
02231  * dynamically, just put NULL into @a checksum.  (By convention, the NULL
02232  * checksum is considered to match any checksum.)
02233  *
02234  * Notes:
02235  *
02236  * You might wonder, why do we only provide this interface for file
02237  * contents, and not for properties or directories?
02238  *
02239  * The answer is that property lists and directory entry lists are
02240  * essentially data structures, not text.  We serialize them for
02241  * transmission, but there is no guarantee that the consumer will
02242  * parse them into the same form, or even the same order, as the
02243  * producer.  It's difficult to find a checksumming method that
02244  * reaches the same result given such variation in input.  (I suppose
02245  * we could calculate an independent MD5 sum for each propname and
02246  * value, and XOR them together; same with directory entry names.
02247  * Maybe that's the solution?)  Anyway, for now we punt.  The most
02248  * important data, and the only data that goes through svndiff
02249  * processing, is file contents, so that's what we provide
02250  * checksumming for.
02251  *
02252  * Internally, of course, the filesystem checksums everything, because
02253  * it has access to the lowest level storage forms: strings behind
02254  * representations.
02255  *
02256  * @since New in 1.6.
02257  */
02258 svn_error_t *
02259 svn_fs_file_checksum(svn_checksum_t **checksum,
02260                      svn_checksum_kind_t kind,
02261                      svn_fs_root_t *root,
02262                      const char *path,
02263                      svn_boolean_t force,
02264                      apr_pool_t *pool);
02265 
02266 /**
02267  * Same as svn_fs_file_checksum(), only always put the MD5 checksum of file
02268  * @a path into @a digest, which should point to @c APR_MD5_DIGESTSIZE bytes
02269  * of storage.  If the checksum doesn't exist, put all 0's into @a digest.
02270  *
02271  * @deprecated Provided for backward compatibility with the 1.5 API.
02272  */
02273 SVN_DEPRECATED
02274 svn_error_t *
02275 svn_fs_file_md5_checksum(unsigned char digest[],
02276                          svn_fs_root_t *root,
02277                          const char *path,
02278                          apr_pool_t *pool);
02279 
02280 
02281 /** Set @a *contents to a readable generic stream that will yield the
02282  * contents of the file @a path in @a root.  Allocate the stream in
02283  * @a pool.  You can only use @a *contents for as long as the underlying
02284  * filesystem is open.  If @a path is not a file, return
02285  * #SVN_ERR_FS_NOT_FILE.
02286  *
02287  * If @a root is the root of a transaction, it is possible that the
02288  * contents of the file @a path will change between calls to
02289  * svn_fs_file_contents().  In that case, the result of reading from
02290  * @a *contents is undefined.
02291  *
02292  * ### @todo kff: I am worried about lifetime issues with this pool vs
02293  * the trail created farther down the call stack.  Trace this function
02294  * to investigate...
02295  */
02296 svn_error_t *
02297 svn_fs_file_contents(svn_stream_t **contents,
02298                      svn_fs_root_t *root,
02299                      const char *path,
02300                      apr_pool_t *pool);
02301 
02302 /**
02303  * Callback function type used with svn_fs_try_process_file_contents()
02304  * that delivers the immutable, non-NULL @a contents of @a len bytes.
02305  * @a baton is an implementation-specific closure.
02306  *
02307  * Use @a scratch_pool for allocations.
02308  *
02309  * @since New in 1.8.
02310  */
02311 typedef svn_error_t *
02312 (*svn_fs_process_contents_func_t)(const unsigned char *contents,
02313                                   apr_size_t len,
02314                                   void *baton,
02315                                   apr_pool_t *scratch_pool);
02316 
02317 /** Efficiently deliver the contents of the file @a path in @a root
02318  * via @a processor (with @a baton), setting @a *success to @c TRUE
02319  * upon doing so.  Use @a pool for allocations.
02320  *
02321  * This function is intended to support zero copy data processing.  It may
02322  * not be implemented for all data backends or not be applicable for certain
02323  * content.  In those cases, @a *success will always be @c FALSE.  Also,
02324  * this is a best-effort function which means that there is no guarantee
02325  * that @a processor gets called at all.
02326  *
02327  * @note @a processor is expected to be a relatively simple function with
02328  * a runtime of O(content size) or less.
02329  *
02330  * @since New in 1.8.
02331  */
02332 svn_error_t *
02333 svn_fs_try_process_file_contents(svn_boolean_t *success,
02334                                  svn_fs_root_t *root,
02335                                  const char *path,
02336                                  svn_fs_process_contents_func_t processor,
02337                                  void* baton,
02338                                  apr_pool_t *pool);
02339 
02340 /** Create a new file named @a path in @a root.  The file's initial contents
02341  * are the empty string, and it has no properties.  @a root must be the
02342  * root of a transaction, not a revision.
02343  *
02344  * Do any necessary temporary allocation in @a pool.
02345  */
02346 svn_error_t *
02347 svn_fs_make_file(svn_fs_root_t *root,
02348                  const char *path,
02349                  apr_pool_t *pool);
02350 
02351 
02352 /** Apply a text delta to the file @a path in @a root.  @a root must be the
02353  * root of a transaction, not a revision.
02354  *
02355  * Set @a *contents_p to a function ready to receive text delta windows
02356  * describing how to change the file's contents, relative to its
02357  * current contents.  Set @a *contents_baton_p to a baton to pass to
02358  * @a *contents_p.
02359  *
02360  * If @a path does not exist in @a root, return an error.  (You cannot use
02361  * this routine to create new files;  use svn_fs_make_file() to create
02362  * an empty file first.)
02363  *
02364  * @a base_checksum is the hex MD5 digest for the base text against
02365  * which the delta is to be applied; it is ignored if NULL, and may be
02366  * ignored even if not NULL.  If it is not ignored, it must match the
02367  * checksum of the base text against which svndiff data is being
02368  * applied; if not, svn_fs_apply_textdelta() or the @a *contents_p call
02369  * which detects the mismatch will return the error
02370  * #SVN_ERR_CHECKSUM_MISMATCH (if there is no base text, there may
02371  * still be an error if @a base_checksum is neither NULL nor the
02372  * checksum of the empty string).
02373  *
02374  * @a result_checksum is the hex MD5 digest for the fulltext that
02375  * results from this delta application.  It is ignored if NULL, but if
02376  * not NULL, it must match the checksum of the result; if it does not,
02377  * then the @a *contents_p call which detects the mismatch will return
02378  * the error #SVN_ERR_CHECKSUM_MISMATCH.
02379  *
02380  * The caller must send all delta windows including the terminating
02381  * NULL window to @a *contents_p before making further changes to the
02382  * transaction.
02383  *
02384  * Do temporary allocation in @a pool.
02385  */
02386 svn_error_t *
02387 svn_fs_apply_textdelta(svn_txdelta_window_handler_t *contents_p,
02388                        void **contents_baton_p,
02389                        svn_fs_root_t *root,
02390                        const char *path,
02391                        const char *base_checksum,
02392                        const char *result_checksum,
02393                        apr_pool_t *pool);
02394 
02395 
02396 /** Write data directly to the file @a path in @a root.  @a root must be the
02397  * root of a transaction, not a revision.
02398  *
02399  * Set @a *contents_p to a stream ready to receive full textual data.
02400  * When the caller closes this stream, the data replaces the previous
02401  * contents of the file.  The caller must write all file data and close
02402  * the stream before making further changes to the transaction.
02403  *
02404  * If @a path does not exist in @a root, return an error.  (You cannot use
02405  * this routine to create new files;  use svn_fs_make_file() to create
02406  * an empty file first.)
02407  *
02408  * @a result_checksum is the hex MD5 digest for the final fulltext
02409  * written to the stream.  It is ignored if NULL, but if not null, it
02410  * must match the checksum of the result; if it does not, then the @a
02411  * *contents_p call which detects the mismatch will return the error
02412  * #SVN_ERR_CHECKSUM_MISMATCH.
02413  *
02414  * Do any necessary temporary allocation in @a pool.
02415  *
02416  * @note This is like svn_fs_apply_textdelta(), but takes the text
02417  * straight.
02418  */
02419 svn_error_t *
02420 svn_fs_apply_text(svn_stream_t **contents_p,
02421                   svn_fs_root_t *root,
02422                   const char *path,
02423                   const char *result_checksum,
02424                   apr_pool_t *pool);
02425 
02426 
02427 /** Check if the contents of two root/path combos are different.
02428  *
02429  * Set @a *different_p to #TRUE if the file contents at @a path1 under
02430  * @a root1 differ from those at @a path2 under @a root2, or set it to
02431  * #FALSE if they are the same.  Both paths must exist under their
02432  * respective roots, and both roots must be in the same filesystem.
02433  * Do any necessary temporary allocation in @a scratch_pool.
02434  *
02435  * @note For the purposes of preserving accurate history, certain bits of
02436  * code (such as the repository dump code) need to care about the distinction
02437  * between situations when two files have "different" content and when the
02438  * contents of a given file "have changed" across two points in its history.
02439  * We have a pair of functions that can answer both of these questions,
02440  * svn_fs_contents_different() and svn_fs_contents_changed().  See issue
02441  * 4598 for more details.
02442  *
02443  * @see svn_fs_contents_changed
02444  *
02445  * @since New in 1.9.
02446  */
02447 svn_error_t *
02448 svn_fs_contents_different(svn_boolean_t *different_p,
02449                           svn_fs_root_t *root1,
02450                           const char *path1,
02451                           svn_fs_root_t *root2,
02452                           const char *path2,
02453                           apr_pool_t *scratch_pool);
02454 
02455 /** Check if the contents of two root/path combos have changed.
02456  *
02457  * Set @a *changed_p to #TRUE if the file contents at @a path1 under
02458  * @a root1 differ from those at @a path2 under @a root2, or set it to
02459  * #FALSE if they are the same.  Both paths must exist under their
02460  * respective roots, and both roots must be in the same filesystem.
02461  * Do any necessary temporary allocation in @a pool.
02462  *
02463  * @note svn_fs_contents_changed() was not designed to be used to detect
02464  * when two files have different content, but really to detect when the
02465  * contents of a given file have changed across two points in its history.
02466  * For the purposes of preserving accurate history, certain bits of code
02467  * (such as the repository dump code) need to care about this distinction.
02468  * For example, it's not an error from the FS API point of view to call
02469  * svn_fs_apply_textdelta() and explicitly set a file's contents to exactly
02470  * what they were before the edit was made.  We have a pair of functions
02471  * that can answer both of these questions, svn_fs_contents_changed() and
02472  * svn_fs_contents_different().  See issue 4598 for more details.
02473  *
02474  * @see svn_fs_contents_different
02475  */
02476 svn_error_t *
02477 svn_fs_contents_changed(svn_boolean_t *changed_p,
02478                         svn_fs_root_t *root1,
02479                         const char *path1,
02480                         svn_fs_root_t *root2,
02481                         const char *path2,
02482                         apr_pool_t *pool);
02483 
02484 
02485 
02486 /* Filesystem revisions.  */
02487 
02488 
02489 /** Set @a *youngest_p to the number of the youngest revision in filesystem
02490  * @a fs.  Use @a pool for all temporary allocation.
02491  *
02492  * The oldest revision in any filesystem is numbered zero.
02493  */
02494 svn_error_t *
02495 svn_fs_youngest_rev(svn_revnum_t *youngest_p,
02496                     svn_fs_t *fs,
02497                     apr_pool_t *pool);
02498 
02499 
02500 /**
02501  * Return filesystem format information for @a fs.
02502  *
02503  * Set @a *fs_format to the filesystem format number of @a fs, which is
02504  * an integer that increases when incompatible changes are made (such as
02505  * by #svn_fs_upgrade).
02506  *
02507  * Set @a *supports_version to the version number of the minimum Subversion GA
02508  * release that can read and write @a fs.
02509  *
02510  * @see svn_repos_info_format
02511  *
02512  * @since New in 1.9.
02513  */
02514 svn_error_t *
02515 svn_fs_info_format(int *fs_format,
02516                    svn_version_t **supports_version,
02517                    svn_fs_t *fs,
02518                    apr_pool_t *result_pool,
02519                    apr_pool_t *scratch_pool);
02520 
02521 /**
02522  * Return a list of admin-serviceable config files for @a fs.  @a *files
02523  * will be set to an array containing paths as C strings.
02524  *
02525  * @since New in 1.9.
02526  */
02527 svn_error_t *
02528 svn_fs_info_config_files(apr_array_header_t **files,
02529                          svn_fs_t *fs,
02530                          apr_pool_t *result_pool,
02531                          apr_pool_t *scratch_pool);
02532 
02533 
02534 
02535 /** Provide filesystem @a fs the opportunity to compress storage relating to
02536  * associated with  @a revision in filesystem @a fs.  Use @a pool for all
02537  * allocations.
02538  *
02539  * @note This can be a time-consuming process, depending the breadth
02540  * of the changes made in @a revision, and the depth of the history of
02541  * those changed paths.  This may also be a no op.
02542  */
02543 svn_error_t *
02544 svn_fs_deltify_revision(svn_fs_t *fs,
02545                         svn_revnum_t revision,
02546                         apr_pool_t *pool);
02547 
02548 
02549 /** Set @a *value_p to the value of the property named @a propname on
02550  * revision @a rev in the filesystem @a fs.  If @a rev has no property by
02551  * that name, set @a *value_p to zero.  Allocate the result in @a pool.
02552  */
02553 svn_error_t *
02554 svn_fs_revision_prop(svn_string_t **value_p,
02555                      svn_fs_t *fs,
02556                      svn_revnum_t rev,
02557                      const char *propname,
02558                      apr_pool_t *pool);
02559 
02560 
02561 /** Set @a *table_p to the entire property list of revision @a rev in
02562  * filesystem @a fs, as an APR hash table allocated in @a pool.  The table
02563  * maps <tt>char *</tt> property names to #svn_string_t * values; the names
02564  * and values are allocated in @a pool.
02565  */
02566 svn_error_t *
02567 svn_fs_revision_proplist(apr_hash_t **table_p,
02568                          svn_fs_t *fs,
02569                          svn_revnum_t rev,
02570                          apr_pool_t *pool);
02571 
02572 
02573 /** Change a revision's property's value, or add/delete a property.
02574  *
02575  * - @a fs is a filesystem, and @a rev is the revision in that filesystem
02576  *   whose property should change.
02577  * - @a name is the name of the property to change.
02578  * - if @a old_value_p is not @c NULL, then changing the property will fail with
02579  *   error #SVN_ERR_FS_PROP_BASEVALUE_MISMATCH if the present value of the
02580  *   property is not @a *old_value_p.  (This is an atomic test-and-set).
02581  *   @a *old_value_p may be @c NULL, representing that the property must be not
02582  *   already set.
02583  * - @a value is the new value of the property, or zero if the property should
02584  *   be removed altogether.
02585  *
02586  * Note that revision properties are non-historied --- you can change
02587  * them after the revision has been committed.  They are not protected
02588  * via transactions.
02589  *
02590  * Do any necessary temporary allocation in @a pool.
02591  *
02592  * @since New in 1.7.
02593  */
02594 svn_error_t *
02595 svn_fs_change_rev_prop2(svn_fs_t *fs,
02596                         svn_revnum_t rev,
02597                         const char *name,
02598                         const svn_string_t *const *old_value_p,
02599                         const svn_string_t *value,
02600                         apr_pool_t *pool);
02601 
02602 
02603 /**
02604  * Similar to svn_fs_change_rev_prop2(), but with @a old_value_p passed as
02605  * @c NULL.
02606  *
02607  * @deprecated Provided for backward compatibility with the 1.6 API.
02608  */
02609 SVN_DEPRECATED
02610 svn_error_t *
02611 svn_fs_change_rev_prop(svn_fs_t *fs,
02612                        svn_revnum_t rev,
02613                        const char *name,
02614                        const svn_string_t *value,
02615                        apr_pool_t *pool);
02616 
02617 
02618 
02619 /* Computing deltas.  */
02620 
02621 
02622 /** Set @a *stream_p to a pointer to a delta stream that will turn the
02623  * contents of the file @a source into the contents of the file @a target.
02624  * If @a source_root is zero, use a file with zero length as the source.
02625  *
02626  * This function does not compare the two files' properties.
02627  *
02628  * Allocate @a *stream_p, and do any necessary temporary allocation, in
02629  * @a pool.
02630  */
02631 svn_error_t *
02632 svn_fs_get_file_delta_stream(svn_txdelta_stream_t **stream_p,
02633                              svn_fs_root_t *source_root,
02634                              const char *source_path,
02635                              svn_fs_root_t *target_root,
02636                              const char *target_path,
02637                              apr_pool_t *pool);
02638 
02639 
02640 
02641 /* UUID manipulation. */
02642 
02643 /** Populate @a *uuid with the UUID associated with @a fs.  Allocate
02644     @a *uuid in @a pool.  */
02645 svn_error_t *
02646 svn_fs_get_uuid(svn_fs_t *fs,
02647                 const char **uuid,
02648                 apr_pool_t *pool);
02649 
02650 
02651 /** If not @c NULL, associate @a *uuid with @a fs.  Otherwise (if @a
02652  * uuid is @c NULL), generate a new UUID for @a fs.  Use @a pool for
02653  * any scratch work.
02654  */
02655 svn_error_t *
02656 svn_fs_set_uuid(svn_fs_t *fs,
02657                 const char *uuid,
02658                 apr_pool_t *pool);
02659 
02660 
02661 /** @defgroup svn_fs_locks Filesystem locks
02662  * @{
02663  * @since New in 1.2. */
02664 
02665 /** A lock represents one user's exclusive right to modify a path in a
02666  * filesystem.  In order to create or destroy a lock, a username must
02667  * be associated with the filesystem's access context (see
02668  * #svn_fs_access_t).
02669  *
02670  * When a lock is created, a 'lock-token' is returned.  The lock-token
02671  * is a unique URI that represents the lock (treated as an opaque
02672  * string by the client), and is required to make further use of the
02673  * lock (including removal of the lock.)  A lock-token can also be
02674  * queried to return a svn_lock_t structure that describes the details
02675  * of the lock.  lock-tokens must not contain any newline character,
02676  * mainly due to the serialization for tokens for pre-commit hook.
02677  *
02678  * Locks are not secret; anyone can view existing locks in a
02679  * filesystem.  Locks are not omnipotent: they can be broken and stolen
02680  * by people who don't "own" the lock.  (Though admins can tailor a
02681  * custom break/steal policy via libsvn_repos pre-lock hook script.)
02682  *
02683  * Locks can be created with an optional expiration date.  If a lock
02684  * has an expiration date, then the act of fetching/reading it might
02685  * cause it to automatically expire, returning either nothing or an
02686  * expiration error (depending on the API).
02687  */
02688 
02689 /** Lock information for use with svn_fs_lock_many() [and svn_repos_fs_...].
02690  *
02691  * @see svn_fs_lock_target_create
02692  *
02693  * @since New in 1.9.
02694  */
02695 typedef struct svn_fs_lock_target_t svn_fs_lock_target_t;
02696 
02697 /** Create an <tt>svn_fs_lock_target_t</tt> allocated in @a result_pool.
02698  * @a token can be NULL and @a current_rev can be SVN_INVALID_REVNUM.
02699  *
02700  * The @a token is not duplicated and so must have a lifetime at least as
02701  * long as the returned target object.
02702  *
02703  * @since New in 1.9.
02704  */
02705 svn_fs_lock_target_t *svn_fs_lock_target_create(const char *token,
02706                                                 svn_revnum_t current_rev,
02707                                                 apr_pool_t *result_pool);
02708 
02709 /** Update @a target changing the token to @a token, @a token can be NULL.
02710  *
02711  * The @a token is not duplicated and so must have a lifetime at least as
02712  * long as @a target.
02713  *
02714  * @since New in 1.9.
02715  */
02716 void svn_fs_lock_target_set_token(svn_fs_lock_target_t *target,
02717                                   const char *token);
02718 
02719 /** The callback invoked by svn_fs_lock_many() and svn_fs_unlock_many().
02720  *
02721  * @a path and @a lock are allocated in the result_pool passed to
02722  * svn_fs_lock_many/svn_fs_unlock_many and so will persist beyond the
02723  * callback invocation. @a fs_err will be cleared after the callback
02724  * returns, use svn_error_dup() to preserve the error.
02725  *
02726  * If the callback returns an error no further callbacks will be made
02727  * and svn_fs_lock_many/svn_fs_unlock_many will return an error.  The
02728  * caller cannot rely on any particular order for these callbacks and
02729  * cannot rely on interrupting the underlying operation by returning
02730  * an error.  Returning an error stops the callbacks but any locks
02731  * that would have been reported in further callbacks may, or may not,
02732  * still be created/released.
02733  *
02734  * @since New in 1.9.
02735  */
02736 typedef svn_error_t *(*svn_fs_lock_callback_t)(void *baton,
02737                                                const char *path,
02738                                                const svn_lock_t *lock,
02739                                                svn_error_t *fs_err,
02740                                                apr_pool_t *scratch_pool);
02741 
02742 /** Lock the paths in @a lock_targets in @a fs.
02743  *
02744  * @a fs must have a username associated with it (see
02745  * #svn_fs_access_t), else return #SVN_ERR_FS_NO_USER.  Set the
02746  * 'owner' field in each new lock to the fs username.
02747  *
02748  * @a comment is optional: it's either an xml-escapable UTF8 string
02749  * which describes the lock, or it is @c NULL.
02750  *
02751  * @a is_dav_comment describes whether the comment was created by a
02752  * generic DAV client; only mod_dav_svn's autoversioning feature needs
02753  * to use it.  If in doubt, pass 0.
02754  *
02755  * The paths to be locked are passed as the <tt>const char *</tt> keys
02756  * of the @a lock_targets hash.  The hash values are
02757  * <tt>svn_fs_lock_target_t *</tt> and provide the token and
02758  * @a current_rev for each path.  The token is a lock token such as can
02759  * be generated using svn_fs_generate_lock_token() (indicating that
02760  * the caller wants to dictate the lock token used), or it is @c NULL
02761  * (indicating that the caller wishes to have a new token generated by
02762  * this function).  If the token is not @c NULL, and represents an
02763  * existing lock, then the path must match the path associated with
02764  * that existing lock.  If @a current_rev is a valid revnum, then do an
02765  * out-of-dateness check.  If the revnum is less than the
02766  * last-changed-revision of the path (or if the path doesn't exist in
02767  * HEAD), yield an #SVN_ERR_FS_OUT_OF_DATE error for this path.
02768  *
02769  * If a path is already locked, then yield #SVN_ERR_FS_PATH_ALREADY_LOCKED,
02770  * unless @a steal_lock is TRUE, in which case "steal" the existing
02771  * lock, even if the FS access-context's username does not match the
02772  * current lock's owner: delete the existing lock on the path, and
02773  * create a new one.
02774  *
02775  * If @a expiration_date is zero, then create a non-expiring lock.
02776  * Else, the lock will expire at @a expiration_date.
02777  *
02778  * For each path in @a lock_targets @a lock_callback will be invoked
02779  * passing @a lock_baton and the lock and error that apply to path.
02780  * @a lock_callback can be NULL in which case it is not called and any
02781  * errors that would have been passed to the callback are not reported.
02782  *
02783  * The lock and path passed to @a lock_callback will be allocated in
02784  * @a result_pool.  Use @a scratch_pool for temporary allocations.
02785  *
02786  * @note At this time, only files can be locked.
02787  *
02788  * @note This function is not atomic.  If it returns an error, some targets
02789  * may remain unlocked while others may have been locked.
02790  *
02791  * @note You probably don't want to use this directly.  Take a look at
02792  * svn_repos_fs_lock_many() instead.
02793  *
02794  * @since New in 1.9.
02795  */
02796 svn_error_t *
02797 svn_fs_lock_many(svn_fs_t *fs,
02798                  apr_hash_t *lock_targets,
02799                  const char *comment,
02800                  svn_boolean_t is_dav_comment,
02801                  apr_time_t expiration_date,
02802                  svn_boolean_t steal_lock,
02803                  svn_fs_lock_callback_t lock_callback,
02804                  void *lock_baton,
02805                  apr_pool_t *result_pool,
02806                  apr_pool_t *scratch_pool);
02807 
02808 /** Similar to svn_fs_lock_many() but locks only a single @a path and
02809  * returns the lock in @a *lock, allocated in @a pool, or an error.
02810  *
02811  * @since New in 1.2.
02812  */
02813 svn_error_t *
02814 svn_fs_lock(svn_lock_t **lock,
02815             svn_fs_t *fs,
02816             const char *path,
02817             const char *token,
02818             const char *comment,
02819             svn_boolean_t is_dav_comment,
02820             apr_time_t expiration_date,
02821             svn_revnum_t current_rev,
02822             svn_boolean_t steal_lock,
02823             apr_pool_t *pool);
02824 
02825 
02826 /** Generate a unique lock-token using @a fs. Return in @a *token,
02827  * allocated in @a pool.
02828  *
02829  * This can be used in to populate lock->token before calling
02830  * svn_fs_attach_lock().
02831  */
02832 svn_error_t *
02833 svn_fs_generate_lock_token(const char **token,
02834                            svn_fs_t *fs,
02835                            apr_pool_t *pool);
02836 
02837 
02838 /** Remove the locks on the paths in @a unlock_targets in @a fs.
02839  *
02840  * The paths to be unlocked are passed as <tt>const char *</tt> keys
02841  * of the @a unlock_targets hash with the corresponding lock tokens as
02842  * <tt>const char *</tt> values.  If the token doesn't point to a
02843  * lock, yield an #SVN_ERR_FS_BAD_LOCK_TOKEN error for this path.  If
02844  * the token points to an expired lock, yield an
02845  * #SVN_ERR_FS_LOCK_EXPIRED error for this path.  If @a fs has no
02846  * username associated with it, yield an #SVN_ERR_FS_NO_USER unless @a
02847  * break_lock is specified.
02848  *
02849  * If the token points to a lock, but the username of @a fs's access
02850  * context doesn't match the lock's owner, yield an
02851  * #SVN_ERR_FS_LOCK_OWNER_MISMATCH.  If @a break_lock is TRUE,
02852  * however, don't return error; allow the lock to be "broken" in any
02853  * case.  In the latter case, the token shall be @c NULL.
02854  *
02855  * For each path in @a unlock_targets @a lock_callback will be invoked
02856  * passing @a lock_baton and error that apply to path.  The @a lock
02857  * passed to the callback will be NULL.  @a lock_callback can be NULL
02858  * in which case it is not called and any errors that would have been
02859  * passed to the callback are not reported.
02860  *
02861  * The path passed to lock_callback will be allocated in @a result_pool.
02862  * Use @a scratch_pool for temporary allocations.
02863  *
02864  * @note This function is not atomic.  If it returns an error, some targets
02865  * may remain locked while others may have been unlocked.
02866  *
02867  * @note You probably don't want to use this directly.  Take a look at
02868  * svn_repos_fs_unlock_many() instead.
02869  *
02870  * @since New in 1.9.
02871  */
02872 svn_error_t *
02873 svn_fs_unlock_many(svn_fs_t *fs,
02874                    apr_hash_t *unlock_targets,
02875                    svn_boolean_t break_lock,
02876                    svn_fs_lock_callback_t lock_callback,
02877                    void *lock_baton,
02878                    apr_pool_t *result_pool,
02879                    apr_pool_t *scratch_pool);
02880 
02881 /** Similar to svn_fs_unlock_many() but only unlocks a single path.
02882  *
02883  * @since New in 1.2.
02884  */
02885 svn_error_t *
02886 svn_fs_unlock(svn_fs_t *fs,
02887               const char *path,
02888               const char *token,
02889               svn_boolean_t break_lock,
02890               apr_pool_t *pool);
02891 
02892 
02893 /** If @a path is locked in @a fs, set @a *lock to an svn_lock_t which
02894  *  represents the lock, allocated in @a pool.
02895  *
02896  * If @a path is not locked or does not exist in HEAD, set @a *lock to NULL.
02897  */
02898 svn_error_t *
02899 svn_fs_get_lock(svn_lock_t **lock,
02900                 svn_fs_t *fs,
02901                 const char *path,
02902                 apr_pool_t *pool);
02903 
02904 
02905 /** The type of a lock discovery callback function.  @a baton is the
02906  * value specified in the call to svn_fs_get_locks(); the filesystem
02907  * passes it through to the callback.  @a lock is a lock structure.
02908  * @a pool is a temporary subpool for use by the callback
02909  * implementation -- it is cleared after invocation of the callback.
02910  */
02911 typedef svn_error_t *(*svn_fs_get_locks_callback_t)(void *baton,
02912                                                     svn_lock_t *lock,
02913                                                     apr_pool_t *pool);
02914 
02915 
02916 /** Report locks on or below @a path in @a fs using the @a
02917  * get_locks_func / @a get_locks_baton.  Use @a pool for necessary
02918  * allocations.
02919  *
02920  * @a depth limits the reported locks to those associated with paths
02921  * within the specified depth of @a path, and must be one of the
02922  * following values:  #svn_depth_empty, #svn_depth_files,
02923  * #svn_depth_immediates, or #svn_depth_infinity.
02924  *
02925  * If the @a get_locks_func callback implementation returns an error,
02926  * lock iteration will terminate and that error will be returned by
02927  * this function.
02928  *
02929  * @note Over the course of this function's invocation, locks might be
02930  * added, removed, or modified by concurrent processes.  Callers need
02931  * to anticipate and gracefully handle the transience of this
02932  * information.
02933  *
02934  * @since New in 1.7.
02935  */
02936 svn_error_t *
02937 svn_fs_get_locks2(svn_fs_t *fs,
02938                   const char *path,
02939                   svn_depth_t depth,
02940                   svn_fs_get_locks_callback_t get_locks_func,
02941                   void *get_locks_baton,
02942                   apr_pool_t *pool);
02943 
02944 /** Similar to svn_fs_get_locks2(), but with @a depth always passed as
02945  * svn_depth_infinity, and with the following known problem (which is
02946  * not present in svn_fs_get_locks2()):
02947  *
02948  * @note On Berkeley-DB-backed filesystems in Subversion 1.6 and
02949  * prior, the @a get_locks_func callback will be invoked from within a
02950  * Berkeley-DB transaction trail.  Implementors of the callback are,
02951  * as a result, forbidden from calling any svn_fs API functions which
02952  * might themselves attempt to start a new Berkeley DB transaction
02953  * (which is most of this svn_fs API).  Yes, this is a nasty
02954  * implementation detail to have to be aware of.
02955  *
02956  * @deprecated Provided for backward compatibility with the 1.6 API.
02957  */
02958 SVN_DEPRECATED
02959 svn_error_t *
02960 svn_fs_get_locks(svn_fs_t *fs,
02961                  const char *path,
02962                  svn_fs_get_locks_callback_t get_locks_func,
02963                  void *get_locks_baton,
02964                  apr_pool_t *pool);
02965 
02966 /** @} */
02967 
02968 /**
02969  * Append a textual list of all available FS modules to the stringbuf
02970  * @a output.  Third-party modules are only included if repository
02971  * access has caused them to be loaded.
02972  *
02973  * @since New in 1.2.
02974  */
02975 svn_error_t *
02976 svn_fs_print_modules(svn_stringbuf_t *output,
02977                      apr_pool_t *pool);
02978 
02979 
02980 /** The kind of action being taken by 'pack'. */
02981 typedef enum svn_fs_pack_notify_action_t
02982 {
02983   /** packing of the shard has commenced */
02984   svn_fs_pack_notify_start = 0,
02985 
02986   /** packing of the shard is completed */
02987   svn_fs_pack_notify_end,
02988 
02989   /** packing of the shard revprops has commenced
02990       @since New in 1.7. */
02991   svn_fs_pack_notify_start_revprop,
02992 
02993   /** packing of the shard revprops has completed
02994       @since New in 1.7. */
02995   svn_fs_pack_notify_end_revprop
02996 
02997 } svn_fs_pack_notify_action_t;
02998 
02999 /** The type of a pack notification function.  @a shard is the shard being
03000  * acted upon; @a action is the type of action being performed.  @a baton is
03001  * the corresponding baton for the notification function, and @a pool can
03002  * be used for temporary allocations, but will be cleared between invocations.
03003  */
03004 typedef svn_error_t *(*svn_fs_pack_notify_t)(void *baton,
03005                                              apr_int64_t shard,
03006                                              svn_fs_pack_notify_action_t action,
03007                                              apr_pool_t *pool);
03008 
03009 /**
03010  * Possibly update the filesystem located in the directory @a path
03011  * to use disk space more efficiently.
03012  *
03013  * @since New in 1.6.
03014  */
03015 svn_error_t *
03016 svn_fs_pack(const char *db_path,
03017             svn_fs_pack_notify_t notify_func,
03018             void *notify_baton,
03019             svn_cancel_func_t cancel_func,
03020             void *cancel_baton,
03021             apr_pool_t *pool);
03022 
03023 
03024 /**
03025  * Perform backend-specific data consistency and correctness validations
03026  * to the Subversion filesystem (mainly the meta-data) located in the
03027  * directory @a path.  Use the backend-specific configuration @a fs_config
03028  * when opening the filesystem.  @a NULL is valid for all backends.
03029  * Use @a scratch_pool for temporary allocations.
03030  *
03031  * @a start and @a end define the (minimum) range of revisions to check.
03032  * If @a start is #SVN_INVALID_REVNUM, it defaults to @c r0.  Likewise,
03033  * @a end will default to the current youngest repository revision when
03034  * given as #SVN_INVALID_REVNUM.  Since meta data checks may have to touch
03035  * other revisions as well, you may receive notifications for revisions
03036  * outside the specified range.   In fact, it is perfectly legal for a FS
03037  * implementation to always check all revisions.
03038  *
03039  * Global invariants are only guaranteed to get verified when @a r0 has
03040  * been included in the range of revisions to check.
03041  *
03042  * The optional @a notify_func callback is only a general feedback that
03043  * the operation is still in process but may be called in random revisions
03044  * order and more than once for the same revision, i.e. r2, r1, r2 would
03045  * be a valid sequence.
03046  *
03047  * The optional @a cancel_func callback will be invoked as usual to allow
03048  * the user to preempt this potentially lengthy operation.
03049  *
03050  * @note You probably don't want to use this directly.  Take a look at
03051  * svn_repos_verify_fs2() instead, which does non-backend-specific
03052  * verifications as well.
03053  *
03054  * @note To ensure a full verification using all tests and covering all
03055  * revisions, you must call this function *and* #svn_fs_verify_root.
03056  *
03057  * @note Implementors, please do tests that can be done efficiently for
03058  * a single revision in #svn_fs_verify_root.  This function is meant for
03059  * global checks or tests that require an expensive context setup.
03060  *
03061  * @see svn_repos_verify_fs2()
03062  * @see svn_fs_verify_root()
03063  *
03064  * @since New in 1.8.
03065  */
03066 svn_error_t *
03067 svn_fs_verify(const char *path,
03068               apr_hash_t *fs_config,
03069               svn_revnum_t start,
03070               svn_revnum_t end,
03071               svn_fs_progress_notify_func_t notify_func,
03072               void *notify_baton,
03073               svn_cancel_func_t cancel_func,
03074               void *cancel_baton,
03075               apr_pool_t *scratch_pool);
03076 
03077 /**
03078  * Perform backend-specific data consistency and correctness validations
03079  * of @a root in the Subversion filesystem @a fs.  @a root is typically
03080  * a revision root (see svn_fs_revision_root()), but may be a
03081  * transaction root.  Use @a scratch_pool for temporary allocations.
03082  *
03083  * @note You probably don't want to use this directly.  Take a look at
03084  * svn_repos_verify_fs2() instead, which does non-backend-specific
03085  * verifications as well.
03086  *
03087  * @note To ensure a full verification using all available tests and
03088  * covering all revisions, you must call both this function and
03089  * #svn_fs_verify.
03090  *
03091  * @note Implementors, please perform tests that cannot be done
03092  * efficiently for a single revision in #svn_fs_verify.  This function
03093  * is intended for local checks that don't require an expensive context
03094  * setup.
03095  *
03096  * @see svn_repos_verify_fs2()
03097  * @see svn_fs_verify()
03098  *
03099  * @since New in 1.8.
03100  */
03101 svn_error_t *
03102 svn_fs_verify_root(svn_fs_root_t *root,
03103                    apr_pool_t *scratch_pool);
03104 
03105 /** @} */
03106 
03107 /**
03108  * @defgroup fs_info Filesystem information subsystem
03109  * @{
03110  */
03111 
03112 /**
03113  * A structure that provides some information about a filesystem.
03114  * Returned by svn_fs_info() for #SVN_FS_TYPE_FSFS filesystems.
03115  *
03116  * @note Fields may be added to the end of this structure in future
03117  * versions.  Therefore, users shouldn't allocate structures of this
03118  * type, to preserve binary compatibility.
03119  *
03120  * @since New in 1.9.
03121  */
03122 typedef struct svn_fs_fsfs_info_t {
03123 
03124   /** Filesystem backend (#fs_type), i.e., the string #SVN_FS_TYPE_FSFS. */
03125   const char *fs_type;
03126 
03127   /** Shard size, or 0 if the filesystem is not currently sharded. */
03128   int shard_size;
03129 
03130   /** The smallest revision (as #svn_revnum_t) which is not in a pack file.
03131    * @note Zero (0) if (but not iff) the format does not support packing. */
03132   svn_revnum_t min_unpacked_rev;
03133 
03134   /** TRUE if logical addressing is enabled for this repository.
03135    * FALSE if repository uses physical addressing. */
03136   svn_boolean_t log_addressing;
03137   /* ### TODO: information about fsfs.conf? rep-cache.db? write locks? */
03138 
03139   /* If you add fields here, check whether you need to extend svn_fs_info()
03140      or svn_fs_info_dup(). */
03141 } svn_fs_fsfs_info_t;
03142 
03143 /**
03144  * A structure that provides some information about a filesystem.
03145  * Returned by svn_fs_info() for #SVN_FS_TYPE_FSX filesystems.
03146  *
03147  * @note Fields may be added to the end of this structure in future
03148  * versions.  Therefore, users shouldn't allocate structures of this
03149  * type, to preserve binary compatibility.
03150  *
03151  * @since New in 1.9.
03152  */
03153 typedef struct svn_fs_fsx_info_t {
03154 
03155   /** Filesystem backend (#fs_type), i.e., the string #SVN_FS_TYPE_FSX. */
03156   const char *fs_type;
03157 
03158   /** Shard size, always > 0. */
03159   int shard_size;
03160 
03161   /** The smallest revision which is not in a pack file. */
03162   svn_revnum_t min_unpacked_rev;
03163 
03164   /* If you add fields here, check whether you need to extend svn_fs_info()
03165      or svn_fs_info_dup(). */
03166 
03167 } svn_fs_fsx_info_t;
03168 
03169 /** @see svn_fs_info
03170  * @since New in 1.9. */
03171 typedef struct svn_fs_info_placeholder_t {
03172   /** @see svn_fs_type */
03173   const char *fs_type;
03174 
03175   /* Do not add new fields here, to maintain compatibility with the first
03176      released version of svn_fs_fsfs_info_t. */
03177 } svn_fs_info_placeholder_t;
03178 
03179 /**
03180  * Set @a *fs_info to a struct describing @a fs.  The type of the
03181  * struct depends on the backend: for #SVN_FS_TYPE_FSFS, the struct will be
03182  * of type #svn_fs_fsfs_info_t; for #SVN_FS_TYPE_FSX, it will be of type
03183  * #svn_fs_fsx_info_t; otherwise, the struct is guaranteed to be
03184  * (compatible with) #svn_fs_info_placeholder_t.
03185  *
03186  * @see #svn_fs_fsfs_info_t, #svn_fs_fsx_info_t
03187  *
03188  * @since New in 1.9.
03189  */
03190 svn_error_t *
03191 svn_fs_info(const svn_fs_info_placeholder_t **fs_info,
03192             svn_fs_t *fs,
03193             apr_pool_t *result_pool,
03194             apr_pool_t *scratch_pool);
03195 
03196 /**
03197  * Return a duplicate of @a info, allocated in @a result_pool. The returned
03198  * struct will be of the same type as the passed-in struct, which itself
03199  * must have been returned from svn_fs_info() or svn_fs_info_dup().  No part
03200  * of the new structure will be shared with @a info (except static string
03201  * constants).  Use @a scratch_pool for temporary allocations.
03202  *
03203  * @see #svn_fs_info_placeholder_t, #svn_fs_fsfs_info_t
03204  *
03205  * @since New in 1.9.
03206  */
03207 void *
03208 svn_fs_info_dup(const void *info,
03209                 apr_pool_t *result_pool,
03210                 apr_pool_t *scratch_pool);
03211 
03212 /** @} */
03213 
03214 #ifdef __cplusplus
03215 }
03216 #endif /* __cplusplus */
03217 
03218 #endif /* SVN_FS_H */

Generated on Tue Apr 26 10:41:50 2016 for Subversion by  doxygen 1.4.7