]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/subversion/subversion/libsvn_fs_fs/cached_data.h
Update svn-1.9.7 to 1.10.0.
[FreeBSD/FreeBSD.git] / contrib / subversion / subversion / libsvn_fs_fs / cached_data.h
1 /* cached_data.h --- cached (read) access to FSFS data
2  *
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
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
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
19  *    under the License.
20  * ====================================================================
21  */
22
23 #ifndef SVN_LIBSVN_FS__CACHED_DATA_H
24 #define SVN_LIBSVN_FS__CACHED_DATA_H
25
26 #include "svn_pools.h"
27 #include "svn_fs.h"
28
29 #include "fs.h"
30
31 \f
32
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
35  * from SIZE.
36  *
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.
39  */
40 svn_error_t *
41 svn_fs_fs__fixup_expanded_size(svn_fs_t *fs,
42                                representation_t *rep,
43                                apr_pool_t *scratch_pool);
44
45 /* Set *NODEREV_P to the node-revision for the node ID in FS.  Do any
46    allocations in POOL. */
47 svn_error_t *
48 svn_fs_fs__get_node_revision(node_revision_t **noderev_p,
49                              svn_fs_t *fs,
50                              const svn_fs_id_t *id,
51                              apr_pool_t *result_pool,
52                              apr_pool_t *scratch_pool);
53
54 /* Set *ROOT_ID to the node-id for the root of revision REV in
55    filesystem FS.  Do any allocations in POOL. */
56 svn_error_t *
57 svn_fs_fs__rev_get_root(svn_fs_id_t **root_id,
58                         svn_fs_t *fs,
59                         svn_revnum_t rev,
60                         apr_pool_t *result_pool,
61                         apr_pool_t *scratch_pool);
62
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. */
67 svn_error_t *
68 svn_fs_fs__check_rep(representation_t *rep,
69                      svn_fs_t *fs,
70                      void **hint,
71                      apr_pool_t *scratch_pool);
72
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. */
77 svn_error_t *
78 svn_fs_fs__rep_chain_length(int *chain_length,
79                             int *shard_count,
80                             representation_t *rep,
81                             svn_fs_t *fs,
82                             apr_pool_t *scratch_pool);
83
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. */
89 svn_error_t *
90 svn_fs_fs__get_contents(svn_stream_t **contents_p,
91                         svn_fs_t *fs,
92                         representation_t *rep,
93                         svn_boolean_t cache_fulltext,
94                         apr_pool_t *pool);
95
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. */
100 svn_error_t *
101 svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p,
102                                   svn_fs_t *fs,
103                                   representation_t *rep,
104                                   apr_file_t *file,
105                                   apr_off_t offset,
106                                   apr_pool_t *pool);
107
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
111    had been called.
112    Use POOL for all allocations.
113  */
114 svn_error_t *
115 svn_fs_fs__try_process_file_contents(svn_boolean_t *success,
116                                      svn_fs_t *fs,
117                                      node_revision_t *noderev,
118                                      svn_fs_process_contents_func_t processor,
119                                      void* baton,
120                                      apr_pool_t *pool);
121
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. */
125 svn_error_t *
126 svn_fs_fs__get_file_delta_stream(svn_txdelta_stream_t **stream_p,
127                                  svn_fs_t *fs,
128                                  node_revision_t *source,
129                                  node_revision_t *target,
130                                  apr_pool_t *pool);
131
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. */
136 svn_error_t *
137 svn_fs_fs__rep_contents_dir(apr_array_header_t **entries_p,
138                             svn_fs_t *fs,
139                             node_revision_t *noderev,
140                             apr_pool_t *result_pool,
141                             apr_pool_t *scratch_pool);
142
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. */
147 svn_fs_dirent_t *
148 svn_fs_fs__find_dir_entry(apr_array_header_t *entries,
149                           const char *name,
150                           int *hint);
151
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. */
156 svn_error_t *
157 svn_fs_fs__rep_contents_dir_entry(svn_fs_dirent_t **dirent,
158                                   svn_fs_t *fs,
159                                   node_revision_t *noderev,
160                                   const char *name,
161                                   apr_pool_t *result_pool,
162                                   apr_pool_t *scratch_pool);
163
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. */
167 svn_error_t *
168 svn_fs_fs__get_proplist(apr_hash_t **proplist,
169                         svn_fs_t *fs,
170                         node_revision_t *noderev,
171                         apr_pool_t *pool);
172
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. */
176 svn_error_t *
177 svn_fs_fs__create_changes_context(svn_fs_fs__changes_context_t **context,
178                                   svn_fs_t *fs,
179                                   svn_revnum_t rev,
180                                   apr_pool_t *result_pool);
181
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.
184  */
185 svn_error_t *
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);
190
191 #endif