Subversion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
svn_fs.h
Go to the documentation of this file.
1 /**
2  * @copyright
3  * ====================================================================
4  * Copyright (c) 2000-2008 CollabNet. All rights reserved.
5  *
6  * This software is licensed as described in the file COPYING, which
7  * you should have received as part of this distribution. The terms
8  * are also available at http://subversion.tigris.org/license-1.html.
9  * If newer versions of this license are posted there, you may use a
10  * newer version instead, at your option.
11  *
12  * This software consists of voluntary contributions made by many
13  * individuals. For exact contribution history, see the revision
14  * history and logs, available at http://subversion.tigris.org/.
15  * ====================================================================
16  * @endcopyright
17  *
18  * @file svn_fs.h
19  * @brief Interface to the Subversion filesystem.
20  */
21 
22 #ifndef SVN_FS_H
23 #define SVN_FS_H
24 
25 #include <apr.h>
26 #include <apr_pools.h>
27 #include <apr_hash.h>
28 #include <apr_tables.h>
29 #include <apr_time.h> /* for apr_time_t */
30 
31 #include "svn_types.h"
32 #include "svn_string.h"
33 #include "svn_delta.h"
34 #include "svn_io.h"
35 #include "svn_mergeinfo.h"
36 #include "svn_checksum.h"
37 
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif /* __cplusplus */
42 
43 
44 /**
45  * Get libsvn_fs version information.
46  *
47  * @since New in 1.1.
48  */
49 const svn_version_t *
50 svn_fs_version(void);
51 
52 /**
53  * @defgroup fs_handling Filesystem interaction subsystem
54  * @{
55  */
56 
57 /* Opening and creating filesystems. */
58 
59 
60 /** An object representing a Subversion filesystem. */
61 typedef struct svn_fs_t svn_fs_t;
62 
63 
64 /**
65  * @name Filesystem configuration options
66  * @{
67  */
68 #define SVN_FS_CONFIG_BDB_TXN_NOSYNC "bdb-txn-nosync"
69 #define SVN_FS_CONFIG_BDB_LOG_AUTOREMOVE "bdb-log-autoremove"
70 
71 /* See also svn_fs_type(). */
72 /** @since New in 1.1. */
73 #define SVN_FS_CONFIG_FS_TYPE "fs-type"
74 /** @since New in 1.1. */
75 #define SVN_FS_TYPE_BDB "bdb"
76 /** @since New in 1.1. */
77 #define SVN_FS_TYPE_FSFS "fsfs"
78 
79 /** Create repository format compatible with Subversion versions
80  * earlier than 1.4.
81  *
82  * @since New in 1.4.
83  */
84 #define SVN_FS_CONFIG_PRE_1_4_COMPATIBLE "pre-1.4-compatible"
85 
86 /** Create repository format compatible with Subversion versions
87  * earlier than 1.5.
88  *
89  * @since New in 1.5.
90  */
91 #define SVN_FS_CONFIG_PRE_1_5_COMPATIBLE "pre-1.5-compatible"
92 
93 /** Create repository format compatible with Subversion versions
94  * earlier than 1.6.
95  *
96  * @since New in 1.6.
97  */
98 #define SVN_FS_CONFIG_PRE_1_6_COMPATIBLE "pre-1.6-compatible"
99 /** @} */
100 
101 
102 /**
103  * Callers should invoke this function to initialize global state in
104  * the FS library before creating FS objects. If this function is
105  * invoked, no FS objects may be created in another thread at the same
106  * time as this invocation, and the provided @a pool must last longer
107  * than any FS object created subsequently.
108  *
109  * If this function is not called, the FS library will make a best
110  * effort to bootstrap a mutex for protecting data common to FS
111  * objects; however, there is a small window of failure. Also, a
112  * small amount of data will be leaked if the Subversion FS library is
113  * dynamically unloaded, and using the bdb FS can potentially segfault
114  * or invoke other undefined behavior if this function is not called
115  * with an appropriate pool (such as the pool the module was loaded into)
116  * when loaded dynamically.
117  *
118  * If this function is called multiple times before the pool passed to
119  * the first call is destroyed or cleared, the later calls will have
120  * no effect.
121  *
122  * @since New in 1.2.
123  */
124 svn_error_t *
125 svn_fs_initialize(apr_pool_t *pool);
126 
127 
128 /** The type of a warning callback function. @a baton is the value specified
129  * in the call to svn_fs_set_warning_func(); the filesystem passes it through
130  * to the callback. @a err contains the warning message.
131  *
132  * The callback function should not clear the error that is passed to it;
133  * its caller should do that.
134  */
135 typedef void (*svn_fs_warning_callback_t)(void *baton, svn_error_t *err);
136 
137 
138 /** Provide a callback function, @a warning, that @a fs should use to
139  * report (non-fatal) errors. To print an error, the filesystem will call
140  * @a warning, passing it @a warning_baton and the error.
141  *
142  * By default, this is set to a function that will crash the process.
143  * Dumping to @c stderr or <tt>/dev/tty</tt> is not acceptable default
144  * behavior for server processes, since those may both be equivalent to
145  * <tt>/dev/null</tt>.
146  */
147 void
150  void *warning_baton);
151 
152 
153 
154 /**
155  * Create a new, empty Subversion filesystem, stored in the directory
156  * @a path, and return a pointer to it in @a *fs_p. @a path must not
157  * currently exist, but its parent must exist. If @a fs_config is not
158  * @c NULL, the options it contains modify the behavior of the
159  * filesystem. The interpretation of @a fs_config is specific to the
160  * filesystem back-end. The new filesystem may be closed by
161  * destroying @a pool.
162  *
163  * @note The lifetime of @a fs_config must not be shorter than @a
164  * pool's. It's a good idea to allocate @a fs_config from @a pool or
165  * one of its ancestors.
166  *
167  * If @a fs_config contains a value for @c SVN_FS_CONFIG_FS_TYPE, that
168  * value determines the filesystem type for the new filesystem.
169  * Currently defined values are:
170  *
171  * SVN_FS_TYPE_BDB Berkeley-DB implementation
172  * SVN_FS_TYPE_FSFS Native-filesystem implementation
173  *
174  * If @a fs_config is @c NULL or does not contain a value for
175  * @c SVN_FS_CONFIG_FS_TYPE then the default filesystem type will be used.
176  * This will typically be BDB for version 1.1 and FSFS for later versions,
177  * though the caller should not rely upon any particular default if they
178  * wish to ensure that a filesystem of a specific type is created.
179  *
180  * @since New in 1.1.
181  */
182 svn_error_t *
183 svn_fs_create(svn_fs_t **fs_p,
184  const char *path,
185  apr_hash_t *fs_config,
186  apr_pool_t *pool);
187 
188 /**
189  * Open a Subversion filesystem located in the directory @a path, and
190  * return a pointer to it in @a *fs_p. If @a fs_config is not @c
191  * NULL, the options it contains modify the behavior of the
192  * filesystem. The interpretation of @a fs_config is specific to the
193  * filesystem back-end. The opened filesystem may be closed by
194  * destroying @a pool.
195  *
196  * @note The lifetime of @a fs_config must not be shorter than @a
197  * pool's. It's a good idea to allocate @a fs_config from @a pool or
198  * one of its ancestors.
199  *
200  * Only one thread may operate on any given filesystem object at once.
201  * Two threads may access the same filesystem simultaneously only if
202  * they open separate filesystem objects.
203  *
204  * @note You probably don't want to use this directly. Take a look at
205  * svn_repos_open() instead.
206  *
207  * @since New in 1.1.
208  */
209 svn_error_t *
210 svn_fs_open(svn_fs_t **fs_p,
211  const char *path,
212  apr_hash_t *fs_config,
213  apr_pool_t *pool);
214 
215 /**
216  * Upgrade the Subversion filesystem located in the directory @a path
217  * to the latest version supported by this library. Return @c
218  * SVN_ERR_FS_UNSUPPORTED_UPGRADE and make no changes to the
219  * filesystem if the requested upgrade is not supported. Use @a pool
220  * for necessary allocations.
221  *
222  * @note You probably don't want to use this directly. Take a look at
223  * svn_repos_upgrade() instead.
224  *
225  * @since New in 1.5.
226  */
227 svn_error_t *
228 svn_fs_upgrade(const char *path,
229  apr_pool_t *pool);
230 
231 /**
232  * Return, in @a *fs_type, a string identifying the back-end type of
233  * the Subversion filesystem located in @a path. Allocate @a *fs_type
234  * in @a pool.
235  *
236  * The string should be equal to one of the @c SVN_FS_TYPE_* defined
237  * constants, unless the filesystem is a new back-end type added in
238  * a later version of Subversion.
239  *
240  * In general, the type should make no difference in the filesystem's
241  * semantics, but there are a few situations (such as backups) where
242  * it might matter.
243  *
244  * @since New in 1.3.
245  */
246 svn_error_t *
247 svn_fs_type(const char **fs_type,
248  const char *path,
249  apr_pool_t *pool);
250 
251 /**
252  * Return the path to @a fs's repository, allocated in @a pool.
253  * @note This is just what was passed to svn_fs_create() or
254  * svn_fs_open() -- might be absolute, might not.
255  *
256  * @since New in 1.1.
257  */
258 const char *
260  apr_pool_t *pool);
261 
262 /**
263  * Delete the filesystem at @a path.
264  *
265  * @since New in 1.1.
266  */
267 svn_error_t *
268 svn_fs_delete_fs(const char *path,
269  apr_pool_t *pool);
270 
271 /**
272  * Copy a possibly live Subversion filesystem from @a src_path to
273  * @a dest_path. If @a clean is @c TRUE, perform cleanup on the
274  * source filesystem as part of the copy operation; currently, this
275  * means deleting copied, unused logfiles for a Berkeley DB source
276  * filesystem.
277  *
278  * @since New in 1.1.
279  */
280 svn_error_t *
281 svn_fs_hotcopy(const char *src_path,
282  const char *dest_path,
283  svn_boolean_t clean,
284  apr_pool_t *pool);
285 
286 /** Perform any necessary non-catastrophic recovery on the Subversion
287  * filesystem located at @a path.
288  *
289  * If @a cancel_func is not @c NULL, it is called periodically with
290  * @a cancel_baton as argument to see if the client wishes to cancel
291  * recovery. BDB filesystems do not currently support cancellation.
292  *
293  * Do any necessary allocation within @a pool.
294  *
295  * For FSFS filesystems, recovery is currently limited to recreating
296  * the db/current file, and does not require exclusive access.
297  *
298  * For BDB filesystems, recovery requires exclusive access, and is
299  * described in detail below.
300  *
301  * After an unexpected server exit, due to a server crash or a system
302  * crash, a Subversion filesystem based on Berkeley DB needs to run
303  * recovery procedures to bring the database back into a consistent
304  * state and release any locks that were held by the deceased process.
305  * The recovery procedures require exclusive access to the database
306  * --- while they execute, no other process or thread may access the
307  * database.
308  *
309  * In a server with multiple worker processes, like Apache, if a
310  * worker process accessing the filesystem dies, you must stop the
311  * other worker processes, and run recovery. Then, the other worker
312  * processes can re-open the database and resume work.
313  *
314  * If the server exited cleanly, there is no need to run recovery, but
315  * there is no harm in it, either, and it take very little time. So
316  * it's a fine idea to run recovery when the server process starts,
317  * before it begins handling any requests.
318  *
319  * @since New in 1.5.
320  */
321 svn_error_t *
322 svn_fs_recover(const char *path,
323  svn_cancel_func_t cancel_func,
324  void *cancel_baton,
325  apr_pool_t *pool);
326 
327 
328 /** Subversion filesystems based on Berkeley DB.
329  *
330  * The following functions are specific to Berkeley DB filesystems.
331  *
332  * @defgroup svn_fs_bdb Berkeley DB filesystems
333  * @{
334  */
335 
336 /** Register an error handling function for Berkeley DB error messages.
337  *
338  * @deprecated Provided for backward compatibility with the 1.2 API.
339  *
340  * Despite being first declared deprecated in Subversion 1.3, this API
341  * is redundant in versions 1.1 and 1.2 as well.
342  *
343  * Berkeley DB's error codes are seldom sufficiently informative to allow
344  * adequate troubleshooting. Berkeley DB provides extra messages through
345  * a callback function - if an error occurs, the @a handler will be called
346  * with two strings: an error message prefix, which will be zero, and
347  * an error message. @a handler might print it out, log it somewhere,
348  * etc.
349  *
350  * Subversion 1.1 and later install their own handler internally, and
351  * wrap the messages from Berkeley DB into the standard svn_error_t object,
352  * making any information gained through this interface redundant.
353  *
354  * It is only worth using this function if your program will be used
355  * with Subversion 1.0.
356  *
357  * This function connects to the Berkeley DB @c DBENV->set_errcall interface.
358  * Since that interface supports only a single callback, Subversion's internal
359  * callback is registered with Berkeley DB, and will forward notifications to
360  * a user provided callback after performing its own processing.
361  */
363 svn_error_t *
365  void (*handler)(const char *errpfx,
366  char *msg));
367 
368 /** Set @a *logfiles to an array of <tt>const char *</tt> log file names
369  * of Berkeley DB-based Subversion filesystem.
370  *
371  * If @a only_unused is @c TRUE, set @a *logfiles to an array which
372  * contains only the names of Berkeley DB log files no longer in use
373  * by the filesystem. Otherwise, all log files (used and unused) are
374  * returned.
375 
376  * This function wraps the Berkeley DB 'log_archive' function
377  * called by the db_archive binary. Repository administrators may
378  * want to run this function periodically and delete the unused log
379  * files, as a way of reclaiming disk space.
380  */
381 svn_error_t *
382 svn_fs_berkeley_logfiles(apr_array_header_t **logfiles,
383  const char *path,
384  svn_boolean_t only_unused,
385  apr_pool_t *pool);
386 
387 
388 /**
389  * The following functions are similar to their generic counterparts.
390  *
391  * In Subversion 1.2 and earlier, they only work on Berkeley DB filesystems.
392  * In Subversion 1.3 and later, they perform largely as aliases for their
393  * generic counterparts (with the exception of recover, which only gained
394  * a generic counterpart in 1.5).
395  *
396  * @defgroup svn_fs_bdb_deprecated Berkeley DB filesystem compatibility
397  * @{
398  */
399 
400 /** @deprecated Provided for backward compatibility with the 1.0 API. */
402 svn_fs_t *
403 svn_fs_new(apr_hash_t *fs_config,
404  apr_pool_t *pool);
405 
406 /** @deprecated Provided for backward compatibility with the 1.0 API. */
408 svn_error_t *
410  const char *path);
411 
412 /** @deprecated Provided for backward compatibility with the 1.0 API. */
414 svn_error_t *
416  const char *path);
417 
418 /** @deprecated Provided for backward compatibility with the 1.0 API. */
420 const char *
422  apr_pool_t *pool);
423 
424 /** @deprecated Provided for backward compatibility with the 1.0 API. */
426 svn_error_t *
427 svn_fs_delete_berkeley(const char *path,
428  apr_pool_t *pool);
429 
430 /** @deprecated Provided for backward compatibility with the 1.0 API. */
432 svn_error_t *
433 svn_fs_hotcopy_berkeley(const char *src_path,
434  const char *dest_path,
435  svn_boolean_t clean_logs,
436  apr_pool_t *pool);
437 
438 /** @deprecated Provided for backward compatibility with the 1.4 API. */
440 svn_error_t *
441 svn_fs_berkeley_recover(const char *path,
442  apr_pool_t *pool);
443 /** @} */
444 
445 /** @} */
446 
447 
448 /** Filesystem Access Contexts.
449  *
450  * @since New in 1.2.
451  *
452  * At certain times, filesystem functions need access to temporary
453  * user data. For example, which user is changing a file? If the
454  * file is locked, has an appropriate lock-token been supplied?
455  *
456  * This temporary user data is stored in an "access context" object,
457  * and the access context is then connected to the filesystem object.
458  * Whenever a filesystem function requires information, it can pull
459  * things out of the context as needed.
460  *
461  * @defgroup svn_fs_access_ctx Filesystem access contexts
462  * @{
463  */
464 
465 /** An opaque object representing temporary user data. */
467 
468 
469 /** Set @a *access_ctx to a new @c svn_fs_access_t object representing
470  * @a username, allocated in @a pool. @a username is presumed to
471  * have been authenticated by the caller.
472  *
473  * Make a deep copy of @a username.
474  */
475 svn_error_t *
477  const char *username,
478  apr_pool_t *pool);
479 
480 
481 /** Associate @a access_ctx with an open @a fs.
482  *
483  * This function can be run multiple times on the same open
484  * filesystem, in order to change the filesystem access context for
485  * different filesystem operations. Pass a NULL value for @a
486  * access_ctx to disassociate the current access context from the
487  * filesystem.
488  */
489 svn_error_t *
491  svn_fs_access_t *access_ctx);
492 
493 
494 /** Set @a *access_ctx to the current @a fs access context, or NULL if
495  * there is no current fs access context.
496  */
497 svn_error_t *
499  svn_fs_t *fs);
500 
501 
502 /** Accessors for the access context: */
503 
504 /** Set @a *username to the name represented by @a access_ctx. */
505 svn_error_t *
506 svn_fs_access_get_username(const char **username,
507  svn_fs_access_t *access_ctx);
508 
509 
510 /** Push a lock-token @a token associated with path @a path into the
511  * context @a access_ctx. The context remembers all tokens it
512  * receives, and makes them available to fs functions. The token and
513  * path are not duplicated into @a access_ctx's pool; make sure the
514  * token's lifetime is at least as long as @a access_ctx.
515  *
516  * @since New in 1.6. */
517 svn_error_t *
519  const char *path,
520  const char *token);
521 /**
522  * Same as svn_fs_access_add_lock_token2(), but with @a path set to value 1.
523  *
524  * @deprecated Provided for backward compatibility with the 1.1 API.
525  */
526 
528 svn_error_t *
530  const char *token);
531 
532 /** @} */
533 
534 
535 /** Filesystem Nodes.
536  *
537  * In a Subversion filesystem, a `node' corresponds roughly to an
538  * `inode' in a Unix filesystem:
539  * - A node is either a file or a directory.
540  * - A node's contents change over time.
541  * - When you change a node's contents, it's still the same node; it's
542  * just been changed. So a node's identity isn't bound to a specific
543  * set of contents.
544  * - If you rename a node, it's still the same node, just under a
545  * different name. So a node's identity isn't bound to a particular
546  * filename.
547  *
548  * A `node revision' refers to a node's contents at a specific point in
549  * time. Changing a node's contents always creates a new revision of that
550  * node. Once created, a node revision's contents never change.
551  *
552  * When we create a node, its initial contents are the initial revision of
553  * the node. As users make changes to the node over time, we create new
554  * revisions of that same node. When a user commits a change that deletes
555  * a file from the filesystem, we don't delete the node, or any revision
556  * of it --- those stick around to allow us to recreate prior revisions of
557  * the filesystem. Instead, we just remove the reference to the node
558  * from the directory.
559  *
560  * @defgroup svn_fs_nodes Filesystem nodes
561  * @{
562  */
563 
564 /** An object representing a node-id. */
565 typedef struct svn_fs_id_t svn_fs_id_t;
566 
567 
568 /** Return -1, 0, or 1 if node revisions @a a and @a b are unrelated,
569  * equivalent, or otherwise related (respectively).
570  */
571 int
573  const svn_fs_id_t *b);
574 
575 
576 
577 /** Return non-zero IFF the nodes associated with @a id1 and @a id2 are
578  * related, else return zero.
579  */
582  const svn_fs_id_t *id2);
583 
584 
585 /**
586  * @note This function is not guaranteed to work with all filesystem
587  * types. There is currently no un-deprecated equivalent; contact the
588  * Subversion developers if you have a need for it.
589  *
590  * @deprecated Provided for backward compatibility with the 1.0 API.
591  */
593 svn_fs_id_t *
594 svn_fs_parse_id(const char *data,
595  apr_size_t len,
596  apr_pool_t *pool);
597 
598 
599 /** Return a Subversion string containing the unparsed form of the
600  * node or node revision id @a id. Allocate the string containing the
601  * unparsed form in @a pool.
602  */
603 svn_string_t *
605  apr_pool_t *pool);
606 
607 /** @} */
608 
609 
610 /** Filesystem Transactions.
611  *
612  * To make a change to a Subversion filesystem:
613  * - Create a transaction object, using svn_fs_begin_txn().
614  * - Call svn_fs_txn_root(), to get the transaction's root directory.
615  * - Make whatever changes you like in that tree.
616  * - Commit the transaction, using svn_fs_commit_txn().
617  *
618  * The filesystem implementation guarantees that your commit will
619  * either:
620  * - succeed completely, so that all of the changes are committed to
621  * create a new revision of the filesystem, or
622  * - fail completely, leaving the filesystem unchanged.
623  *
624  * Until you commit the transaction, any changes you make are
625  * invisible. Only when your commit succeeds do they become visible
626  * to the outside world, as a new revision of the filesystem.
627  *
628  * If you begin a transaction, and then decide you don't want to make
629  * the change after all (say, because your net connection with the
630  * client disappeared before the change was complete), you can call
631  * svn_fs_abort_txn(), to cancel the entire transaction; this
632  * leaves the filesystem unchanged.
633  *
634  * The only way to change the contents of files or directories, or
635  * their properties, is by making a transaction and creating a new
636  * revision, as described above. Once a revision has been committed, it
637  * never changes again; the filesystem interface provides no means to
638  * go back and edit the contents of an old revision. Once history has
639  * been recorded, it is set in stone. Clients depend on this property
640  * to do updates and commits reliably; proxies depend on this property
641  * to cache changes accurately; and so on.
642  *
643  * There are two kinds of nodes in the filesystem: mutable, and
644  * immutable. Revisions in the filesystem consist entirely of
645  * immutable nodes, whose contents never change. A transaction in
646  * progress, which the user is still constructing, uses mutable nodes
647  * for those nodes which have been changed so far, and refers to
648  * immutable nodes from existing revisions for portions of the tree
649  * which haven't been changed yet in that transaction.
650  *
651  * Immutable nodes, as part of revisions, never refer to mutable
652  * nodes, which are part of uncommitted transactions. Mutable nodes
653  * may refer to immutable nodes, or other mutable nodes.
654  *
655  * Note that the terms "immutable" and "mutable" describe whether or
656  * not the nodes have been changed as part of a transaction --- not
657  * the permissions on the nodes they refer to. Even if you aren't
658  * authorized to modify the filesystem's root directory, you might be
659  * authorized to change some descendant of the root; doing so would
660  * create a new mutable copy of the root directory. Mutability refers
661  * to the role of the node: part of an existing revision, or part of a
662  * new one. This is independent of your authorization to make changes
663  * to a given node.
664  *
665  * Transactions are actually persistent objects, stored in the
666  * database. You can open a filesystem, begin a transaction, and
667  * close the filesystem, and then a separate process could open the
668  * filesystem, pick up the same transaction, and continue work on it.
669  * When a transaction is successfully committed, it is removed from
670  * the database.
671  *
672  * Every transaction is assigned a name. You can open a transaction
673  * by name, and resume work on it, or find out the name of a
674  * transaction you already have open. You can also list all the
675  * transactions currently present in the database.
676  *
677  * You may assign properties to transactions; these are name/value
678  * pairs. When you commit a transaction, all of its properties become
679  * unversioned revision properties of the new revision. (There is one
680  * exception: the svn:date property will be automatically set on new
681  * transactions to the date that the transaction was created, and will
682  * be overwritten when the transaction is committed by the current
683  * time; changes to a transaction's svn:date property will not affect
684  * its committed value.)
685  *
686  * Transaction names are guaranteed to contain only letters (upper-
687  * and lower-case), digits, `-', and `.', from the ASCII character
688  * set.
689  *
690  * The Subversion filesystem will make a best effort to not reuse
691  * transaction names. The Berkeley DB backend generates transaction
692  * names using a sequence, or a counter, which is stored in the BDB
693  * database. Each new transaction increments the counter. The
694  * current value of the counter is not serialized into a filesystem
695  * dump file, so dumping and restoring the repository will reset the
696  * sequence and reuse transaction names. The FSFS backend generates a
697  * transaction name using the hostname, process ID and current time in
698  * microseconds since 00:00:00 January 1, 1970 UTC. So it is
699  * extremely unlikely that a transaction name will be reused.
700  *
701  * @defgroup svn_fs_txns Filesystem transactions
702  * @{
703  */
704 
705 /** The type of a Subversion transaction object. */
706 typedef struct svn_fs_txn_t svn_fs_txn_t;
707 
708 
709 /** @defgroup svn_fs_begin_txn2_flags Bitmask flags for svn_fs_begin_txn2()
710  * @since New in 1.2.
711  * @{ */
712 
713 /** Do on-the-fly out-of-dateness checks. That is, an fs routine may
714  * throw error if a caller tries to edit an out-of-date item in the
715  * transaction.
716  *
717  * @warning ### Not yet implemented.
718  */
719 #define SVN_FS_TXN_CHECK_OOD 0x00001
720 
721 /** Do on-the-fly lock checks. That is, an fs routine may throw error
722  * if a caller tries to edit a locked item without having rights to the lock.
723  */
724 #define SVN_FS_TXN_CHECK_LOCKS 0x00002
725 /** @} */
726 
727 /**
728  * Begin a new transaction on the filesystem @a fs, based on existing
729  * revision @a rev. Set @a *txn_p to a pointer to the new transaction.
730  * When committed, this transaction will create a new revision.
731  *
732  * Allocate the new transaction in @a pool; when @a pool is freed, the new
733  * transaction will be closed (neither committed nor aborted).
734  *
735  * @a flags determines transaction enforcement behaviors, and is composed
736  * from the constants SVN_FS_TXN_* (@c SVN_FS_TXN_CHECK_OOD etc.).
737  *
738  * @note If you're building a txn for committing, you probably
739  * don't want to call this directly. Instead, call
740  * svn_repos_fs_begin_txn_for_commit(), which honors the
741  * repository's hook configurations.
742  *
743  * @since New in 1.2.
744  */
745 svn_error_t *
747  svn_fs_t *fs,
748  svn_revnum_t rev,
749  apr_uint32_t flags,
750  apr_pool_t *pool);
751 
752 
753 /**
754  * Same as svn_fs_begin_txn2(), but with @a flags set to 0.
755  *
756  * @deprecated Provided for backward compatibility with the 1.1 API.
757  */
759 svn_error_t *
761  svn_fs_t *fs,
762  svn_revnum_t rev,
763  apr_pool_t *pool);
764 
765 
766 
767 /** Commit @a txn.
768  *
769  * @note You usually don't want to call this directly.
770  * Instead, call svn_repos_fs_commit_txn(), which honors the
771  * repository's hook configurations.
772  *
773  * If the transaction conflicts with other changes committed to the
774  * repository, return an @c SVN_ERR_FS_CONFLICT error. Otherwise, create
775  * a new filesystem revision containing the changes made in @a txn,
776  * storing that new revision number in @a *new_rev, and return zero.
777  *
778  * If @a conflict_p is non-zero, use it to provide details on any
779  * conflicts encountered merging @a txn with the most recent committed
780  * revisions. If a conflict occurs, set @a *conflict_p to the path of
781  * the conflict in @a txn, with the same lifetime as @a txn;
782  * otherwise, set @a *conflict_p to NULL.
783  *
784  * If the commit succeeds, @a txn is invalid.
785  *
786  * If the commit fails for any reason, @a *new_rev is an invalid
787  * revision number, an error other than #SVN_NO_ERROR is returned and
788  * @a txn is still valid; you can make more operations to resolve the
789  * conflict, or call svn_fs_abort_txn() to abort the transaction.
790  *
791  * @note Success or failure of the commit of @a txn is determined by
792  * examining the value of @a *new_rev upon this function's return. If
793  * the value is a valid revision number, the commit was successful,
794  * even though a non-@c NULL function return value may indicate that
795  * something else went wrong in post commit FS processing.
796  */
797 svn_error_t *
798 svn_fs_commit_txn(const char **conflict_p,
799  svn_revnum_t *new_rev,
800  svn_fs_txn_t *txn,
801  apr_pool_t *pool);
802 
803 
804 /** Abort the transaction @a txn. Any changes made in @a txn are
805  * discarded, and the filesystem is left unchanged. Use @a pool for
806  * any necessary allocations.
807  *
808  * @note This function first sets the state of @a txn to "dead", and
809  * then attempts to purge it and any related data from the filesystem.
810  * If some part of the cleanup process fails, @a txn and some portion
811  * of its data may remain in the database after this function returns.
812  * Use svn_fs_purge_txn() to retry the transaction cleanup.
813  */
814 svn_error_t *
816  apr_pool_t *pool);
817 
818 
819 /** Cleanup the dead transaction in @a fs whose ID is @a txn_id. Use
820  * @a pool for all allocations. If the transaction is not yet dead,
821  * the error @c SVN_ERR_FS_TRANSACTION_NOT_DEAD is returned. (The
822  * caller probably forgot to abort the transaction, or the cleanup
823  * step of that abort failed for some reason.)
824  */
825 svn_error_t *
827  const char *txn_id,
828  apr_pool_t *pool);
829 
830 
831 /** Set @a *name_p to the name of the transaction @a txn, as a
832  * NULL-terminated string. Allocate the name in @a pool.
833  */
834 svn_error_t *
835 svn_fs_txn_name(const char **name_p,
836  svn_fs_txn_t *txn,
837  apr_pool_t *pool);
838 
839 /** Return @a txn's base revision. */
842 
843 
844 
845 /** Open the transaction named @a name in the filesystem @a fs. Set @a *txn
846  * to the transaction.
847  *
848  * If there is no such transaction, @c SVN_ERR_FS_NO_SUCH_TRANSACTION is
849  * the error returned.
850  *
851  * Allocate the new transaction in @a pool; when @a pool is freed, the new
852  * transaction will be closed (neither committed nor aborted).
853  */
854 svn_error_t *
856  svn_fs_t *fs,
857  const char *name,
858  apr_pool_t *pool);
859 
860 
861 /** Set @a *names_p to an array of <tt>const char *</tt> ids which are the
862  * names of all the currently active transactions in the filesystem @a fs.
863  * Allocate the array in @a pool.
864  */
865 svn_error_t *
866 svn_fs_list_transactions(apr_array_header_t **names_p,
867  svn_fs_t *fs,
868  apr_pool_t *pool);
869 
870 /* Transaction properties */
871 
872 /** Set @a *value_p to the value of the property named @a propname on
873  * transaction @a txn. If @a txn has no property by that name, set
874  * @a *value_p to zero. Allocate the result in @a pool.
875  */
876 svn_error_t *
877 svn_fs_txn_prop(svn_string_t **value_p,
878  svn_fs_txn_t *txn,
879  const char *propname,
880  apr_pool_t *pool);
881 
882 
883 /** Set @a *table_p to the entire property list of transaction @a txn, as
884  * an APR hash table allocated in @a pool. The resulting table maps property
885  * names to pointers to @c svn_string_t objects containing the property value.
886  */
887 svn_error_t *
888 svn_fs_txn_proplist(apr_hash_t **table_p,
889  svn_fs_txn_t *txn,
890  apr_pool_t *pool);
891 
892 
893 /** Change a transactions @a txn's property's value, or add/delete a
894  * property. @a name is the name of the property to change, and @a value
895  * is the new value of the property, or zero if the property should be
896  * removed altogether. Do any necessary temporary allocation in @a pool.
897  */
898 svn_error_t *
900  const char *name,
901  const svn_string_t *value,
902  apr_pool_t *pool);
903 
904 
905 /** Change, add, and/or delete transaction property values in
906  * transaction @a txn. @a props is an array of <tt>svn_prop_t</tt>
907  * elements. This is equivalent to calling svn_fs_change_txp_prop
908  * multiple times with the @c name and @c value fields of each
909  * successive <tt>svn_prop_t</tt>, but may be more efficient.
910  * (Properties not mentioned are left alone.) Do any necessary
911  * temporary allocation in @a pool.
912  *
913  * @since New in 1.5.
914  */
915 svn_error_t *
917  apr_array_header_t *props,
918  apr_pool_t *pool);
919 
920 /** @} */
921 
922 
923 /** Roots.
924  *
925  * An @c svn_fs_root_t object represents the root directory of some
926  * revision or transaction in a filesystem. To refer to particular
927  * node, you provide a root, and a directory path relative that root.
928  *
929  * @defgroup svn_fs_roots Filesystem roots
930  * @{
931  */
932 
933 /** The Filesystem Root object. */
935 
936 
937 /** Set @a *root_p to the root directory of revision @a rev in filesystem
938  * @a fs. Allocate @a *root_p in @a pool.
939  */
940 svn_error_t *
942  svn_fs_t *fs,
943  svn_revnum_t rev,
944  apr_pool_t *pool);
945 
946 
947 /** Set @a *root_p to the root directory of @a txn. Allocate @a *root_p in
948  * @a pool.
949  */
950 svn_error_t *
952  svn_fs_txn_t *txn,
953  apr_pool_t *pool);
954 
955 
956 /** Free the root directory @a root. Simply clearing or destroying the
957  * pool @a root was allocated in will have the same effect as calling
958  * this function.
959  */
960 void
962 
963 
964 /** Return the filesystem to which @a root belongs. */
965 svn_fs_t *
967 
968 
969 /** Return @c TRUE iff @a root is a transaction root. */
972 
973 /** Return @c TRUE iff @a root is a revision root. */
976 
977 
978 /** If @a root is the root of a transaction, return the name of the
979  * transaction, allocated in @a pool; otherwise, return NULL.
980  */
981 const char *
983  apr_pool_t *pool);
984 
985 /** If @a root is the root of a transaction, return the number of the
986  * revision on which is was based when created. Otherwise, return @c
987  * SVN_INVALID_REVNUM.
988  *
989  * @since New in 1.5.
990  */
993 
994 /** If @a root is the root of a revision, return the revision number.
995  * Otherwise, return @c SVN_INVALID_REVNUM.
996  */
999 
1000 /** @} */
1001 
1002 
1003 /** Directory entry names and directory paths.
1004  *
1005  * Here are the rules for directory entry names, and directory paths:
1006  *
1007  * A directory entry name is a Unicode string encoded in UTF-8, and
1008  * may not contain the NULL character (U+0000). The name should be in
1009  * Unicode canonical decomposition and ordering. No directory entry
1010  * may be named '.', '..', or the empty string. Given a directory
1011  * entry name which fails to meet these requirements, a filesystem
1012  * function returns an SVN_ERR_FS_PATH_SYNTAX error.
1013  *
1014  * A directory path is a sequence of zero or more directory entry
1015  * names, separated by slash characters (U+002f), and possibly ending
1016  * with slash characters. Sequences of two or more consecutive slash
1017  * characters are treated as if they were a single slash. If a path
1018  * ends with a slash, it refers to the same node it would without the
1019  * slash, but that node must be a directory, or else the function
1020  * returns an SVN_ERR_FS_NOT_DIRECTORY error.
1021  *
1022  * A path consisting of the empty string, or a string containing only
1023  * slashes, refers to the root directory.
1024  *
1025  * @defgroup svn_fs_directories Filesystem directories
1026  * @{
1027  */
1028 
1029 
1030 
1031 /** The kind of change that occurred on the path. */
1032 typedef enum
1033 {
1034  /** path modified in txn */
1036 
1037  /** path added in txn */
1039 
1040  /** path removed in txn */
1042 
1043  /** path removed and re-added in txn */
1045 
1046  /** ignore all previous change items for path (internal-use only) */
1048 
1050 
1051 /** Change descriptor.
1052  *
1053  * @note Fields may be added to the end of this structure in future
1054  * versions. Therefore, to preserve binary compatibility, users
1055  * should not directly allocate structures of this type.
1056  *
1057  * @since New in 1.6. */
1059 {
1060  /** node revision id of changed path */
1062 
1063  /** kind of change */
1065 
1066  /** were there text mods? */
1068 
1069  /** were there property mods? */
1071 
1072  /** what node kind is the path?
1073  (Note: it is legal for this to be @c svn_node_unknown.) */
1075 
1076  /** Copyfrom revision and path; this is only valid if copyfrom_known
1077  * is true. */
1079  svn_revnum_t copyfrom_rev;
1080  const char *copyfrom_path;
1081 
1082  /* NOTE! Please update svn_fs_path_change2_create() when adding new
1083  fields here. */
1085 
1086 
1087 /** Similar to @c svn_fs_path_change2_t, but without kind and copyfrom
1088  * information.
1089  *
1090  * @deprecated Provided for backwards compatibility with the 1.5 API.
1091  */
1092 
1093 typedef struct svn_fs_path_change_t
1094 {
1095  /** node revision id of changed path */
1097 
1098  /** kind of change */
1100 
1101  /** were there text mods? */
1103 
1104  /** were there property mods? */
1106 
1108 
1109 /**
1110  * Allocate an @c svn_fs_path_change2_t structure in @a pool, initialize and
1111  * return it.
1112  *
1113  * Set the @c node_rev_id field of the created struct to @a node_rev_id, and
1114  * @c change_kind to @a change_kind. Set all other fields to their
1115  * @c _unknown, @c NULL or invalid value, respectively.
1116  *
1117  * @since New in 1.6.
1118  */
1120 svn_fs_path_change2_create(const svn_fs_id_t *node_rev_id,
1121  svn_fs_path_change_kind_t change_kind,
1122  apr_pool_t *pool);
1123 
1124 /** Determine what has changed under a @a root.
1125  *
1126  * Allocate and return a hash @a *changed_paths2_p containing descriptions
1127  * of the paths changed under @a root. The hash is keyed with
1128  * <tt>const char *</tt> paths, and has @c svn_fs_path_change2_t * values.
1129  *
1130  * Callers can assume that this function takes time proportional to
1131  * the amount of data output, and does not need to do tree crawls;
1132  * however, it is possible that some of the @c node_kind fields in the
1133  * @c svn_fs_path_change2_t * values will be @c svn_node_unknown or
1134  * that and some of the @c copyfrom_known fields will be FALSE.
1135  *
1136  * Use @c pool for all allocations, including the hash and its values.
1137  *
1138  * @since New in 1.6.
1139  */
1140 svn_error_t *
1141 svn_fs_paths_changed2(apr_hash_t **changed_paths2_p,
1142  svn_fs_root_t *root,
1143  apr_pool_t *pool);
1144 
1145 
1146 /** Same as svn_fs_paths_changed2(), only with @c svn_fs_path_change_t * values
1147  * in the hash (and thus no kind or copyfrom data).
1148  *
1149  * @deprecated Provided for backward compatibility with the 1.5 API.
1150  */
1152 svn_error_t *
1153 svn_fs_paths_changed(apr_hash_t **changed_paths_p,
1154  svn_fs_root_t *root,
1155  apr_pool_t *pool);
1156 
1157 /** @} */
1158 
1159 
1160 /* Operations appropriate to all kinds of nodes. */
1161 
1162 /** Set @a *kind_p to the type of node present at @a path under @a
1163  * root. If @a path does not exist under @a root, set @a *kind_p to @c
1164  * svn_node_none. Use @a pool for temporary allocation.
1165  */
1166 svn_error_t *
1168  svn_fs_root_t *root,
1169  const char *path,
1170  apr_pool_t *pool);
1171 
1172 
1173 /** An opaque node history object. */
1175 
1176 
1177 /** Set @a *history_p to an opaque node history object which
1178  * represents @a path under @a root. @a root must be a revision root.
1179  * Use @a pool for all allocations.
1180  */
1181 svn_error_t *
1183  svn_fs_root_t *root,
1184  const char *path,
1185  apr_pool_t *pool);
1186 
1187 
1188 /** Set @a *prev_history_p to an opaque node history object which
1189  * represents the previous (or "next oldest") interesting history
1190  * location for the filesystem node represented by @a history, or @c
1191  * NULL if no such previous history exists. If @a cross_copies is @c
1192  * FALSE, also return @c NULL if stepping backwards in history to @a
1193  * *prev_history_p would cross a filesystem copy operation.
1194  *
1195  * @note If this is the first call to svn_fs_history_prev() for the @a
1196  * history object, it could return a history object whose location is
1197  * the same as the original. This will happen if the original
1198  * location was an interesting one (where the node was modified, or
1199  * took place in a copy event). This behavior allows looping callers
1200  * to avoid the calling svn_fs_history_location() on the object
1201  * returned by svn_fs_node_history(), and instead go ahead and begin
1202  * calling svn_fs_history_prev().
1203  *
1204  * @note This function uses node-id ancestry alone to determine
1205  * modifiedness, and therefore does NOT claim that in any of the
1206  * returned revisions file contents changed, properties changed,
1207  * directory entries lists changed, etc.
1208  *
1209  * @note The revisions returned for @a path will be older than or
1210  * the same age as the revision of that path in @a root. That is, if
1211  * @a root is a revision root based on revision X, and @a path was
1212  * modified in some revision(s) younger than X, those revisions
1213  * younger than X will not be included for @a path. */
1214 svn_error_t *
1215 svn_fs_history_prev(svn_fs_history_t **prev_history_p,
1216  svn_fs_history_t *history,
1217  svn_boolean_t cross_copies,
1218  apr_pool_t *pool);
1219 
1220 
1221 /** Set @a *path and @a *revision to the path and revision,
1222  * respectively, of the @a history object. Use @a pool for all
1223  * allocations.
1224  */
1225 svn_error_t *
1226 svn_fs_history_location(const char **path,
1227  svn_revnum_t *revision,
1228  svn_fs_history_t *history,
1229  apr_pool_t *pool);
1230 
1231 
1232 /** Set @a *is_dir to @c TRUE iff @a path in @a root is a directory.
1233  * Do any necessary temporary allocation in @a pool.
1234  */
1235 svn_error_t *
1237  svn_fs_root_t *root,
1238  const char *path,
1239  apr_pool_t *pool);
1240 
1241 
1242 /** Set @a *is_file to @c TRUE iff @a path in @a root is a file.
1243  * Do any necessary temporary allocation in @a pool.
1244  */
1245 svn_error_t *
1246 svn_fs_is_file(svn_boolean_t *is_file,
1247  svn_fs_root_t *root,
1248  const char *path,
1249  apr_pool_t *pool);
1250 
1251 
1252 /** Get the id of a node.
1253  *
1254  * Set @a *id_p to the node revision ID of @a path in @a root, allocated in
1255  * @a pool.
1256  *
1257  * If @a root is the root of a transaction, keep in mind that other
1258  * changes to the transaction can change which node @a path refers to,
1259  * and even whether the path exists at all.
1260  */
1261 svn_error_t *
1262 svn_fs_node_id(const svn_fs_id_t **id_p,
1263  svn_fs_root_t *root,
1264  const char *path,
1265  apr_pool_t *pool);
1266 
1267 /** Set @a *revision to the revision in which @a path under @a root was
1268  * created. Use @a pool for any temporary allocations. @a *revision will
1269  * be set to @c SVN_INVALID_REVNUM for uncommitted nodes (i.e. modified nodes
1270  * under a transaction root). Note that the root of an unmodified transaction
1271  * is not itself considered to be modified; in that case, return the revision
1272  * upon which the transaction was based.
1273  */
1274 svn_error_t *
1276  svn_fs_root_t *root,
1277  const char *path,
1278  apr_pool_t *pool);
1279 
1280 /** Set @a *revision to the revision in which the line of history
1281  * represented by @a path under @a root originated. Use @a pool for
1282  * any temporary allocations. If @a root is a transaction root, @a
1283  * *revision will be set to @c SVN_INVALID_REVNUM for any nodes newly
1284  * added in that transaction (brand new files or directories created
1285  * using @c svn_fs_make_dir or @c svn_fs_make_file).
1286  *
1287  * @since New in 1.5.
1288  */
1289 svn_error_t *
1291  svn_fs_root_t *root,
1292  const char *path,
1293  apr_pool_t *pool);
1294 
1295 /** Set @a *created_path to the path at which @a path under @a root was
1296  * created. Use @a pool for all allocations. Callers may use this
1297  * function in conjunction with svn_fs_node_created_rev() to perform a
1298  * reverse lookup of the mapping of (path, revision) -> node-id that
1299  * svn_fs_node_id() performs.
1300  */
1301 svn_error_t *
1302 svn_fs_node_created_path(const char **created_path,
1303  svn_fs_root_t *root,
1304  const char *path,
1305  apr_pool_t *pool);
1306 
1307 
1308 /** Set @a *value_p to the value of the property named @a propname of
1309  * @a path in @a root. If the node has no property by that name, set
1310  * @a *value_p to zero. Allocate the result in @a pool.
1311  */
1312 svn_error_t *
1313 svn_fs_node_prop(svn_string_t **value_p,
1314  svn_fs_root_t *root,
1315  const char *path,
1316  const char *propname,
1317  apr_pool_t *pool);
1318 
1319 
1320 /** Set @a *table_p to the entire property list of @a path in @a root,
1321  * as an APR hash table allocated in @a pool. The resulting table maps
1322  * property names to pointers to @c svn_string_t objects containing the
1323  * property value.
1324  */
1325 svn_error_t *
1326 svn_fs_node_proplist(apr_hash_t **table_p,
1327  svn_fs_root_t *root,
1328  const char *path,
1329  apr_pool_t *pool);
1330 
1331 
1332 /** Change a node's property's value, or add/delete a property.
1333  *
1334  * - @a root and @a path indicate the node whose property should change.
1335  * @a root must be the root of a transaction, not the root of a revision.
1336  * - @a name is the name of the property to change.
1337  * - @a value is the new value of the property, or zero if the property should
1338  * be removed altogether.
1339  * Do any necessary temporary allocation in @a pool.
1340  */
1341 svn_error_t *
1343  const char *path,
1344  const char *name,
1345  const svn_string_t *value,
1346  apr_pool_t *pool);
1347 
1348 
1349 /** Determine if the properties of two path/root combinations are different.
1350  *
1351  * Set @a *changed_p to 1 if the properties at @a path1 under @a root1 differ
1352  * from those at @a path2 under @a root2, or set it to 0 if they are the
1353  * same. Both paths must exist under their respective roots, and both
1354  * roots must be in the same filesystem.
1355  */
1356 svn_error_t *
1358  svn_fs_root_t *root1,
1359  const char *path1,
1360  svn_fs_root_t *root2,
1361  const char *path2,
1362  apr_pool_t *pool);
1363 
1364 
1365 /** Discover a node's copy ancestry, if any.
1366  *
1367  * If the node at @a path in @a root was copied from some other node, set
1368  * @a *rev_p and @a *path_p to the revision and path of the other node,
1369  * allocating @a *path_p in @a pool.
1370  *
1371  * Else if there is no copy ancestry for the node, set @a *rev_p to
1372  * @c SVN_INVALID_REVNUM and @a *path_p to NULL.
1373  *
1374  * If an error is returned, the values of @a *rev_p and @a *path_p are
1375  * undefined, but otherwise, if one of them is set as described above,
1376  * you may assume the other is set correspondingly.
1377  *
1378  * @a root may be a revision root or a transaction root.
1379  *
1380  * Notes:
1381  * - Copy ancestry does not descend. After copying directory D to
1382  * E, E will have copy ancestry referring to D, but E's children
1383  * may not. See also svn_fs_copy().
1384  *
1385  * - Copy ancestry *under* a copy is preserved. That is, if you
1386  * copy /A/D/G/pi to /A/D/G/pi2, and then copy /A/D/G to /G, then
1387  * /G/pi2 will still have copy ancestry pointing to /A/D/G/pi.
1388  * We don't know if this is a feature or a bug yet; if it turns
1389  * out to be a bug, then the fix is to make svn_fs_copied_from()
1390  * observe the following logic, which currently callers may
1391  * choose to follow themselves: if node X has copy history, but
1392  * its ancestor A also has copy history, then you may ignore X's
1393  * history if X's revision-of-origin is earlier than A's --
1394  * because that would mean that X's copy history was preserved in
1395  * a copy-under-a-copy scenario. If X's revision-of-origin is
1396  * the same as A's, then it was copied under A during the same
1397  * transaction that created A. (X's revision-of-origin cannot be
1398  * greater than A's, if X has copy history.) @todo See how
1399  * people like this, it can always be hidden behind the curtain
1400  * if necessary.
1401  *
1402  * - Copy ancestry is not stored as a regular subversion property
1403  * because it is not inherited. Copying foo to bar results in a
1404  * revision of bar with copy ancestry; but committing a text
1405  * change to bar right after that results in a new revision of
1406  * bar without copy ancestry.
1407  */
1408 svn_error_t *
1410  const char **path_p,
1411  svn_fs_root_t *root,
1412  const char *path,
1413  apr_pool_t *pool);
1414 
1415 
1416 /** Set @a *root_p and @a *path_p to the revision root and path of the
1417  * destination of the most recent copy event that caused @a path to
1418  * exist where it does in @a root, or to NULL if no such copy exists.
1419  * When non-NULL, allocate @a *root_p and @a *path_p in @a pool.
1420  *
1421  * @a *path_p might be a parent of @a path, rather than @a path
1422  * itself. However, it will always be the deepest relevant path.
1423  * That is, if a copy occurs underneath another copy in the same txn,
1424  * this function makes sure to set @a *path_p to the longest copy
1425  * destination path that is still a parent of or equal to @a path.
1426  *
1427  * @since New in 1.3.
1428  */
1429 svn_error_t *
1431  const char **path_p,
1432  svn_fs_root_t *root,
1433  const char *path,
1434  apr_pool_t *pool);
1435 
1436 
1437 /** Retrieve mergeinfo for multiple nodes.
1438  *
1439  * @a *catalog is a catalog for @a paths. It will never be @c NULL,
1440  * but may be empty.
1441  *
1442  * @a root is revision root to use when looking up paths.
1443  *
1444  * @a paths are the paths you are requesting information for.
1445  *
1446  * @a inherit indicates whether to retrieve explicit,
1447  * explicit-or-inherited, or only inherited mergeinfo.
1448  *
1449  * If @a include_descendants is TRUE, then additionally return the
1450  * mergeinfo for any descendant of any element of @a paths which has
1451  * the @c SVN_PROP_MERGEINFO property explicitly set on it. (Note
1452  * that inheritance is only taken into account for the elements in @a
1453  * paths; descendants of the elements in @a paths which get their
1454  * mergeinfo via inheritance are not included in @a *mergeoutput.)
1455  *
1456  * Do any necessary temporary allocation in @a pool.
1457  *
1458  * @since New in 1.5.
1459  */
1460 svn_error_t *
1461 svn_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
1462  svn_fs_root_t *root,
1463  const apr_array_header_t *paths,
1465  svn_boolean_t include_descendants,
1466  apr_pool_t *pool);
1467 
1468 /** Merge changes between two nodes into a third node.
1469  *
1470  * Given nodes @a source and @a target, and a common ancestor @a ancestor,
1471  * modify @a target to contain all the changes made between @a ancestor and
1472  * @a source, as well as the changes made between @a ancestor and @a target.
1473  * @a target_root must be the root of a transaction, not a revision.
1474  *
1475  * @a source, @a target, and @a ancestor are generally directories; this
1476  * function recursively merges the directories' contents. If they are
1477  * files, this function simply returns an error whenever @a source,
1478  * @a target, and @a ancestor are all distinct node revisions.
1479  *
1480  * If there are differences between @a ancestor and @a source that conflict
1481  * with changes between @a ancestor and @a target, this function returns an
1482  * @c SVN_ERR_FS_CONFLICT error.
1483  *
1484  * If the merge is successful, @a target is left in the merged state, and
1485  * the base root of @a target's txn is set to the root node of @a source.
1486  * If an error is returned (whether for conflict or otherwise), @a target
1487  * is left unaffected.
1488  *
1489  * If @a conflict_p is non-NULL, then: a conflict error sets @a *conflict_p
1490  * to the name of the node in @a target which couldn't be merged,
1491  * otherwise, success sets @a *conflict_p to NULL.
1492  *
1493  * Do any necessary temporary allocation in @a pool.
1494  */
1495 svn_error_t *
1496 svn_fs_merge(const char **conflict_p,
1497  svn_fs_root_t *source_root,
1498  const char *source_path,
1499  svn_fs_root_t *target_root,
1500  const char *target_path,
1501  svn_fs_root_t *ancestor_root,
1502  const char *ancestor_path,
1503  apr_pool_t *pool);
1504 
1505 
1506 
1507 /* Directories. */
1508 
1509 
1510 /** The type of a Subversion directory entry. */
1511 typedef struct svn_fs_dirent_t
1512 {
1513 
1514  /** The name of this directory entry. */
1515  const char *name;
1516 
1517  /** The node revision ID it names. */
1518  const svn_fs_id_t *id;
1519 
1520  /** The node kind. */
1522 
1523 } svn_fs_dirent_t;
1524 
1525 
1526 /** Set @a *entries_p to a newly allocated APR hash table containing the
1527  * entries of the directory at @a path in @a root. The keys of the table
1528  * are entry names, as byte strings, excluding the final NULL
1529  * character; the table's values are pointers to @c svn_fs_dirent_t
1530  * structures. Allocate the table and its contents in @a pool.
1531  */
1532 svn_error_t *
1533 svn_fs_dir_entries(apr_hash_t **entries_p,
1534  svn_fs_root_t *root,
1535  const char *path,
1536  apr_pool_t *pool);
1537 
1538 
1539 /** Create a new directory named @a path in @a root. The new directory has
1540  * no entries, and no properties. @a root must be the root of a transaction,
1541  * not a revision.
1542  *
1543  * Do any necessary temporary allocation in @a pool.
1544  */
1545 svn_error_t *
1547  const char *path,
1548  apr_pool_t *pool);
1549 
1550 
1551 /** Delete the node named @a path in @a root. If the node being deleted is
1552  * a directory, its contents will be deleted recursively. @a root must be
1553  * the root of a transaction, not of a revision. Use @a pool for
1554  * temporary allocation.
1555  *
1556  * This function may be more efficient than making the equivalent
1557  * series of calls to svn_fs_delete(), because it takes advantage of the
1558  * fact that, to delete an immutable subtree, shared with some
1559  * committed revision, you need only remove the directory entry. The
1560  * dumb algorithm would recurse into the subtree and end up cloning
1561  * each non-empty directory it contains, only to delete it later.
1562  *
1563  * If return @c SVN_ERR_FS_NO_SUCH_ENTRY, then the basename of @a path is
1564  * missing from its parent, that is, the final target of the deletion
1565  * is missing.
1566  *
1567  * Attempting to remove the root dir also results in an error,
1568  * @c SVN_ERR_FS_ROOT_DIR, even if the dir is empty.
1569  */
1570 svn_error_t *
1572  const char *path,
1573  apr_pool_t *pool);
1574 
1575 
1576 /** Create a copy of @a from_path in @a from_root named @a to_path in
1577  * @a to_root. If @a from_path in @a from_root is a directory, copy the
1578  * tree it refers to recursively.
1579  *
1580  * The copy will remember its source; use svn_fs_copied_from() to
1581  * access this information.
1582  *
1583  * @a to_root must be the root of a transaction; @a from_root must be the
1584  * root of a revision. (Requiring @a from_root to be the root of a
1585  * revision makes the implementation trivial: there is no detectable
1586  * difference (modulo node revision ID's) between copying @a from and
1587  * simply adding a reference to it. So the operation takes place in
1588  * constant time. However, there's no reason not to extend this to
1589  * mutable nodes --- it's just more code.) Further, @a to_root and @a
1590  * from_root must represent the same filesystem.
1591  *
1592  * @note To do a copy without preserving copy history, use
1593  * svn_fs_revision_link().
1594  *
1595  * Do any necessary temporary allocation in @a pool.
1596  */
1597 svn_error_t *
1598 svn_fs_copy(svn_fs_root_t *from_root,
1599  const char *from_path,
1600  svn_fs_root_t *to_root,
1601  const char *to_path,
1602  apr_pool_t *pool);
1603 
1604 
1605 /** Like svn_fs_copy(), but doesn't record copy history, and preserves
1606  * the PATH. You cannot use svn_fs_copied_from() later to find out
1607  * where this copy came from.
1608  *
1609  * Use svn_fs_revision_link() in situations where you don't care
1610  * about the copy history, and where @a to_path and @a from_path are
1611  * the same, because it is cheaper than svn_fs_copy().
1612  */
1613 svn_error_t *
1615  svn_fs_root_t *to_root,
1616  const char *path,
1617  apr_pool_t *pool);
1618 
1619 /* Files. */
1620 
1621 /** Set @a *length_p to the length of the file @a path in @a root, in bytes.
1622  * Do any necessary temporary allocation in @a pool.
1623  */
1624 svn_error_t *
1626  svn_fs_root_t *root,
1627  const char *path,
1628  apr_pool_t *pool);
1629 
1630 
1631 /** Set @a *checksum to the checksum of type @a kind for the file @a path.
1632  * @a *checksum will be allocated out of @a pool, which will also be used
1633  * for temporary allocations.
1634  *
1635  * If the filesystem does not have a prerecorded checksum of @a kind for
1636  * @a path, and @a force is not TRUE, do not calculate a checksum
1637  * dynamically, just put NULL into @a checksum. (By convention, the NULL
1638  * checksum is considered to match any checksum.)
1639  *
1640  * Notes:
1641  *
1642  * You might wonder, why do we only provide this interface for file
1643  * contents, and not for properties or directories?
1644  *
1645  * The answer is that property lists and directory entry lists are
1646  * essentially data structures, not text. We serialize them for
1647  * transmission, but there is no guarantee that the consumer will
1648  * parse them into the same form, or even the same order, as the
1649  * producer. It's difficult to find a checksumming method that
1650  * reaches the same result given such variation in input. (I suppose
1651  * we could calculate an independent MD5 sum for each propname and
1652  * value, and XOR them together; same with directory entry names.
1653  * Maybe that's the solution?) Anyway, for now we punt. The most
1654  * important data, and the only data that goes through svndiff
1655  * processing, is file contents, so that's what we provide
1656  * checksumming for.
1657  *
1658  * Internally, of course, the filesystem checksums everything, because
1659  * it has access to the lowest level storage forms: strings behind
1660  * representations.
1661  *
1662  * @since New in 1.6.
1663  */
1664 svn_error_t *
1666  svn_checksum_kind_t kind,
1667  svn_fs_root_t *root,
1668  const char *path,
1669  svn_boolean_t force,
1670  apr_pool_t *pool);
1671 
1672 /**
1673  * Same as svn_fs_file_checksum(), only always put the MD5 checksum of file
1674  * @a path into @a digest, which should point to @c APR_MD5_DIGESTSIZE bytes
1675  * of storage. If the checksum doesn't exist, put all 0's into @a digest.
1676  *
1677  * @deprecated Provided for backward compatibility with the 1.5 API.
1678  */
1680 svn_error_t *
1681 svn_fs_file_md5_checksum(unsigned char digest[],
1682  svn_fs_root_t *root,
1683  const char *path,
1684  apr_pool_t *pool);
1685 
1686 
1687 /** Set @a *contents to a readable generic stream that will yield the
1688  * contents of the file @a path in @a root. Allocate the stream in
1689  * @a pool. You can only use @a *contents for as long as the underlying
1690  * filesystem is open. If @a path is not a file, return
1691  * @c SVN_ERR_FS_NOT_FILE.
1692  *
1693  * If @a root is the root of a transaction, it is possible that the
1694  * contents of the file @a path will change between calls to
1695  * svn_fs_file_contents(). In that case, the result of reading from
1696  * @a *contents is undefined.
1697  *
1698  * ### @todo kff: I am worried about lifetime issues with this pool vs
1699  * the trail created farther down the call stack. Trace this function
1700  * to investigate...
1701  */
1702 svn_error_t *
1704  svn_fs_root_t *root,
1705  const char *path,
1706  apr_pool_t *pool);
1707 
1708 
1709 /** Create a new file named @a path in @a root. The file's initial contents
1710  * are the empty string, and it has no properties. @a root must be the
1711  * root of a transaction, not a revision.
1712  *
1713  * Do any necessary temporary allocation in @a pool.
1714  */
1715 svn_error_t *
1717  const char *path,
1718  apr_pool_t *pool);
1719 
1720 
1721 /** Apply a text delta to the file @a path in @a root. @a root must be the
1722  * root of a transaction, not a revision.
1723  *
1724  * Set @a *contents_p to a function ready to receive text delta windows
1725  * describing how to change the file's contents, relative to its
1726  * current contents. Set @a *contents_baton_p to a baton to pass to
1727  * @a *contents_p.
1728  *
1729  * If @a path does not exist in @a root, return an error. (You cannot use
1730  * this routine to create new files; use svn_fs_make_file() to create
1731  * an empty file first.)
1732  *
1733  * @a base_checksum is the hex MD5 digest for the base text against
1734  * which the delta is to be applied; it is ignored if NULL, and may be
1735  * ignored even if not NULL. If it is not ignored, it must match the
1736  * checksum of the base text against which svndiff data is being
1737  * applied; if not, svn_fs_apply_textdelta() or the @a *contents_p call
1738  * which detects the mismatch will return the error
1739  * @c SVN_ERR_CHECKSUM_MISMATCH (if there is no base text, there may
1740  * still be an error if @a base_checksum is neither NULL nor the
1741  * checksum of the empty string).
1742  *
1743  * @a result_checksum is the hex MD5 digest for the fulltext that
1744  * results from this delta application. It is ignored if NULL, but if
1745  * not NULL, it must match the checksum of the result; if it does not,
1746  * then the @a *contents_p call which detects the mismatch will return
1747  * the error @c SVN_ERR_CHECKSUM_MISMATCH.
1748  *
1749  * The caller must send all delta windows including the terminating
1750  * NULL window to @a *contents_p before making further changes to the
1751  * transaction.
1752  *
1753  * Do temporary allocation in @a pool.
1754  */
1755 svn_error_t *
1757  void **contents_baton_p,
1758  svn_fs_root_t *root,
1759  const char *path,
1760  const char *base_checksum,
1761  const char *result_checksum,
1762  apr_pool_t *pool);
1763 
1764 
1765 /** Write data directly to the file @a path in @a root. @a root must be the
1766  * root of a transaction, not a revision.
1767  *
1768  * Set @a *contents_p to a stream ready to receive full textual data.
1769  * When the caller closes this stream, the data replaces the previous
1770  * contents of the file. The caller must write all file data and close
1771  * the stream before making further changes to the transaction.
1772  *
1773  * If @a path does not exist in @a root, return an error. (You cannot use
1774  * this routine to create new files; use svn_fs_make_file() to create
1775  * an empty file first.)
1776  *
1777  * @a result_checksum is the hex MD5 digest for the final fulltext
1778  * written to the stream. It is ignored if NULL, but if not null, it
1779  * must match the checksum of the result; if it does not, then the @a
1780  * *contents_p call which detects the mismatch will return the error
1781  * @c SVN_ERR_CHECKSUM_MISMATCH.
1782  *
1783  * Do any necessary temporary allocation in @a pool.
1784  *
1785  * ### This is like svn_fs_apply_textdelta(), but takes the text
1786  * straight. It is currently used only by the loader, see
1787  * libsvn_repos/load.c. It should accept a checksum, of course, which
1788  * would come from an (optional) header in the dump file. See
1789  * http://subversion.tigris.org/issues/show_bug.cgi?id=1102 for more.
1790  */
1791 svn_error_t *
1792 svn_fs_apply_text(svn_stream_t **contents_p,
1793  svn_fs_root_t *root,
1794  const char *path,
1795  const char *result_checksum,
1796  apr_pool_t *pool);
1797 
1798 
1799 /** Check if the contents of two root/path combos have changed.
1800  *
1801  * Set @a *changed_p to 1 if the contents at @a path1 under @a root1 differ
1802  * from those at @a path2 under @a root2, or set it to 0 if they are the
1803  * same. Both paths must exist under their respective roots, and both
1804  * roots must be in the same filesystem.
1805  */
1806 svn_error_t *
1808  svn_fs_root_t *root1,
1809  const char *path1,
1810  svn_fs_root_t *root2,
1811  const char *path2,
1812  apr_pool_t *pool);
1813 
1814 
1815 
1816 /* Filesystem revisions. */
1817 
1818 
1819 /** Set @a *youngest_p to the number of the youngest revision in filesystem
1820  * @a fs. Use @a pool for all temporary allocation.
1821  *
1822  * The oldest revision in any filesystem is numbered zero.
1823  */
1824 svn_error_t *
1825 svn_fs_youngest_rev(svn_revnum_t *youngest_p,
1826  svn_fs_t *fs,
1827  apr_pool_t *pool);
1828 
1829 
1830 /** Provide filesystem @a fs the opportunity to compress storage relating to
1831  * associated with @a revision in filesystem @a fs. Use @a pool for all
1832  * allocations.
1833  *
1834  * @note This can be a time-consuming process, depending the breadth
1835  * of the changes made in @a revision, and the depth of the history of
1836  * those changed paths. This may also be a no op.
1837  */
1838 svn_error_t *
1840  svn_revnum_t revision,
1841  apr_pool_t *pool);
1842 
1843 
1844 /** Set @a *value_p to the value of the property named @a propname on
1845  * revision @a rev in the filesystem @a fs. If @a rev has no property by
1846  * that name, set @a *value_p to zero. Allocate the result in @a pool.
1847  */
1848 svn_error_t *
1850  svn_fs_t *fs,
1851  svn_revnum_t rev,
1852  const char *propname,
1853  apr_pool_t *pool);
1854 
1855 
1856 /** Set @a *table_p to the entire property list of revision @a rev in
1857  * filesystem @a fs, as an APR hash table allocated in @a pool. The table
1858  * maps <tt>char *</tt> property names to @c svn_string_t * values; the names
1859  * and values are allocated in @a pool.
1860  */
1861 svn_error_t *
1862 svn_fs_revision_proplist(apr_hash_t **table_p,
1863  svn_fs_t *fs,
1864  svn_revnum_t rev,
1865  apr_pool_t *pool);
1866 
1867 
1868 /** Change a revision's property's value, or add/delete a property.
1869  *
1870  * - @a fs is a filesystem, and @a rev is the revision in that filesystem
1871  * whose property should change.
1872  * - @a name is the name of the property to change.
1873  * - @a value is the new value of the property, or zero if the property should
1874  * be removed altogether.
1875  *
1876  * Note that revision properties are non-historied --- you can change
1877  * them after the revision has been committed. They are not protected
1878  * via transactions.
1879  *
1880  * Do any necessary temporary allocation in @a pool.
1881  */
1882 svn_error_t *
1884  svn_revnum_t rev,
1885  const char *name,
1886  const svn_string_t *value,
1887  apr_pool_t *pool);
1888 
1889 
1890 
1891 /* Computing deltas. */
1892 
1893 
1894 /** Set @a *stream_p to a pointer to a delta stream that will turn the
1895  * contents of the file @a source into the contents of the file @a target.
1896  * If @a source_root is zero, use a file with zero length as the source.
1897  *
1898  * This function does not compare the two files' properties.
1899  *
1900  * Allocate @a *stream_p, and do any necessary temporary allocation, in
1901  * @a pool.
1902  */
1903 svn_error_t *
1905  svn_fs_root_t *source_root,
1906  const char *source_path,
1907  svn_fs_root_t *target_root,
1908  const char *target_path,
1909  apr_pool_t *pool);
1910 
1911 
1912 
1913 /* UUID manipulation. */
1914 
1915 /** Populate @a *uuid with the UUID associated with @a fs. Allocate
1916  @a *uuid in @a pool. */
1917 svn_error_t *
1919  const char **uuid,
1920  apr_pool_t *pool);
1921 
1922 
1923 /** If not @c NULL, associate @a *uuid with @a fs. Otherwise (if @a
1924  * uuid is @c NULL), generate a new UUID for @a fs. Use @a pool for
1925  * any scratchwork.
1926  */
1927 svn_error_t *
1929  const char *uuid,
1930  apr_pool_t *pool);
1931 
1932 
1933 /* Non-historical properties. */
1934 
1935 /* [[Yes, do tell.]] */
1936 
1937 
1938 
1939 /** @defgroup svn_fs_locks Filesystem locks
1940  * @{
1941  * @since New in 1.2. */
1942 
1943 /** A lock represents one user's exclusive right to modify a path in a
1944  * filesystem. In order to create or destroy a lock, a username must
1945  * be associated with the filesystem's access context (see @c
1946  * svn_fs_access_t).
1947  *
1948  * When a lock is created, a 'lock-token' is returned. The lock-token
1949  * is a unique URI that represents the lock (treated as an opaque
1950  * string by the client), and is required to make further use of the
1951  * lock (including removal of the lock.) A lock-token can also be
1952  * queried to return a svn_lock_t structure that describes the details
1953  * of the lock. lock-tokens must not contain any newline character,
1954  * mainly due to the serialization for tokens for pre-commit hook.
1955  *
1956  * Locks are not secret; anyone can view existing locks in a
1957  * filesystem. Locks are not omnipotent: they can broken and stolen
1958  * by people who don't "own" the lock. (Though admins can tailor a
1959  * custom break/steal policy via libsvn_repos pre-lock hook script.)
1960  *
1961  * Locks can be created with an optional expiration date. If a lock
1962  * has an expiration date, then the act of fetching/reading it might
1963  * cause it to automatically expire, returning either nothing or an
1964  * expiration error (depending on the API).
1965  */
1966 
1967 
1968 /** Lock @a path in @a fs, and set @a *lock to a lock
1969  * representing the new lock, allocated in @a pool.
1970  *
1971  * @warning You may prefer to use svn_repos_fs_lock() instead,
1972  * which see.
1973  *
1974  * @a fs must have a username associated with it (see @c
1975  * svn_fs_access_t), else return @c SVN_ERR_FS_NO_USER. Set the
1976  * 'owner' field in the new lock to the fs username.
1977  *
1978  * @a comment is optional: it's either an xml-escapable UTF8 string
1979  * which describes the lock, or it is @c NULL.
1980  *
1981  * @a is_dav_comment describes whether the comment was created by a
1982  * generic DAV client; only mod_dav_svn's autoversioning feature needs
1983  * to use it. If in doubt, pass 0.
1984  *
1985  * If path is already locked, then return @c SVN_ERR_FS_PATH_ALREADY_LOCKED,
1986  * unless @a steal_lock is TRUE, in which case "steal" the existing
1987  * lock, even if the FS access-context's username does not match the
1988  * current lock's owner: delete the existing lock on @a path, and
1989  * create a new one.
1990  *
1991  * @a token is a lock token such as can be generated using
1992  * svn_fs_generate_lock_token() (indicating that the caller wants to
1993  * dictate the lock token used), or it is @c NULL (indicating that the
1994  * caller wishes to have a new token generated by this function). If
1995  * @a token is not @c NULL, and represents an existing lock, then @a
1996  * path must match the path associated with that existing lock.
1997  *
1998  * If @a expiration_date is zero, then create a non-expiring lock.
1999  * Else, the lock will expire at @a expiration_date.
2000  *
2001  * If @a current_rev is a valid revnum, then do an out-of-dateness
2002  * check. If the revnum is less than the last-changed-revision of @a
2003  * path (or if @a path doesn't exist in HEAD), return @c
2004  * SVN_ERR_FS_OUT_OF_DATE.
2005  *
2006  * @note At this time, only files can be locked.
2007  */
2008 svn_error_t *
2009 svn_fs_lock(svn_lock_t **lock,
2010  svn_fs_t *fs,
2011  const char *path,
2012  const char *token,
2013  const char *comment,
2014  svn_boolean_t is_dav_comment,
2015  apr_time_t expiration_date,
2016  svn_revnum_t current_rev,
2017  svn_boolean_t steal_lock,
2018  apr_pool_t *pool);
2019 
2020 
2021 /** Generate a unique lock-token using @a fs. Return in @a *token,
2022  * allocated in @a pool.
2023  *
2024  * This can be used in to populate lock->token before calling
2025  * svn_fs_attach_lock().
2026  */
2027 svn_error_t *
2028 svn_fs_generate_lock_token(const char **token,
2029  svn_fs_t *fs,
2030  apr_pool_t *pool);
2031 
2032 
2033 /** Remove the lock on @a path represented by @a token in @a fs.
2034  *
2035  * If @a token doesn't point to a lock, return @c SVN_ERR_FS_BAD_LOCK_TOKEN.
2036  * If @a token points to an expired lock, return @c SVN_ERR_FS_LOCK_EXPIRED.
2037  * If @a fs has no username associated with it, return @c SVN_ERR_FS_NO_USER
2038  * unless @a break_lock is specified.
2039  *
2040  * If @a token points to a lock, but the username of @a fs's access
2041  * context doesn't match the lock's owner, return @c
2042  * SVN_ERR_FS_LOCK_OWNER_MISMATCH. If @a break_lock is TRUE, however, don't
2043  * return error; allow the lock to be "broken" in any case. In the latter
2044  * case, @a token shall be @c NULL.
2045  *
2046  * Use @a pool for temporary allocations.
2047  */
2048 svn_error_t *
2050  const char *path,
2051  const char *token,
2052  svn_boolean_t break_lock,
2053  apr_pool_t *pool);
2054 
2055 
2056 /** If @a path is locked in @a fs, set @a *lock to an svn_lock_t which
2057  * represents the lock, allocated in @a pool.
2058  *
2059  * If @a path is not locked, set @a *lock to NULL.
2060  */
2061 svn_error_t *
2063  svn_fs_t *fs,
2064  const char *path,
2065  apr_pool_t *pool);
2066 
2067 
2068 /** The type of a lock discovery callback function. @a baton is the
2069  * value specified in the call to svn_fs_get_locks(); the filesystem
2070  * passes it through to the callback. @a lock is a lock structure.
2071  * @a pool is a temporary subpool for use by the callback
2072  * implementation -- it is cleared after invocation of the callback.
2073  */
2074 typedef svn_error_t *(*svn_fs_get_locks_callback_t)(void *baton,
2075  svn_lock_t *lock,
2076  apr_pool_t *pool);
2077 
2078 
2079 /** Report locks on or below @a path in @a fs using the @a
2080  * get_locks_func / @a get_locks_baton. Use @a pool for necessary
2081  * allocations.
2082  *
2083  * If the @a get_locks_func callback implementation returns an error,
2084  * lock iteration will terminate and that error will be returned by
2085  * this function.
2086  */
2087 svn_error_t *
2089  const char *path,
2090  svn_fs_get_locks_callback_t get_locks_func,
2091  void *get_locks_baton,
2092  apr_pool_t *pool);
2093 
2094 /** @} */
2095 
2096 /**
2097  * Append a textual list of all available FS modules to the stringbuf
2098  * @a output.
2099  *
2100  * @since New in 1.2.
2101  */
2102 svn_error_t *
2104  apr_pool_t *pool);
2105 
2106 
2107 /** The kind of action being taken by 'pack'. */
2108 typedef enum
2109 {
2110  /** packing of the shard has commenced */
2112 
2113  /** packing of the shard is completed */
2115 
2117 
2118 /** The type of a pack notification function. @a shard is the shard being
2119  * acted upon; @a action is the type of action being performed. @a baton is
2120  * the corresponding baton for the notification function, and @a pool can
2121  * be used for temporary allocations, but will be cleared between invocations.
2122  */
2123 typedef svn_error_t *(*svn_fs_pack_notify_t)(void *baton,
2124  apr_int64_t shard,
2126  apr_pool_t *pool);
2127 
2128 /**
2129  * Possibly update the filesystem located in the directory @a path
2130  * to use disk space more efficiently.
2131  *
2132  * @since New in 1.6.
2133  */
2134 svn_error_t *
2135 svn_fs_pack(const char *db_path,
2136  svn_fs_pack_notify_t notify_func,
2137  void *notify_baton,
2138  svn_cancel_func_t cancel_func,
2139  void *cancel_baton,
2140  apr_pool_t *pool);
2141 
2142 
2143 /** @} */
2144 
2145 #ifdef __cplusplus
2146 }
2147 #endif /* __cplusplus */
2148 
2149 #endif /* SVN_FS_H */