]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/libsvn_fs_base/lock.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.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. */
37
38 /* See svn_fs_lock(), svn_fs_lock_many(). */
39 svn_error_t *svn_fs_base__lock(svn_fs_t *fs,
40                                apr_hash_t *targets,
41                                const char *comment,
42                                svn_boolean_t is_dav_comment,
43                                apr_time_t expiration_date,
44                                svn_boolean_t steal_lock,
45                                svn_fs_lock_callback_t lock_callback,
46                                void *lock_baton,
47                                apr_pool_t *result_pool,
48                                apr_pool_t *scratch_pool);
49
50 /* See svn_fs_generate_lock_token(). */
51 svn_error_t *svn_fs_base__generate_lock_token(const char **token,
52                                               svn_fs_t *fs,
53                                               apr_pool_t *pool);
54
55 /* See svn_fs_unlock(), svn_fs_unlock_many(). */
56 svn_error_t *svn_fs_base__unlock(svn_fs_t *fs,
57                                  apr_hash_t *targets,
58                                  svn_boolean_t break_lock,
59                                  svn_fs_lock_callback_t lock_callback,
60                                  void *lock_baton,
61                                  apr_pool_t *result_pool,
62                                  apr_pool_t *scratch_pool);
63
64 /* See svn_fs_get_lock(). */
65 svn_error_t *svn_fs_base__get_lock(svn_lock_t **lock,
66                                    svn_fs_t *fs,
67                                    const char *path,
68                                    apr_pool_t *pool);
69
70 /* See svn_fs_get_locks2(). */
71 svn_error_t *
72 svn_fs_base__get_locks(svn_fs_t *fs,
73                        const char *path,
74                        svn_depth_t depth,
75                        svn_fs_get_locks_callback_t get_locks_func,
76                        void *get_locks_baton,
77                        apr_pool_t *pool);
78
79
80 \f
81 /* These next functions are 'helpers' for internal fs use:
82    if a fs function's txn_body needs to enforce existing locks, it
83    should use these routines:
84 */
85
86
87 /* Implements main logic of 'svn_fs_get_lock' (or in this
88    case, svn_fs_base__get_lock() above.)  See svn_fs.h. */
89 svn_error_t *
90 svn_fs_base__get_lock_helper(svn_lock_t **lock_p,
91                              const char *path,
92                              trail_t *trail,
93                              apr_pool_t *pool);
94
95
96 /* Examine PATH for existing locks, and check whether they can be
97    used.  Do all work in the context of TRAIL, using POOL for
98    temporary allocations.
99
100    If no locks are present, return SVN_NO_ERROR.
101
102    If PATH is locked (or contains locks "below" it, when RECURSE is
103    set), then verify that:
104
105       1. a username has been supplied to TRAIL->fs's access-context,
106          else return SVN_ERR_FS_NO_USER.
107
108       2. for every lock discovered, the current username in the access
109          context of TRAIL->fs matches the "owner" of the lock, else
110          return SVN_ERR_FS_LOCK_OWNER_MISMATCH.
111
112       3. for every lock discovered, a matching lock token has been
113          passed into TRAIL->fs's access-context, else return
114          SVN_ERR_FS_BAD_LOCK_TOKEN.
115
116    If all three conditions are met, return SVN_NO_ERROR.
117 */
118 svn_error_t *svn_fs_base__allow_locked_operation(const char *path,
119                                                  svn_boolean_t recurse,
120                                                  trail_t *trail,
121                                                  apr_pool_t *pool);
122
123 #ifdef __cplusplus
124 }
125 #endif /* __cplusplus */
126
127 #endif /* SVN_LIBSVN_FS_LOCK_H */