1 /**
2  * @copyright
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  * @endcopyright
22  *
23  * @file svn_branch_impl.h
24  * @brief Declarations needed by implementators of branch classes
25  *
26  * @since New in ???.
27  */
28 
29 #ifndef SVN_BRANCH_IMPL_H
30 #define SVN_BRANCH_IMPL_H
31 
32 #include "private/svn_branch.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 
39 /* Common aspects od a txn/branch 'editor' class (derived from Ev2) */
40 typedef struct svn_branch__vtable_priv_t
41 {
42   /* Standard cancellation function. Called before each callback.  */
43   svn_cancel_func_t cancel_func;
44   void *cancel_baton;
45 
46 #ifdef ENABLE_ORDERING_CHECK
47   svn_boolean_t within_callback;
48   svn_boolean_t finished;
49   apr_pool_t *state_pool;
50 #endif
51 
52 } svn_branch__vtable_priv_t;
53 
54 /* The methods of svn_branch__txn_t.
55  * See the corresponding public API functions for details.
56  */
57 
58 typedef apr_array_header_t *(*svn_branch__txn_v_get_branches_t)(
59   const svn_branch__txn_t *txn,
60   apr_pool_t *result_pool);
61 
62 typedef svn_error_t *(*svn_branch__txn_v_delete_branch_t)(
63   svn_branch__txn_t *txn,
64   const char *bid,
65   apr_pool_t *scratch_pool);
66 
67 typedef svn_error_t *(*svn_branch__txn_v_get_num_new_eids_t)(
68   const svn_branch__txn_t *txn,
69   int *num_new_eids_p,
70   apr_pool_t *scratch_pool);
71 
72 typedef svn_error_t *(*svn_branch__txn_v_new_eid_t)(
73   svn_branch__txn_t *txn,
74   svn_branch__eid_t *eid_p,
75   apr_pool_t *scratch_pool);
76 
77 typedef svn_error_t *(*svn_branch__txn_v_open_branch_t)(
78   svn_branch__txn_t *txn,
79   svn_branch__state_t **new_branch_p,
80   const char *new_branch_id,
81   int root_eid,
82   svn_branch__rev_bid_eid_t *from,
83   apr_pool_t *result_pool,
84   apr_pool_t *scratch_pool);
85 
86 typedef svn_error_t *(*svn_branch__txn_v_finalize_eids_t)(
87   svn_branch__txn_t *txn,
88   apr_pool_t *scratch_pool);
89 
90 typedef svn_error_t *(*svn_branch__txn_v_serialize_t)(
91   svn_branch__txn_t *txn,
92   svn_stream_t *stream,
93   apr_pool_t *scratch_pool);
94 
95 typedef svn_error_t *(*svn_branch__txn_v_sequence_point_t)(
96   svn_branch__txn_t *txn,
97   apr_pool_t *scratch_pool);
98 
99 typedef svn_error_t *(*svn_branch__txn_v_complete_t)(
100   svn_branch__txn_t *txn,
101   apr_pool_t *scratch_pool);
102 
103 typedef svn_error_t *(*svn_branch__txn_v_abort_t)(
104   svn_branch__txn_t *txn,
105   apr_pool_t *scratch_pool);
106 
107 struct svn_branch__txn_vtable_t
108 {
109   svn_branch__vtable_priv_t vpriv;
110 
111   /* Methods. */
112   svn_branch__txn_v_get_branches_t get_branches;
113   svn_branch__txn_v_delete_branch_t delete_branch;
114   svn_branch__txn_v_get_num_new_eids_t get_num_new_eids;
115   svn_branch__txn_v_new_eid_t new_eid;
116   svn_branch__txn_v_open_branch_t open_branch;
117   svn_branch__txn_v_finalize_eids_t finalize_eids;
118   svn_branch__txn_v_serialize_t serialize;
119   svn_branch__txn_v_sequence_point_t sequence_point;
120   svn_branch__txn_v_complete_t complete;
121   svn_branch__txn_v_complete_t abort;
122 
123 };
124 
125 /* The methods of svn_branch__state_t.
126  * See the corresponding public API functions for details.
127  */
128 
129 typedef svn_error_t *(*svn_branch__state_v_get_elements_t)(
130   const svn_branch__state_t *branch,
131   svn_element__tree_t **element_tree_p,
132   apr_pool_t *result_pool);
133 
134 typedef svn_error_t *(*svn_branch__state_v_get_element_t)(
135   const svn_branch__state_t *branch,
136   svn_element__content_t **element_p,
137   int eid,
138   apr_pool_t *result_pool);
139 
140 typedef svn_error_t *(*svn_branch__state_v_set_element_t)(
141   svn_branch__state_t *branch,
142   svn_branch__eid_t eid,
143   const svn_element__content_t *element,
144   apr_pool_t *scratch_pool);
145 
146 typedef svn_error_t *(*svn_branch__state_v_copy_one_t)(
147   svn_branch__state_t *branch,
148   const svn_branch__rev_bid_eid_t *src_el_rev,
149   svn_branch__eid_t local_eid,
150   svn_branch__eid_t new_parent_eid,
151   const char *new_name,
152   const svn_element__payload_t *new_payload,
153   apr_pool_t *scratch_pool);
154 
155 typedef svn_error_t *(*svn_branch__state_v_copy_tree_t)(
156   svn_branch__state_t *branch,
157   const svn_branch__rev_bid_eid_t *src_el_rev,
158   svn_branch__eid_t new_parent_eid,
159   const char *new_name,
160   apr_pool_t *scratch_pool);
161 
162 typedef svn_error_t *(*svn_branch__state_v_purge_t)(
163   svn_branch__state_t *branch,
164   apr_pool_t *scratch_pool);
165 
166 typedef svn_error_t *(*svn_branch__state_v_get_history_t)(
167   svn_branch__state_t *branch,
168   svn_branch__history_t **history_p,
169   apr_pool_t *scratch_pool);
170 
171 typedef svn_error_t *(*svn_branch__state_v_set_history_t)(
172   svn_branch__state_t *branch,
173   const svn_branch__history_t *history,
174   apr_pool_t *scratch_pool);
175 
176 struct svn_branch__state_vtable_t
177 {
178   svn_branch__vtable_priv_t vpriv;
179 
180   svn_branch__state_v_get_elements_t get_elements;
181   svn_branch__state_v_get_element_t get_element;
182   svn_branch__state_v_set_element_t set_element;
183   svn_branch__state_v_copy_one_t copy_one;
184   svn_branch__state_v_copy_tree_t copy_tree;
185   svn_branch__state_v_purge_t purge;
186   svn_branch__state_v_get_history_t get_history;
187   svn_branch__state_v_set_history_t set_history;
188 
189 };
190 
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #endif /* SVN_BRANCH_IMPL_H */
197 
198