1 /* cached_data.h --- cached (read) access to FSX data
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__CACHED_DATA_H
24 #define SVN_LIBSVN_FS__CACHED_DATA_H
26 #include "svn_pools.h"
34 /* Set *NODEREV_P to the node-revision for the node ID in FS. Do any
35 allocations in POOL. */
37 svn_fs_x__get_node_revision(svn_fs_x__noderev_t **noderev_p,
39 const svn_fs_x__id_t *id,
40 apr_pool_t *result_pool,
41 apr_pool_t *scratch_pool);
43 /* Set *COUNT to the value of the mergeinfo_count member of the node-
44 revision for the node ID in FS. Do temporary allocations in SCRATCH_POOL.
47 svn_fs_x__get_mergeinfo_count(apr_int64_t *count,
49 const svn_fs_x__id_t *id,
50 apr_pool_t *scratch_pool);
52 /* Verify that representation REP in FS can be accessed.
53 Do any allocations in SCRATCH_POOL. */
55 svn_fs_x__check_rep(svn_fs_x__representation_t *rep,
57 apr_pool_t *scratch_pool);
59 /* Follow the representation delta chain in FS starting with REP. The
60 number of reps (including REP) in the chain will be returned in
61 *CHAIN_LENGTH. *SHARD_COUNT will be set to the number of shards
62 accessed. Do any allocations in SCRATCH_POOL. */
64 svn_fs_x__rep_chain_length(int *chain_length,
66 svn_fs_x__representation_t *rep,
68 apr_pool_t *scratch_pool);
70 /* Set *CONTENTS to be a readable svn_stream_t that receives the text
71 representation REP as seen in filesystem FS. If CACHE_FULLTEXT is
72 not set, bypass fulltext cache lookup for this rep and don't put the
73 reconstructed fulltext into cache.
74 Allocate *CONTENT_P in RESULT_POOL. */
76 svn_fs_x__get_contents(svn_stream_t **contents_p,
78 svn_fs_x__representation_t *rep,
79 svn_boolean_t cache_fulltext,
80 apr_pool_t *result_pool);
82 /* Determine on-disk and expanded sizes of the representation identified
83 * by ENTRY in FS and return the result in PACKED_LEN and EXPANDED_LEN,
84 * respectively. FILE must point to the start of the representation and
85 * STREAM must be a stream defined on top of FILE.
86 * Use SCRATCH_POOL for temporary allocations.
89 svn_fs_x__get_representation_length(svn_filesize_t *packed_len,
90 svn_filesize_t *expanded_len,
92 svn_fs_x__revision_file_t *rev_file,
93 svn_fs_x__p2l_entry_t* entry,
94 apr_pool_t *scratch_pool);
96 /* Attempt to fetch the text representation of node-revision NODEREV as
97 seen in filesystem FS and pass it along with the BATON to the PROCESSOR.
98 Set *SUCCESS only of the data could be provided and the processing
100 Use SCRATCH_POOL for temporary allocations.
103 svn_fs_x__try_process_file_contents(svn_boolean_t *success,
105 svn_fs_x__noderev_t *noderev,
106 svn_fs_process_contents_func_t processor,
108 apr_pool_t *scratch_pool);
110 /* Set *STREAM_P to a delta stream turning the contents of the file SOURCE
111 into the contents of the file TARGET, allocated in RESULT_POOL.
112 If SOURCE is NULL, an empty string will be used in its stead.
113 Use SCRATCH_POOL for temporary allocations.
116 svn_fs_x__get_file_delta_stream(svn_txdelta_stream_t **stream_p,
118 svn_fs_x__noderev_t *source,
119 svn_fs_x__noderev_t *target,
120 apr_pool_t *result_pool,
121 apr_pool_t *scratch_pool);
123 /* Set *ENTRIES to an apr_array_header_t of dirent structs that contain
124 the directory entries of node-revision NODEREV in filesystem FS. The
125 returned table is allocated in RESULT_POOL and entries are sorted
126 lexicographically. SCRATCH_POOL is used for temporary allocations. */
128 svn_fs_x__rep_contents_dir(apr_array_header_t **entries_p,
130 svn_fs_x__noderev_t *noderev,
131 apr_pool_t *result_pool,
132 apr_pool_t *scratch_pool);
134 /* Return the directory entry from ENTRIES that matches NAME. If no such
135 entry exists, return NULL. If HINT is not NULL, set *HINT to the array
136 index of the entry returned. Successive calls in a linear scan scenario
137 will be faster called with the same HINT variable. */
139 svn_fs_x__find_dir_entry(apr_array_header_t *entries,
143 /* Set *DIRENT to the entry identified by NAME in the directory given
144 by NODEREV in filesystem FS. If no such entry exits, *DIRENT will
145 be NULL. The value referenced by HINT can be used to speed up
146 consecutive calls when travering the directory in name order.
147 Any value is allowed, however APR_SIZE_MAX gives best performance
148 when there has been no previous lookup for the same directory.
150 The returned object is allocated in RESULT_POOL; SCRATCH_POOL
151 used for temporary allocations. */
153 svn_fs_x__rep_contents_dir_entry(svn_fs_x__dirent_t **dirent,
155 svn_fs_x__noderev_t *noderev,
158 apr_pool_t *result_pool,
159 apr_pool_t *scratch_pool);
161 /* Set *PROPLIST to be an apr_hash_t containing the property list of
162 node-revision NODEREV as seen in filesystem FS. Allocate the result
163 in RESULT_POOL and use SCRATCH_POOL for temporary allocations. */
165 svn_fs_x__get_proplist(apr_hash_t **proplist,
167 svn_fs_x__noderev_t *noderev,
168 apr_pool_t *result_pool,
169 apr_pool_t *scratch_pool);
171 /* Fetch the list of change in revision REV in FS and return it in *CHANGES.
172 * Allocate the result in POOL.
175 svn_fs_x__get_changes(apr_array_header_t **changes,