1 /* temp_serializer.h : serialization functions for caching of FSX structures
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
20 * ====================================================================
23 #ifndef SVN_LIBSVN_FS__TEMP_SERIALIZER_H
24 #define SVN_LIBSVN_FS__TEMP_SERIALIZER_H
26 #include "private/svn_temp_serializer.h"
30 * Prepend the @a number to the @a string in a space efficient way such that
31 * no other (number,string) combination can produce the same result.
32 * Allocate temporaries as well as the result from @a pool.
35 svn_fs_x__combine_number_and_string(apr_int64_t number,
40 * Serialize a @a noderev_p within the serialization @a context.
43 svn_fs_x__noderev_serialize(struct svn_temp_serializer__context_t *context,
44 svn_fs_x__noderev_t * const *noderev_p);
47 * Deserialize a @a noderev_p within the @a buffer and associate it with
51 svn_fs_x__noderev_deserialize(void *buffer,
52 svn_fs_x__noderev_t **noderev_p,
56 * Serialize APR array @a *a within the serialization @a context.
57 * The elements within the array must not contain pointers.
60 svn_fs_x__serialize_apr_array(struct svn_temp_serializer__context_t *context,
61 apr_array_header_t **a);
64 * Deserialize APR @a *array within the @a buffer. Set its pool member to
65 * @a pool. The elements within the array must not contain pointers.
68 svn_fs_x__deserialize_apr_array(void *buffer,
69 apr_array_header_t **array,
74 * #svn_txdelta_window_t is not sufficient for caching the data it
75 * represents because data read process needs auxiliary information.
79 /* the txdelta window information cached / to be cached */
80 svn_txdelta_window_t *window;
82 /* the revision file read pointer position before reading the window */
83 apr_off_t start_offset;
85 /* the revision file read pointer position right after reading the window */
87 } svn_fs_x__txdelta_cached_window_t;
90 * Implements #svn_cache__serialize_func_t for
91 * #svn_fs_x__txdelta_cached_window_t.
94 svn_fs_x__serialize_txdelta_window(void **buffer,
95 apr_size_t *buffer_size,
100 * Implements #svn_cache__deserialize_func_t for
101 * #svn_fs_x__txdelta_cached_window_t.
104 svn_fs_x__deserialize_txdelta_window(void **item,
106 apr_size_t buffer_size,
110 * Implements #svn_cache__serialize_func_t for a manifest
111 * (@a in is an #apr_array_header_t of apr_off_t elements).
114 svn_fs_x__serialize_manifest(void **data,
115 apr_size_t *data_len,
120 * Implements #svn_cache__deserialize_func_t for a manifest
121 * (@a *out is an #apr_array_header_t of apr_off_t elements).
124 svn_fs_x__deserialize_manifest(void **out,
130 * Implements #svn_cache__serialize_func_t for a properties hash
131 * (@a in is an #apr_hash_t of svn_string_t elements, keyed by const char*).
134 svn_fs_x__serialize_properties(void **data,
135 apr_size_t *data_len,
140 * Implements #svn_cache__deserialize_func_t for a properties hash
141 * (@a *out is an #apr_hash_t of svn_string_t elements, keyed by const char*).
144 svn_fs_x__deserialize_properties(void **out,
150 * Implements #svn_cache__serialize_func_t for #svn_fs_x__noderev_t
153 svn_fs_x__serialize_node_revision(void **buffer,
154 apr_size_t *buffer_size,
159 * Implements #svn_cache__deserialize_func_t for #svn_fs_x__noderev_t
162 svn_fs_x__deserialize_node_revision(void **item,
164 apr_size_t buffer_size,
168 * Implements #svn_cache__serialize_func_t for a directory contents array
171 svn_fs_x__serialize_dir_entries(void **data,
172 apr_size_t *data_len,
177 * Implements #svn_cache__deserialize_func_t for a directory contents array
180 svn_fs_x__deserialize_dir_entries(void **out,
186 * Implements #svn_cache__partial_getter_func_t. Set (apr_off_t) @a *out
187 * to the element indexed by (apr_int64_t) @a *baton within the
188 * serialized manifest array @a data and @a data_len. */
190 svn_fs_x__get_sharded_offset(void **out,
197 * Baton type to be used with svn_fs_x__extract_dir_entry. */
198 typedef struct svn_fs_x__ede_baton_t
200 /* Name of the directory entry to find. */
203 /* Lookup hint [in / out] */
205 } svn_fs_x__ede_baton_t;
208 * Implements #svn_cache__partial_getter_func_t for a single
209 * #svn_fs_x__dirent_t within a serialized directory contents hash,
210 * identified by its name (given in @a svn_fs_x__ede_baton_t @a *baton).
213 svn_fs_x__extract_dir_entry(void **out,
220 * Describes the change to be done to a directory: Set the entry
221 * identify by @a name to the value @a new_entry. If the latter is
222 * @c NULL, the entry shall be removed if it exists. Otherwise it
223 * will be replaced or automatically added, respectively.
225 typedef struct replace_baton_t
227 /** name of the directory entry to modify */
230 /** directory entry to insert instead */
231 svn_fs_x__dirent_t *new_entry;
235 * Implements #svn_cache__partial_setter_func_t for a single
236 * #svn_fs_x__dirent_t within a serialized directory contents hash,
237 * identified by its name in the #replace_baton_t in @a baton.
240 svn_fs_x__replace_dir_entry(void **data,
241 apr_size_t *data_len,
246 * Implements #svn_cache__serialize_func_t for a #svn_fs_x__rep_header_t.
249 svn_fs_x__serialize_rep_header(void **data,
250 apr_size_t *data_len,
255 * Implements #svn_cache__deserialize_func_t for a #svn_fs_x__rep_header_t.
258 svn_fs_x__deserialize_rep_header(void **out,
264 * Implements #svn_cache__serialize_func_t for an #apr_array_header_t of
265 * #svn_fs_x__change_t *.
268 svn_fs_x__serialize_changes(void **data,
269 apr_size_t *data_len,
274 * Implements #svn_cache__deserialize_func_t for an #apr_array_header_t of
275 * #svn_fs_x__change_t *.
278 svn_fs_x__deserialize_changes(void **out,
284 * Implements #svn_cache__serialize_func_t for #svn_mergeinfo_t objects.
287 svn_fs_x__serialize_mergeinfo(void **data,
288 apr_size_t *data_len,
293 * Implements #svn_cache__deserialize_func_t for #svn_mergeinfo_t objects.
296 svn_fs_x__deserialize_mergeinfo(void **out,