1 /* cached_data.h --- cached (read) access to FSFS 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"
33 /* Resolve a FSFS quirk: if REP in FS is a "PLAIN" representation, its
34 * EXPANDED_SIZE element may be 0, in which case its value has to be taken
37 * This function ensures that EXPANDED_SIZE in REP always contains the
38 * actual value. No-op if REP is NULL. Uses SCRATCH_POOL for temporaries.
41 svn_fs_fs__fixup_expanded_size(svn_fs_t *fs,
42 representation_t *rep,
43 apr_pool_t *scratch_pool);
45 /* Set *NODEREV_P to the node-revision for the node ID in FS. Do any
46 allocations in POOL. */
48 svn_fs_fs__get_node_revision(node_revision_t **noderev_p,
50 const svn_fs_id_t *id,
51 apr_pool_t *result_pool,
52 apr_pool_t *scratch_pool);
54 /* Set *ROOT_ID to the node-id for the root of revision REV in
55 filesystem FS. Do any allocations in POOL. */
57 svn_fs_fs__rev_get_root(svn_fs_id_t **root_id,
60 apr_pool_t *result_pool,
61 apr_pool_t *scratch_pool);
63 /* Verify that representation REP in FS can be accessed. Successive calls
64 to this function should pass a non-NULL value to HINT. In that case,
65 many file open / close operations can be eliminated.
66 Do any allocations in SCRATCH_POOL. */
68 svn_fs_fs__check_rep(representation_t *rep,
71 apr_pool_t *scratch_pool);
73 /* Follow the representation delta chain in FS starting with REP. The
74 number of reps (including REP) in the chain will be returned in
75 *CHAIN_LENGTH. *SHARD_COUNT will be set to the number of shards
76 accessed. Do any allocations in SCRATCH_POOL. */
78 svn_fs_fs__rep_chain_length(int *chain_length,
80 representation_t *rep,
82 apr_pool_t *scratch_pool);
84 /* Set *CONTENTS_P to be a readable svn_stream_t that receives the text
85 representation REP as seen in filesystem FS. If CACHE_FULLTEXT is
86 not set, bypass fulltext cache lookup for this rep and don't put the
87 reconstructed fulltext into cache.
88 Use POOL for allocations. */
90 svn_fs_fs__get_contents(svn_stream_t **contents_p,
92 representation_t *rep,
93 svn_boolean_t cache_fulltext,
96 /* Set *CONTENTS_P to be a readable svn_stream_t that receives the text
97 representation REP as seen in filesystem FS. Read the latest element
98 of the delta chain from FILE at offset OFFSET.
99 Use POOL for allocations. */
101 svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p,
103 representation_t *rep,
108 /* Attempt to fetch the text representation of node-revision NODEREV as
109 seen in filesystem FS and pass it along with the BATON to the PROCESSOR.
110 Set *SUCCESS only of the data could be provided and the processing
112 Use POOL for all allocations.
115 svn_fs_fs__try_process_file_contents(svn_boolean_t *success,
117 node_revision_t *noderev,
118 svn_fs_process_contents_func_t processor,
122 /* Set *STREAM_P to a delta stream turning the contents of the file SOURCE into
123 the contents of the file TARGET, allocated in POOL.
124 If SOURCE is null, the empty string will be used. */
126 svn_fs_fs__get_file_delta_stream(svn_txdelta_stream_t **stream_p,
128 node_revision_t *source,
129 node_revision_t *target,
132 /* Set *ENTRIES to an apr_array_header_t of dirent structs that contain
133 the directory entries of node-revision NODEREV in filesystem FS. The
134 returned table is allocated in RESULT_POOL and entries are sorted
135 lexicographically. SCRATCH_POOL is used for temporary allocations. */
137 svn_fs_fs__rep_contents_dir(apr_array_header_t **entries_p,
139 node_revision_t *noderev,
140 apr_pool_t *result_pool,
141 apr_pool_t *scratch_pool);
143 /* Return the directory entry from ENTRIES that matches NAME. If no such
144 entry exists, return NULL. If HINT is not NULL, set *HINT to the array
145 index of the entry returned. Successive calls in a linear scan scenario
146 will be faster called with the same HINT variable. */
148 svn_fs_fs__find_dir_entry(apr_array_header_t *entries,
152 /* Set *DIRENT to the entry identified by NAME in the directory given
153 by NODEREV in filesystem FS. If no such entry exits, *DIRENT will
154 be NULL. The returned object is allocated in RESULT_POOL; SCRATCH_POOL
155 used for temporary allocations. */
157 svn_fs_fs__rep_contents_dir_entry(svn_fs_dirent_t **dirent,
159 node_revision_t *noderev,
161 apr_pool_t *result_pool,
162 apr_pool_t *scratch_pool);
164 /* Set *PROPLIST to be an apr_hash_t containing the property list of
165 node-revision NODEREV as seen in filesystem FS. Use POOL for
166 temporary allocations. */
168 svn_fs_fs__get_proplist(apr_hash_t **proplist,
170 node_revision_t *noderev,
173 /* Create a changes retrieval context object in *RESULT_POOL and return it
174 * in *CONTEXT. It will allow svn_fs_x__get_changes to fetch consecutive
175 * blocks (one per invocation) from REV's changed paths list in FS. */
177 svn_fs_fs__create_changes_context(svn_fs_fs__changes_context_t **context,
180 apr_pool_t *result_pool);
182 /* Fetch the block of changes from the CONTEXT and return it in *CHANGES.
183 * Allocate the result in RESULT_POOL and use SCRATCH_POOL for temporaries.
186 svn_fs_fs__get_changes(apr_array_header_t **changes,
187 svn_fs_fs__changes_context_t *context,
188 apr_pool_t *result_pool,
189 apr_pool_t *scratch_pool);