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 /* Attempt to fetch the text representation of node-revision NODEREV as
85 seen in filesystem FS and pass it along with the BATON to the PROCESSOR.
86 Set *SUCCESS only of the data could be provided and the processing
88 Use POOL for all allocations.
91 svn_fs_fs__try_process_file_contents(svn_boolean_t *success,
93 node_revision_t *noderev,
94 svn_fs_process_contents_func_t processor,
98 /* Set *STREAM_P to a delta stream turning the contents of the file SOURCE into
99 the contents of the file TARGET, allocated in POOL.
100 If SOURCE is null, the empty string will be used. */
102 svn_fs_fs__get_file_delta_stream(svn_txdelta_stream_t **stream_p,
104 node_revision_t *source,
105 node_revision_t *target,
108 /* Set *ENTRIES to an apr_array_header_t of dirent structs that contain
109 the directory entries of node-revision NODEREV in filesystem FS. The
110 returned table is allocated in RESULT_POOL and entries are sorted
111 lexicographically. SCRATCH_POOL is used for temporary allocations. */
113 svn_fs_fs__rep_contents_dir(apr_array_header_t **entries_p,
115 node_revision_t *noderev,
116 apr_pool_t *result_pool,
117 apr_pool_t *scratch_pool);
119 /* Return the directory entry from ENTRIES that matches NAME. If no such
120 entry exists, return NULL. If HINT is not NULL, set *HINT to the array
121 index of the entry returned. Successive calls in a linear scan scenario
122 will be faster called with the same HINT variable. */
124 svn_fs_fs__find_dir_entry(apr_array_header_t *entries,
128 /* Set *DIRENT to the entry identified by NAME in the directory given
129 by NODEREV in filesystem FS. If no such entry exits, *DIRENT will
130 be NULL. The returned object is allocated in RESULT_POOL; SCRATCH_POOL
131 used for temporary allocations. */
133 svn_fs_fs__rep_contents_dir_entry(svn_fs_dirent_t **dirent,
135 node_revision_t *noderev,
137 apr_pool_t *result_pool,
138 apr_pool_t *scratch_pool);
140 /* Set *PROPLIST to be an apr_hash_t containing the property list of
141 node-revision NODEREV as seen in filesystem FS. Use POOL for
142 temporary allocations. */
144 svn_fs_fs__get_proplist(apr_hash_t **proplist,
146 node_revision_t *noderev,
149 /* Set *HAS_PROPS to TRUE if NODEREV has properties in FS, otherwise
150 to FALSE. Use SCRATCH_POOL for temporary allocations. */
152 svn_fs_fs__has_props(svn_boolean_t *has_props,
154 node_revision_t *noderev,
155 apr_pool_t *scratch_pool);
157 /* Fetch the list of change in revision REV in FS and return it in *CHANGES.
158 * Allocate the result in POOL.
161 svn_fs_fs__get_changes(apr_array_header_t **changes,