]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/libsvn_fs_fs/cached_data.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.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 /* Set *NODEREV_P to the node-revision for the node ID in FS.  Do any
34    allocations in POOL. */
35 svn_error_t *
36 svn_fs_fs__get_node_revision(node_revision_t **noderev_p,
37                              svn_fs_t *fs,
38                              const svn_fs_id_t *id,
39                              apr_pool_t *result_pool,
40                              apr_pool_t *scratch_pool);
41
42 /* Set *ROOT_ID to the node-id for the root of revision REV in
43    filesystem FS.  Do any allocations in POOL. */
44 svn_error_t *
45 svn_fs_fs__rev_get_root(svn_fs_id_t **root_id,
46                         svn_fs_t *fs,
47                         svn_revnum_t rev,
48                         apr_pool_t *result_pool,
49                         apr_pool_t *scratch_pool);
50
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. */
55 svn_error_t *
56 svn_fs_fs__check_rep(representation_t *rep,
57                      svn_fs_t *fs,
58                      void **hint,
59                      apr_pool_t *scratch_pool);
60
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. */
65 svn_error_t *
66 svn_fs_fs__rep_chain_length(int *chain_length,
67                             int *shard_count,
68                             representation_t *rep,
69                             svn_fs_t *fs,
70                             apr_pool_t *scratch_pool);
71
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. */
77 svn_error_t *
78 svn_fs_fs__get_contents(svn_stream_t **contents_p,
79                         svn_fs_t *fs,
80                         representation_t *rep,
81                         svn_boolean_t cache_fulltext,
82                         apr_pool_t *pool);
83
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
87    had been called.
88    Use POOL for all allocations.
89  */
90 svn_error_t *
91 svn_fs_fs__try_process_file_contents(svn_boolean_t *success,
92                                      svn_fs_t *fs,
93                                      node_revision_t *noderev,
94                                      svn_fs_process_contents_func_t processor,
95                                      void* baton,
96                                      apr_pool_t *pool);
97
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. */
101 svn_error_t *
102 svn_fs_fs__get_file_delta_stream(svn_txdelta_stream_t **stream_p,
103                                  svn_fs_t *fs,
104                                  node_revision_t *source,
105                                  node_revision_t *target,
106                                  apr_pool_t *pool);
107
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. */
112 svn_error_t *
113 svn_fs_fs__rep_contents_dir(apr_array_header_t **entries_p,
114                             svn_fs_t *fs,
115                             node_revision_t *noderev,
116                             apr_pool_t *result_pool,
117                             apr_pool_t *scratch_pool);
118
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. */
123 svn_fs_dirent_t *
124 svn_fs_fs__find_dir_entry(apr_array_header_t *entries,
125                           const char *name,
126                           int *hint);
127
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. */
132 svn_error_t *
133 svn_fs_fs__rep_contents_dir_entry(svn_fs_dirent_t **dirent,
134                                   svn_fs_t *fs,
135                                   node_revision_t *noderev,
136                                   const char *name,
137                                   apr_pool_t *result_pool,
138                                   apr_pool_t *scratch_pool);
139
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. */
143 svn_error_t *
144 svn_fs_fs__get_proplist(apr_hash_t **proplist,
145                         svn_fs_t *fs,
146                         node_revision_t *noderev,
147                         apr_pool_t *pool);
148
149 /* Set *HAS_PROPS to TRUE if NODEREV has properties in FS, otherwise
150    to FALSE. Use SCRATCH_POOL for temporary allocations. */
151 svn_error_t *
152 svn_fs_fs__has_props(svn_boolean_t *has_props,
153                      svn_fs_t *fs,
154                      node_revision_t *noderev,
155                      apr_pool_t *scratch_pool);
156
157 /* Fetch the list of change in revision REV in FS and return it in *CHANGES.
158  * Allocate the result in POOL.
159  */
160 svn_error_t *
161 svn_fs_fs__get_changes(apr_array_header_t **changes,
162                        svn_fs_t *fs,
163                        svn_revnum_t rev,
164                        apr_pool_t *pool);
165
166 #endif