]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/libsvn_fs_fs/temp_serializer.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / libsvn_fs_fs / temp_serializer.h
1 /* temp_serializer.h : serialization functions for caching of FSFS structures
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__TEMP_SERIALIZER_H
24 #define SVN_LIBSVN_FS__TEMP_SERIALIZER_H
25
26 #include "fs.h"
27
28 /**
29  * Prepend the @a number to the @a string in a space efficient way such that
30  * no other (number,string) combination can produce the same result.
31  * Allocate temporaries as well as the result from @a pool.
32  */
33 const char*
34 svn_fs_fs__combine_number_and_string(apr_int64_t number,
35                                      const char *string,
36                                      apr_pool_t *pool);
37
38 /**
39  * Serialize a @a noderev_p within the serialization @a context.
40  */
41 void
42 svn_fs_fs__noderev_serialize(struct svn_temp_serializer__context_t *context,
43                              node_revision_t * const *noderev_p);
44
45 /**
46  * Deserialize a @a noderev_p within the @a buffer.
47  */
48 void
49 svn_fs_fs__noderev_deserialize(void *buffer,
50                                node_revision_t **noderev_p);
51
52 /**
53  * #svn_txdelta_window_t is not sufficient for caching the data it
54  * represents because data read process needs auxilliary information.
55  */
56 typedef struct
57 {
58   /* the txdelta window information cached / to be cached */
59   svn_txdelta_window_t *window;
60
61   /* the revision file read pointer position right after reading the window */
62   apr_off_t end_offset;
63 } svn_fs_fs__txdelta_cached_window_t;
64
65 /**
66  * Implements #svn_cache__serialize_func_t for
67  * #svn_fs_fs__txdelta_cached_window_t.
68  */
69 svn_error_t *
70 svn_fs_fs__serialize_txdelta_window(void **buffer,
71                                     apr_size_t *buffer_size,
72                                     void *item,
73                                     apr_pool_t *pool);
74
75 /**
76  * Implements #svn_cache__deserialize_func_t for
77  * #svn_fs_fs__txdelta_cached_window_t.
78  */
79 svn_error_t *
80 svn_fs_fs__deserialize_txdelta_window(void **item,
81                                       void *buffer,
82                                       apr_size_t buffer_size,
83                                       apr_pool_t *pool);
84
85 /**
86  * Implements #svn_cache__serialize_func_t for a manifest
87  * (@a in is an #apr_array_header_t of apr_off_t elements).
88  */
89 svn_error_t *
90 svn_fs_fs__serialize_manifest(void **data,
91                               apr_size_t *data_len,
92                               void *in,
93                               apr_pool_t *pool);
94
95 /**
96  * Implements #svn_cache__deserialize_func_t for a manifest
97  * (@a *out is an #apr_array_header_t of apr_off_t elements).
98  */
99 svn_error_t *
100 svn_fs_fs__deserialize_manifest(void **out,
101                                 void *data,
102                                 apr_size_t data_len,
103                                 apr_pool_t *pool);
104
105 /**
106  * Implements #svn_cache__serialize_func_t for a properties hash
107  * (@a in is an #apr_hash_t of svn_string_t elements, keyed by const char*).
108  */
109 svn_error_t *
110 svn_fs_fs__serialize_properties(void **data,
111                                 apr_size_t *data_len,
112                                 void *in,
113                                 apr_pool_t *pool);
114
115 /**
116  * Implements #svn_cache__deserialize_func_t for a properties hash
117  * (@a *out is an #apr_hash_t of svn_string_t elements, keyed by const char*).
118  */
119 svn_error_t *
120 svn_fs_fs__deserialize_properties(void **out,
121                                   void *data,
122                                   apr_size_t data_len,
123                                   apr_pool_t *pool);
124
125 /**
126  * Implements #svn_cache__serialize_func_t for #svn_fs_id_t
127  */
128 svn_error_t *
129 svn_fs_fs__serialize_id(void **data,
130                         apr_size_t *data_len,
131                         void *in,
132                         apr_pool_t *pool);
133
134 /**
135  * Implements #svn_cache__deserialize_func_t for #svn_fs_id_t
136  */
137 svn_error_t *
138 svn_fs_fs__deserialize_id(void **out,
139                           void *data,
140                           apr_size_t data_len,
141                           apr_pool_t *pool);
142
143 /**
144  * Implements #svn_cache__serialize_func_t for #node_revision_t
145  */
146 svn_error_t *
147 svn_fs_fs__serialize_node_revision(void **buffer,
148                                    apr_size_t *buffer_size,
149                                    void *item,
150                                    apr_pool_t *pool);
151
152 /**
153  * Implements #svn_cache__deserialize_func_t for #node_revision_t
154  */
155 svn_error_t *
156 svn_fs_fs__deserialize_node_revision(void **item,
157                                      void *buffer,
158                                      apr_size_t buffer_size,
159                                      apr_pool_t *pool);
160
161 /**
162  * Implements #svn_cache__serialize_func_t for a directory contents hash
163  */
164 svn_error_t *
165 svn_fs_fs__serialize_dir_entries(void **data,
166                                  apr_size_t *data_len,
167                                  void *in,
168                                  apr_pool_t *pool);
169
170 /**
171  * Implements #svn_cache__deserialize_func_t for a directory contents hash
172  */
173 svn_error_t *
174 svn_fs_fs__deserialize_dir_entries(void **out,
175                                    void *data,
176                                    apr_size_t data_len,
177                                    apr_pool_t *pool);
178
179 /**
180  * Implements #svn_cache__partial_getter_func_t.  Set (apr_off_t) @a *out
181  * to the element indexed by (apr_int64_t) @a *baton within the
182  * serialized manifest array @a data and @a data_len. */
183 svn_error_t *
184 svn_fs_fs__get_sharded_offset(void **out,
185                               const void *data,
186                               apr_size_t data_len,
187                               void *baton,
188                               apr_pool_t *pool);
189
190 /**
191  * Implements #svn_cache__partial_getter_func_t for a single
192  * #svn_fs_dirent_t within a serialized directory contents hash,
193  * identified by its name (const char @a *baton).
194  */
195 svn_error_t *
196 svn_fs_fs__extract_dir_entry(void **out,
197                              const void *data,
198                              apr_size_t data_len,
199                              void *baton,
200                              apr_pool_t *pool);
201
202 /**
203  * Describes the change to be done to a directory: Set the entry
204  * identify by @a name to the value @a new_entry. If the latter is
205  * @c NULL, the entry shall be removed if it exists. Otherwise it
206  * will be replaced or automatically added, respectively.
207  */
208 typedef struct replace_baton_t
209 {
210   /** name of the directory entry to modify */
211   const char *name;
212
213   /** directory entry to insert instead */
214   svn_fs_dirent_t *new_entry;
215 } replace_baton_t;
216
217 /**
218  * Implements #svn_cache__partial_setter_func_t for a single
219  * #svn_fs_dirent_t within a serialized directory contents hash,
220  * identified by its name in the #replace_baton_t in @a baton.
221  */
222 svn_error_t *
223 svn_fs_fs__replace_dir_entry(void **data,
224                              apr_size_t *data_len,
225                              void *baton,
226                              apr_pool_t *pool);
227
228 /**
229  * Implements #svn_cache__serialize_func_t for an #apr_array_header_t of
230  * #change_t *.
231  */
232 svn_error_t *
233 svn_fs_fs__serialize_changes(void **data,
234                              apr_size_t *data_len,
235                              void *in,
236                              apr_pool_t *pool);
237
238 /**
239  * Implements #svn_cache__deserialize_func_t for an #apr_array_header_t of
240  * #change_t *.
241  */
242 svn_error_t *
243 svn_fs_fs__deserialize_changes(void **out,
244                                void *data,
245                                apr_size_t data_len,
246                                apr_pool_t *pool);
247
248 /**
249  * Implements #svn_cache__serialize_func_t for #svn_mergeinfo_t objects.
250  */
251 svn_error_t *
252 svn_fs_fs__serialize_mergeinfo(void **data,
253                                apr_size_t *data_len,
254                                void *in,
255                                apr_pool_t *pool);
256
257 /**
258  * Implements #svn_cache__deserialize_func_t for #svn_mergeinfo_t objects.
259  */
260 svn_error_t *
261 svn_fs_fs__deserialize_mergeinfo(void **out,
262                                  void *data,
263                                  apr_size_t data_len,
264                                  apr_pool_t *pool);
265
266 #endif