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 svn_wc__wq_merge(svn_skel_t *work_item1,
79 svn_skel_t *work_item2,
80 apr_pool_t *result_pool);
83 /* For the WCROOT identified by the DB and WRI_ABSPATH pair, run any
84 work items that may be present in its workqueue. */
86 svn_wc__wq_run(svn_wc__db_t *db,
87 const char *wri_abspath,
88 svn_cancel_func_t cancel_func,
90 apr_pool_t *scratch_pool);
93 /* Set *WORK_ITEM to a new work item that will install the working
94 copy file at LOCAL_ABSPATH. If USE_COMMIT_TIMES is TRUE, then the newly
95 installed file will use the nodes CHANGE_DATE for the file timestamp.
96 If RECORD_FILEINFO is TRUE, then the resulting RECORDED_TIME and
97 RECORDED_SIZE will be recorded in the database.
99 If SOURCE_ABSPATH is NULL, then the pristine contents will be installed
100 (with appropriate translation). If SOURCE_ABSPATH is not NULL, then it
101 specifies a source file for the translation. The file must exist for as
102 long as *WORK_ITEM exists (and is queued). Typically, it will be a
103 temporary file, and an OP_FILE_REMOVE will be queued to later remove it.
106 svn_wc__wq_build_file_install(svn_skel_t **work_item,
108 const char *local_abspath,
109 const char *source_abspath,
110 svn_boolean_t use_commit_times,
111 svn_boolean_t record_fileinfo,
112 apr_pool_t *result_pool,
113 apr_pool_t *scratch_pool);
116 /* Set *WORK_ITEM to a new work item that will remove a single
117 file LOCAL_ABSPATH from the working copy identified by the pair DB,
120 svn_wc__wq_build_file_remove(svn_skel_t **work_item,
122 const char *wri_abspath,
123 const char *local_abspath,
124 apr_pool_t *result_pool,
125 apr_pool_t *scratch_pool);
127 /* Set *WORK_ITEM to a new work item that will remove a single
128 directory or if RECURSIVE is TRUE a directory with all its
131 svn_wc__wq_build_dir_remove(svn_skel_t **work_item,
133 const char *wri_abspath,
134 const char *local_abspath,
135 svn_boolean_t recursive,
136 apr_pool_t *result_pool,
137 apr_pool_t *scratch_pool);
139 /* Set *WORK_ITEM to a new work item that describes a move of
140 a file or directory from SRC_ABSPATH to DST_ABSPATH, ready for
141 storing in the working copy managing DST_ABSPATH.
143 Perform temporary allocations in SCRATCH_POOL and *WORK_ITEM in
147 svn_wc__wq_build_file_move(svn_skel_t **work_item,
149 const char *wri_abspath,
150 const char *src_abspath,
151 const char *dst_abspath,
152 apr_pool_t *result_pool,
153 apr_pool_t *scratch_pool);
155 /* Set *WORK_ITEM to a new work item that describes a copy from
156 SRC_ABSPATH to DST_ABSPATH, while translating the stream using
157 the information from LOCAL_ABSPATH. */
159 svn_wc__wq_build_file_copy_translated(svn_skel_t **work_item,
161 const char *local_abspath,
162 const char *src_abspath,
163 const char *dst_abspath,
164 apr_pool_t *result_pool,
165 apr_pool_t *scratch_pool);
168 /* Set *WORK_ITEM to a new work item that will synchronize the
169 target node's readonly and executable flags with the values defined
170 by its properties and lock status. */
172 svn_wc__wq_build_sync_file_flags(svn_skel_t **work_item,
174 const char *local_abspath,
175 apr_pool_t *result_pool,
176 apr_pool_t *scratch_pool);
179 /* Set *WORK_ITEM to a new work item that will install a property reject
180 file for LOCAL_ABSPATH into the working copy. The property conflicts will
181 be taken from CONFLICT_SKEL.
183 ### Caution: Links CONFLICT_SKEL into the *WORK_ITEM, which involves
184 modifying *CONFLICT_SKEL.
186 ### TODO: Make CONFLICT_SKEL 'const' and dup it into RESULT_POOL.
188 ### TODO: If CONFLICT_SKEL is NULL, take property conflicts from wc_db
189 for the given DB/LOCAL_ABSPATH.
192 svn_wc__wq_build_prej_install(svn_skel_t **work_item,
194 const char *local_abspath,
195 svn_skel_t *conflict_skel,
196 apr_pool_t *result_pool,
197 apr_pool_t *scratch_pool);
199 /* Handle the final post-commit step of retranslating and recording the
200 working copy state of a committed file.
202 If PROP_MODS is false, assume that properties are not changed.
204 (Property modifications are read when svn_wc__wq_build_file_commit
205 is called and processed when the working queue is being evaluated)
207 Allocate *work_item in RESULT_POOL. Perform temporary allocations
211 svn_wc__wq_build_file_commit(svn_skel_t **work_item,
213 const char *local_abspath,
214 svn_boolean_t prop_mods,
215 apr_pool_t *result_pool,
216 apr_pool_t *scratch_pool);
218 /* Set *WORK_ITEM to a new work item that will install the working
219 copy directory at LOCAL_ABSPATH. */
221 svn_wc__wq_build_dir_install(svn_skel_t **work_item,
223 const char *local_abspath,
224 apr_pool_t *scratch_pool,
225 apr_pool_t *result_pool);
228 svn_wc__wq_build_postupgrade(svn_skel_t **work_item,
229 apr_pool_t *scratch_pool);
233 #endif /* __cplusplus */
235 #endif /* SVN_WC_WORKQUEUE_H */