1
/* noderevs.h --- FSX node revision 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__NODEREVS_H
24
#define SVN_LIBSVN_FS__NODEREVS_H
29
/* A collection of related noderevs tends to be widely redundant (similar
30
* paths, predecessor ID matching anothers ID, shared representations etc.)
31
* Also, the binary representation of a noderev can be much shorter than
32
* the ordinary textual variant.
34
* In its serialized form, the svn_fs_x__noderevs_t container extracts
35
* most of that redundancy and the run-time representation is also much
36
* smaller than sum of the respective svn_fs_x__noderev_t objects.
38
* As with other containers, this one has two modes: 'construction', in
39
* which you may add data to it, and 'getter' in which there is only r/o
43
/* An opaque collection of node revisions.
45
typedef struct svn_fs_x__noderevs_t svn_fs_x__noderevs_t;
47
/* Create and populate noderev containers. */
49
/* Create and return a new noderevs container with an initial capacity of
50
* INITIAL_COUNT svn_fs_x__noderev_t objects.
51
* Allocate the result in RESULT_POOL.
53
svn_fs_x__noderevs_t *
54
svn_fs_x__noderevs_create(int initial_count,
55
apr_pool_t *result_pool);
57
/* Add NODEREV to the CONTAINER. Return the index that identifies the new
58
* item in this container.
61
svn_fs_x__noderevs_add(svn_fs_x__noderevs_t *container,
62
svn_fs_x__noderev_t *noderev);
64
/* Return a rough estimate in bytes for the serialized representation
68
svn_fs_x__noderevs_estimate_size(const svn_fs_x__noderevs_t *container);
70
/* Read from noderev containers. */
72
/* From CONTAINER, extract the noderev with the given IDX. Allocate
73
* the result in POOL and return it in *NODEREV_P.
76
svn_fs_x__noderevs_get(svn_fs_x__noderev_t **noderev_p,
77
const svn_fs_x__noderevs_t *container,
83
/* Write a serialized representation of CONTAINER to STREAM.
84
* Use SCRATCH_POOL for temporary allocations.
87
svn_fs_x__write_noderevs_container(svn_stream_t *stream,
88
const svn_fs_x__noderevs_t *container,
89
apr_pool_t *scratch_pool);
91
/* Read a noderev container from its serialized representation in STREAM.
92
* Allocate the result in RESULT_POOL and return it in *CONTAINER. Use
93
* SCRATCH_POOL for temporary allocations.
96
svn_fs_x__read_noderevs_container(svn_fs_x__noderevs_t **container,
98
apr_pool_t *result_pool,
99
apr_pool_t *scratch_pool);
101
/* Implements #svn_cache__serialize_func_t for svn_fs_x__noderevs_t
105
svn_fs_x__serialize_noderevs_container(void **data,
106
apr_size_t *data_len,
110
/* Implements #svn_cache__deserialize_func_t for svn_fs_x__noderevs_t
114
svn_fs_x__deserialize_noderevs_container(void **out,
119
/* Implements svn_cache__partial_getter_func_t for svn_fs_x__noderevs_t,
120
* setting *OUT to the svn_fs_x__noderev_t selected by the apr_uint32_t index
121
* passed in as *BATON. This function is similar to svn_fs_x__noderevs_get
122
* but operates on the cache serialized representation of the container.
125
svn_fs_x__noderevs_get_func(void **out,
131
/* Implements svn_cache__partial_getter_func_t for the mergeinfo_count in
132
* the stored noderevs, setting *OUT to the apr_int64_t counter value of
133
* the noderev selected by the apr_uint32_t index passed in as *BATON.
136
svn_fs_x__mergeinfo_count_get_func(void **out,