1 /* changes.h --- FSX changed paths lists container
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_X_CHANGES_H
24 #define SVN_LIBSVN_FS_X_CHANGES_H
29 /* Entries in a revision's change list tend to be widely redundant (similar
30 * changes to similar paths). Even more so, change lists from a larger
31 * revision range also tend to overlap.
33 * In its serialized form, the svn_fs_x__changes_t container extracts most
34 * of that redundancy and the run-time representation is also much smaller
35 * than sum of the respective svn_fs_x__change_t* arrays.
37 * As with other containers, this one has two modes: 'construction', in
38 * which you may add data to it, and 'getter' in which there is only r/o
42 /* An opaque collection of change lists (apr_array_header_t * of
43 * svn_fs_x__change_t *).
45 typedef struct svn_fs_x__changes_t svn_fs_x__changes_t
;
47 /* Create and populate changes containers. */
49 /* Create and return a new changes container with an initial capacity of
50 * INITIAL_COUNT svn_fs_x__change_t objects.
51 * Allocate the result in RESULT_POOL.
54 svn_fs_x__changes_create(apr_size_t initial_count
,
55 apr_pool_t
*result_pool
);
57 /* Start a new change list CHANGES (implicitly terminating the previous one)
58 * and return its index in *LIST_INDEX. Append all changes from LIST to
59 * that new change list.
62 svn_fs_x__changes_append_list(apr_size_t
*list_index
,
63 svn_fs_x__changes_t
*changes
,
64 apr_array_header_t
*list
);
66 /* Return a rough estimate in bytes for the serialized representation
70 svn_fs_x__changes_estimate_size(const svn_fs_x__changes_t
*changes
);
72 /* Read changes containers. */
74 /* From CHANGES, access the change list with the given IDX and extract the
75 * next entries according to CONTEXT. Allocate the result in RESULT_POOL
76 * and return it in *LIST.
79 svn_fs_x__changes_get_list(apr_array_header_t
**list
,
80 const svn_fs_x__changes_t
*changes
,
82 svn_fs_x__changes_context_t
*context
,
83 apr_pool_t
*result_pool
);
87 /* Write a serialized representation of CHANGES to STREAM.
88 * Use SCRATCH_POOL for temporary allocations.
91 svn_fs_x__write_changes_container(svn_stream_t
*stream
,
92 const svn_fs_x__changes_t
*changes
,
93 apr_pool_t
*scratch_pool
);
95 /* Read a changes container from its serialized representation in STREAM.
96 * Allocate the result in RESULT_POOL and return it in *CHANGES_P. Use
97 * SCRATCH_POOL for temporary allocations.
100 svn_fs_x__read_changes_container(svn_fs_x__changes_t
**changes_p
,
101 svn_stream_t
*stream
,
102 apr_pool_t
*result_pool
,
103 apr_pool_t
*scratch_pool
);
105 /* Implements #svn_cache__serialize_func_t for svn_fs_x__changes_t objects.
108 svn_fs_x__serialize_changes_container(void **data
,
109 apr_size_t
*data_len
,
113 /* Implements #svn_cache__deserialize_func_t for svn_fs_x__changes_t objects.
116 svn_fs_x__deserialize_changes_container(void **out
,
119 apr_pool_t
*result_pool
);
121 /* Baton type to be used with svn_fs_x__changes_get_list_func. */
122 typedef struct svn_fs_x__changes_get_list_baton_t
124 /* Sub-item to query */
125 apr_uint32_t sub_item
;
127 /* Deliver data starting from this index within the changes list. */
130 /* To be set by svn_fs_x__changes_get_list_func:
131 Did we deliver the last change in that list? */
133 } svn_fs_x__changes_get_list_baton_t
;
135 /* Implements svn_cache__partial_getter_func_t for svn_fs_x__changes_t,
136 * setting *OUT to the change list (apr_array_header_t *) selected by
137 * the svn_fs_x__changes_get_list_baton_t passed in as *BATON. This
138 * function is similar to svn_fs_x__changes_get_list but operates on
139 * the cache serialized representation of the container.
142 svn_fs_x__changes_get_list_func(void **out
,