]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/subversion/subversion/libsvn_fs_base/lock.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / subversion / subversion / libsvn_fs_base / lock.h
1 /* lock.h : internal interface to lock functions
2  *
3  * ====================================================================
4  *    Licensed to the Apache Software Foundation (ASF) under one
5  *    or more contributor license agreements.  See the NOTICE file
6  *    distributed with this work for additional information
7  *    regarding copyright ownership.  The ASF licenses this file
8  *    to you under the Apache License, Version 2.0 (the
9  *    "License"); you may not use this file except in compliance
10  *    with the License.  You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *    Unless required by applicable law or agreed to in writing,
15  *    software distributed under the License is distributed on an
16  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  *    KIND, either express or implied.  See the License for the
18  *    specific language governing permissions and limitations
19  *    under the License.
20  * ====================================================================
21  */
22
23 #ifndef SVN_LIBSVN_FS_LOCK_H
24 #define SVN_LIBSVN_FS_LOCK_H
25
26 #include "trail.h"
27
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 \f
34
35 /* These functions implement part of the FS loader library's fs
36    vtables.  See the public svn_fs.h for docstrings.*/
37
38 svn_error_t *svn_fs_base__lock(svn_lock_t **lock,
39                                svn_fs_t *fs,
40                                const char *path,
41                                const char *token,
42                                const char *comment,
43                                svn_boolean_t is_dav_comment,
44                                apr_time_t expiration_date,
45                                svn_revnum_t current_rev,
46                                svn_boolean_t steal_lock,
47                                apr_pool_t *pool);
48
49 svn_error_t *svn_fs_base__generate_lock_token(const char **token,
50                                               svn_fs_t *fs,
51                                               apr_pool_t *pool);
52
53 svn_error_t *svn_fs_base__unlock(svn_fs_t *fs,
54                                  const char *path,
55                                  const char *token,
56                                  svn_boolean_t break_lock,
57                                  apr_pool_t *pool);
58
59 svn_error_t *svn_fs_base__get_lock(svn_lock_t **lock,
60                                    svn_fs_t *fs,
61                                    const char *path,
62                                    apr_pool_t *pool);
63
64 svn_error_t *
65 svn_fs_base__get_locks(svn_fs_t *fs,
66                        const char *path,
67                        svn_depth_t depth,
68                        svn_fs_get_locks_callback_t get_locks_func,
69                        void *get_locks_baton,
70                        apr_pool_t *pool);
71
72
73 \f
74 /* These next functions are 'helpers' for internal fs use:
75    if a fs function's txn_body needs to enforce existing locks, it
76    should use these routines:
77 */
78
79
80 /* Implements main logic of 'svn_fs_get_lock' (or in this
81    case, svn_fs_base__get_lock() above.)  See svn_fs.h. */
82 svn_error_t *
83 svn_fs_base__get_lock_helper(svn_lock_t **lock_p,
84                              const char *path,
85                              trail_t *trail,
86                              apr_pool_t *pool);
87
88
89 /* Examine PATH for existing locks, and check whether they can be
90    used.  Do all work in the context of TRAIL, using POOL for
91    temporary allocations.
92
93    If no locks are present, return SVN_NO_ERROR.
94
95    If PATH is locked (or contains locks "below" it, when RECURSE is
96    set), then verify that:
97
98       1. a username has been supplied to TRAIL->fs's access-context,
99          else return SVN_ERR_FS_NO_USER.
100
101       2. for every lock discovered, the current username in the access
102          context of TRAIL->fs matches the "owner" of the lock, else
103          return SVN_ERR_FS_LOCK_OWNER_MISMATCH.
104
105       3. for every lock discovered, a matching lock token has been
106          passed into TRAIL->fs's access-context, else return
107          SVN_ERR_FS_BAD_LOCK_TOKEN.
108
109    If all three conditions are met, return SVN_NO_ERROR.
110 */
111 svn_error_t *svn_fs_base__allow_locked_operation(const char *path,
112                                                  svn_boolean_t recurse,
113                                                  trail_t *trail,
114                                                  apr_pool_t *pool);
115
116 #ifdef __cplusplus
117 }
118 #endif /* __cplusplus */
119
120 #endif /* SVN_LIBSVN_FS_LOCK_H */