1/* locks-table.h : internal interface to ops on `locks' table 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_LOCKS_TABLE_H 24#define SVN_LIBSVN_FS_LOCKS_TABLE_H 25 26#include "svn_fs.h" 27#include "svn_error.h" 28#include "../trail.h" 29#include "../fs.h" 30 31#ifdef __cplusplus 32extern "C" { 33#endif /* __cplusplus */ 34 35 36/* Open a `locks' table in ENV. If CREATE is non-zero, create 37 one if it doesn't exist. Set *LOCKS_P to the new table. 38 Return a Berkeley DB error code. */ 39int svn_fs_bdb__open_locks_table(DB **locks_p, 40 DB_ENV *env, 41 svn_boolean_t create); 42 43 44/* Add a lock to the `locks' table in FS, as part of TRAIL. 45 46 Use LOCK_TOKEN as the key, presumably a string form of an apr_uuid_t. 47 Convert LOCK into a skel and store it as the value. 48 49 Warning: if LOCK_TOKEN already exists as a key, then its value 50 will be overwritten. */ 51svn_error_t *svn_fs_bdb__lock_add(svn_fs_t *fs, 52 const char *lock_token, 53 svn_lock_t *lock, 54 trail_t *trail, 55 apr_pool_t *pool); 56 57 58/* Remove the lock whose key is LOCK_TOKEN from the `locks' table of 59 FS, as part of TRAIL. 60 61 Return SVN_ERR_FS_BAD_LOCK_TOKEN if LOCK_TOKEN does not exist as a 62 table key. */ 63svn_error_t *svn_fs_bdb__lock_delete(svn_fs_t *fs, 64 const char *lock_token, 65 trail_t *trail, 66 apr_pool_t *pool); 67 68 69/* Retrieve the lock *LOCK_P pointed to by LOCK_TOKEN from the `locks' 70 table of FS, as part of TRAIL. Perform all allocations in POOL. 71 72 Return SVN_ERR_FS_BAD_LOCK_TOKEN if LOCK_TOKEN does not exist as a 73 table key. 74 75 Before returning LOCK_P, check its expiration date. If expired, 76 remove the row from the `locks' table and return SVN_ERR_FS_LOCK_EXPIRED. 77 */ 78svn_error_t *svn_fs_bdb__lock_get(svn_lock_t **lock_p, 79 svn_fs_t *fs, 80 const char *lock_token, 81 trail_t *trail, 82 apr_pool_t *pool); 83 84 85/* Retrieve locks representing all locks that exist at or below PATH 86 in FS. Pass each lock to GET_LOCKS_FUNC callback along with 87 GET_LOCKS_BATON. 88 89 Use DEPTH to filter the reported locks to only those within the 90 requested depth of PATH. 91 92 This function promises to auto-expire any locks encountered while 93 building the hash. That means that the caller can trust that each 94 returned lock hasn't yet expired. 95*/ 96svn_error_t *svn_fs_bdb__locks_get(svn_fs_t *fs, 97 const char *path, 98 svn_depth_t depth, 99 svn_fs_get_locks_callback_t get_locks_func, 100 void *get_locks_baton, 101 trail_t *trail, 102 apr_pool_t *pool); 103 104 105 106#ifdef __cplusplus 107} 108#endif /* __cplusplus */ 109 110#endif /* SVN_LIBSVN_FS_LOCKS_TABLE_H */ 111