2 * workqueue.h : manipulating work queue items
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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
21 * ====================================================================
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
40 #ifndef SVN_WC_WORKQUEUE_H
41 #define SVN_WC_WORKQUEUE_H
43 #include <apr_pools.h>
45 #include "svn_types.h"
52 #endif /* __cplusplus */
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.
58 A work item looks like: (OP_CODE arg1 arg2 ...)
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)
65 /* Combine WORK_ITEM1 and WORK_ITEM2 into a single, resulting work item.
67 Each of the WORK_ITEM parameters may have one of three values:
70 (OPCODE arg1 arg2 ...) single work item
71 ((OPCODE ...) (OPCODE ...)) multiple work items
73 These will be combined as appropriate, and returned in one of the
76 The resulting list will be ordered: WORK_ITEM1 first, then WORK_ITEM2.
78 The result contains a shallow copy of the inputs. Allocate any
79 additional storage needed in RESULT_POOL.
82 svn_wc__wq_merge(svn_skel_t *work_item1,
83 svn_skel_t *work_item2,
84 apr_pool_t *result_pool);
87 /* For the WCROOT identified by the DB and WRI_ABSPATH pair, run any
88 work items that may be present in its workqueue. */
90 svn_wc__wq_run(svn_wc__db_t *db,
91 const char *wri_abspath,
92 svn_cancel_func_t cancel_func,
94 apr_pool_t *scratch_pool);
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.
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.
110 svn_wc__wq_build_file_install(svn_skel_t **work_item,
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);
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,
124 svn_wc__wq_build_file_remove(svn_skel_t **work_item,
126 const char *wri_abspath,
127 const char *local_abspath,
128 apr_pool_t *result_pool,
129 apr_pool_t *scratch_pool);
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
135 svn_wc__wq_build_dir_remove(svn_skel_t **work_item,
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);
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.
147 Perform temporary allocations in SCRATCH_POOL and *WORK_ITEM in
151 svn_wc__wq_build_file_move(svn_skel_t **work_item,
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);
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. */
163 svn_wc__wq_build_file_copy_translated(svn_skel_t **work_item,
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);
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. */
176 svn_wc__wq_build_sync_file_flags(svn_skel_t **work_item,
178 const char *local_abspath,
179 apr_pool_t *result_pool,
180 apr_pool_t *scratch_pool);
183 /* Set *WORK_ITEM to a new work item that will install a property reject
184 file for LOCAL_ABSPATH into the working copy.
187 svn_wc__wq_build_prej_install(svn_skel_t **work_item,
189 const char *local_abspath,
190 apr_pool_t *result_pool,
191 apr_pool_t *scratch_pool);
193 /* Handle the final post-commit step of retranslating and recording the
194 working copy state of a committed file.
196 If PROP_MODS is false, assume that properties are not changed.
198 (Property modifications are read when svn_wc__wq_build_file_commit
199 is called and processed when the working queue is being evaluated)
201 Allocate *work_item in RESULT_POOL. Perform temporary allocations
205 svn_wc__wq_build_file_commit(svn_skel_t **work_item,
207 const char *local_abspath,
208 svn_boolean_t prop_mods,
209 apr_pool_t *result_pool,
210 apr_pool_t *scratch_pool);
212 /* Set *WORK_ITEM to a new work item that will install the working
213 copy directory at LOCAL_ABSPATH. */
215 svn_wc__wq_build_dir_install(svn_skel_t **work_item,
217 const char *local_abspath,
218 apr_pool_t *result_pool,
219 apr_pool_t *scratch_pool);
222 svn_wc__wq_build_postupgrade(svn_skel_t **work_item,
223 apr_pool_t *scratch_pool);
227 #endif /* __cplusplus */
229 #endif /* SVN_WC_WORKQUEUE_H */