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 /* Set *NODEREV_P to the node-revision for the node ID in FS. Do any
34 allocations in POOL. */
36 svn_fs_fs__get_node_revision(node_revision_t **noderev_p,
38 const svn_fs_id_t *id,
39 apr_pool_t *result_pool,
40 apr_pool_t *scratch_pool);
42 /* Set *ROOT_ID to the node-id for the root of revision REV in
43 filesystem FS. Do any allocations in POOL. */
45 svn_fs_fs__rev_get_root(svn_fs_id_t **root_id,
48 apr_pool_t *result_pool,
49 apr_pool_t *scratch_pool);
51 /* Verify that representation REP in FS can be accessed. Successive calls
52 to this function should pass a non-NULL value to HINT. In that case,
53 many file open / close operations can be eliminated.
54 Do any allocations in SCRATCH_POOL. */
56 svn_fs_fs__check_rep(representation_t *rep,
59 apr_pool_t *scratch_pool);
61 /* Follow the representation delta chain in FS starting with REP. The
62 number of reps (including REP) in the chain will be returned in
63 *CHAIN_LENGTH. *SHARD_COUNT will be set to the number of shards
64 accessed. Do any allocations in SCRATCH_POOL. */
66 svn_fs_fs__rep_chain_length(int *chain_length,
68 representation_t *rep,
70 apr_pool_t *scratch_pool);
72 /* Set *CONTENTS to be a readable svn_stream_t that receives the text
73 representation REP as seen in filesystem FS. If CACHE_FULLTEXT is
74 not set, bypass fulltext cache lookup for this rep and don't put the
75 reconstructed fulltext into cache.
76 Use POOL for allocations. */
78 svn_fs_fs__get_contents(svn_stream_t **contents_p,
80 representation_t *rep,
81 svn_boolean_t cache_fulltext,
84 /* Set *CONTENTS_P to be a readable svn_stream_t that receives the text
85 representation REP as seen in filesystem FS. Read the latest element
86 of the delta chain from FILE at offset OFFSET.
87 Use POOL for allocations. */
89 svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p,
91 representation_t *rep,
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 POOL for all allocations.
103 svn_fs_fs__try_process_file_contents(svn_boolean_t *success,
105 node_revision_t *noderev,
106 svn_fs_process_contents_func_t processor,
110 /* Set *STREAM_P to a delta stream turning the contents of the file SOURCE into
111 the contents of the file TARGET, allocated in POOL.
112 If SOURCE is null, the empty string will be used. */
114 svn_fs_fs__get_file_delta_stream(svn_txdelta_stream_t **stream_p,
116 node_revision_t *source,
117 node_revision_t *target,
120 /* Set *ENTRIES to an apr_array_header_t of dirent structs that contain
121 the directory entries of node-revision NODEREV in filesystem FS. The
122 returned table is allocated in RESULT_POOL and entries are sorted
123 lexicographically. SCRATCH_POOL is used for temporary allocations. */
125 svn_fs_fs__rep_contents_dir(apr_array_header_t **entries_p,
127 node_revision_t *noderev,
128 apr_pool_t *result_pool,
129 apr_pool_t *scratch_pool);
131 /* Return the directory entry from ENTRIES that matches NAME. If no such
132 entry exists, return NULL. If HINT is not NULL, set *HINT to the array
133 index of the entry returned. Successive calls in a linear scan scenario
134 will be faster called with the same HINT variable. */
136 svn_fs_fs__find_dir_entry(apr_array_header_t *entries,
140 /* Set *DIRENT to the entry identified by NAME in the directory given
141 by NODEREV in filesystem FS. If no such entry exits, *DIRENT will
142 be NULL. The returned object is allocated in RESULT_POOL; SCRATCH_POOL
143 used for temporary allocations. */
145 svn_fs_fs__rep_contents_dir_entry(svn_fs_dirent_t **dirent,
147 node_revision_t *noderev,
149 apr_pool_t *result_pool,
150 apr_pool_t *scratch_pool);
152 /* Set *PROPLIST to be an apr_hash_t containing the property list of
153 node-revision NODEREV as seen in filesystem FS. Use POOL for
154 temporary allocations. */
156 svn_fs_fs__get_proplist(apr_hash_t **proplist,
158 node_revision_t *noderev,
161 /* Set *HAS_PROPS to TRUE if NODEREV has properties in FS, otherwise
162 to FALSE. Use SCRATCH_POOL for temporary allocations. */
164 svn_fs_fs__has_props(svn_boolean_t *has_props,
166 node_revision_t *noderev,
167 apr_pool_t *scratch_pool);
169 /* Fetch the list of change in revision REV in FS and return it in *CHANGES.
170 * Allocate the result in POOL.
173 svn_fs_fs__get_changes(apr_array_header_t **changes,