1 /* 2 * workqueue.h : manipulating work queue items 3 * 4 * ==================================================================== 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 * ==================================================================== 22 * 23 * 24 * Greg says: 25 * 26 * I think the current items are misdirected 27 * work items should NOT touch the DB 28 * the work items should be inserted into WORK_QUEUE by wc_db, 29 * meaning: workqueue.[ch] should return work items for passing to the wc_db API, 30 * which installs them during a transaction with the other work, 31 * and those items should *only* make the on-disk state match what is in the database 32 * before you rejoined the chan, I was discussing with Bert that I might rejigger the postcommit work, 33 * in order to do the prop file handling as work items, 34 * and pass those to db_global_commit for insertion as part of its transaction 35 * so that once we switch to in-db props, those work items just get deleted, 36 * (where they're simple things like: move this file to there, or delete that file) 37 * i.e. workqueue should be seriously dumb 38 * */ 39 40 #ifndef SVN_WC_WORKQUEUE_H 41 #define SVN_WC_WORKQUEUE_H 42 43 #include <apr_pools.h> 44 45 #include "svn_types.h" 46 #include "svn_wc.h" 47 48 #include "wc_db.h" 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif /* __cplusplus */ 53 54 55 /* Returns TRUE if WI refers to a single work item. Returns FALSE if 56 WI is a list of work items. WI must not be NULL. 57 58 A work item looks like: (OP_CODE arg1 arg2 ...) 59 60 If we see OP_CODE (an atom) as WI's first child, then this is a 61 single work item. Otherwise, it is a list of work items. */ 62 #define SVN_WC__SINGLE_WORK_ITEM(wi) ((wi)->children->is_atom) 63 64 65 /* Combine WORK_ITEM1 and WORK_ITEM2 into a single, resulting work item. 66 67 Each of the WORK_ITEM parameters may have one of three values: 68 69 NULL no work item 70 (OPCODE arg1 arg2 ...) single work item 71 ((OPCODE ...) (OPCODE ...)) multiple work items 72 73 These will be combined as appropriate, and returned in one of the 74 above three styles. 75 76 The resulting list will be ordered: WORK_ITEM1 first, then WORK_ITEM2. 77 78 The result contains a shallow copy of the inputs. Allocate any 79 additional storage needed in RESULT_POOL. 80 */ 81 svn_skel_t * 82 svn_wc__wq_merge(svn_skel_t *work_item1, 83 svn_skel_t *work_item2, 84 apr_pool_t *result_pool); 85 86 87 /* For the WCROOT identified by the DB and WRI_ABSPATH pair, run any 88 work items that may be present in its workqueue. */ 89 svn_error_t * 90 svn_wc__wq_run(svn_wc__db_t *db, 91 const char *wri_abspath, 92 svn_cancel_func_t cancel_func, 93 void *cancel_baton, 94 apr_pool_t *scratch_pool); 95 96 97 /* Set *WORK_ITEM to a new work item that will install the working 98 copy file at LOCAL_ABSPATH. If USE_COMMIT_TIMES is TRUE, then the newly 99 installed file will use the nodes CHANGE_DATE for the file timestamp. 100 If RECORD_FILEINFO is TRUE, then the resulting RECORDED_TIME and 101 RECORDED_SIZE will be recorded in the database. 102 103 If SOURCE_ABSPATH is NULL, then the pristine contents will be installed 104 (with appropriate translation). If SOURCE_ABSPATH is not NULL, then it 105 specifies a source file for the translation. The file must exist for as 106 long as *WORK_ITEM exists (and is queued). Typically, it will be a 107 temporary file, and an OP_FILE_REMOVE will be queued to later remove it. 108 */ 109 svn_error_t * 110 svn_wc__wq_build_file_install(svn_skel_t **work_item, 111 svn_wc__db_t *db, 112 const char *local_abspath, 113 const char *source_abspath, 114 svn_boolean_t use_commit_times, 115 svn_boolean_t record_fileinfo, 116 apr_pool_t *result_pool, 117 apr_pool_t *scratch_pool); 118 119 120 /* Set *WORK_ITEM to a new work item that will remove a single 121 file LOCAL_ABSPATH from the working copy identified by the pair DB, 122 WRI_ABSPATH. */ 123 svn_error_t * 124 svn_wc__wq_build_file_remove(svn_skel_t **work_item, 125 svn_wc__db_t *db, 126 const char *wri_abspath, 127 const char *local_abspath, 128 apr_pool_t *result_pool, 129 apr_pool_t *scratch_pool); 130 131 /* Set *WORK_ITEM to a new work item that will remove a single 132 directory or if RECURSIVE is TRUE a directory with all its 133 descendants. */ 134 svn_error_t * 135 svn_wc__wq_build_dir_remove(svn_skel_t **work_item, 136 svn_wc__db_t *db, 137 const char *wri_abspath, 138 const char *local_abspath, 139 svn_boolean_t recursive, 140 apr_pool_t *result_pool, 141 apr_pool_t *scratch_pool); 142 143 /* Set *WORK_ITEM to a new work item that describes a move of 144 a file or directory from SRC_ABSPATH to DST_ABSPATH, ready for 145 storing in the working copy managing DST_ABSPATH. 146 147 Perform temporary allocations in SCRATCH_POOL and *WORK_ITEM in 148 RESULT_POOL. 149 */ 150 svn_error_t * 151 svn_wc__wq_build_file_move(svn_skel_t **work_item, 152 svn_wc__db_t *db, 153 const char *wri_abspath, 154 const char *src_abspath, 155 const char *dst_abspath, 156 apr_pool_t *result_pool, 157 apr_pool_t *scratch_pool); 158 159 /* Set *WORK_ITEM to a new work item that describes a copy from 160 SRC_ABSPATH to DST_ABSPATH, while translating the stream using 161 the information from LOCAL_ABSPATH. */ 162 svn_error_t * 163 svn_wc__wq_build_file_copy_translated(svn_skel_t **work_item, 164 svn_wc__db_t *db, 165 const char *local_abspath, 166 const char *src_abspath, 167 const char *dst_abspath, 168 apr_pool_t *result_pool, 169 apr_pool_t *scratch_pool); 170 171 172 /* Set *WORK_ITEM to a new work item that will synchronize the 173 target node's readonly and executable flags with the values defined 174 by its properties and lock status. */ 175 svn_error_t * 176 svn_wc__wq_build_sync_file_flags(svn_skel_t **work_item, 177 svn_wc__db_t *db, 178 const char *local_abspath, 179 apr_pool_t *result_pool, 180 apr_pool_t *scratch_pool); 181 182 183 /* Set *WORK_ITEM to a new work item that will install a property reject 184 file for LOCAL_ABSPATH into the working copy. 185 */ 186 svn_error_t * 187 svn_wc__wq_build_prej_install(svn_skel_t **work_item, 188 svn_wc__db_t *db, 189 const char *local_abspath, 190 apr_pool_t *result_pool, 191 apr_pool_t *scratch_pool); 192 193 /* Handle the final post-commit step of retranslating and recording the 194 working copy state of a committed file. 195 196 If PROP_MODS is false, assume that properties are not changed. 197 198 (Property modifications are read when svn_wc__wq_build_file_commit 199 is called and processed when the working queue is being evaluated) 200 201 Allocate *work_item in RESULT_POOL. Perform temporary allocations 202 in SCRATCH_POOL. 203 */ 204 svn_error_t * 205 svn_wc__wq_build_file_commit(svn_skel_t **work_item, 206 svn_wc__db_t *db, 207 const char *local_abspath, 208 svn_boolean_t prop_mods, 209 apr_pool_t *result_pool, 210 apr_pool_t *scratch_pool); 211 212 /* Set *WORK_ITEM to a new work item that will install the working 213 copy directory at LOCAL_ABSPATH. */ 214 svn_error_t * 215 svn_wc__wq_build_dir_install(svn_skel_t **work_item, 216 svn_wc__db_t *db, 217 const char *local_abspath, 218 apr_pool_t *result_pool, 219 apr_pool_t *scratch_pool); 220 221 svn_error_t * 222 svn_wc__wq_build_postupgrade(svn_skel_t **work_item, 223 apr_pool_t *scratch_pool); 224 225 #ifdef __cplusplus 226 } 227 #endif /* __cplusplus */ 228 229 #endif /* SVN_WC_WORKQUEUE_H */ 230