]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/libsvn_fs_x/cached_data.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.git] / contrib / subversion / subversion / libsvn_fs_x / cached_data.h
1 /* cached_data.h --- cached (read) access to FSX 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 #include "index.h"
31
32 \f
33
34 /* Set *NODEREV_P to the node-revision for the node ID in FS.  Do any
35    allocations in POOL. */
36 svn_error_t *
37 svn_fs_x__get_node_revision(svn_fs_x__noderev_t **noderev_p,
38                             svn_fs_t *fs,
39                             const svn_fs_x__id_t *id,
40                             apr_pool_t *result_pool,
41                             apr_pool_t *scratch_pool);
42
43 /* Set *COUNT to the value of the mergeinfo_count member of the node-
44    revision for the node ID in FS.  Do temporary allocations in SCRATCH_POOL.
45  */
46 svn_error_t *
47 svn_fs_x__get_mergeinfo_count(apr_int64_t *count,
48                               svn_fs_t *fs,
49                               const svn_fs_x__id_t *id,
50                               apr_pool_t *scratch_pool);
51
52 /* Verify that representation REP in FS can be accessed.
53    Do any allocations in SCRATCH_POOL. */
54 svn_error_t *
55 svn_fs_x__check_rep(svn_fs_x__representation_t *rep,
56                     svn_fs_t *fs,
57                     apr_pool_t *scratch_pool);
58
59 /* Follow the representation delta chain in FS starting with REP.  The
60    number of reps (including REP) in the chain will be returned in
61    *CHAIN_LENGTH.  *SHARD_COUNT will be set to the number of shards
62    accessed.  Do any allocations in SCRATCH_POOL. */
63 svn_error_t *
64 svn_fs_x__rep_chain_length(int *chain_length,
65                            int *shard_count,
66                            svn_fs_x__representation_t *rep,
67                            svn_fs_t *fs,
68                            apr_pool_t *scratch_pool);
69
70 /* Set *CONTENTS to be a readable svn_stream_t that receives the text
71    representation REP as seen in filesystem FS.  If CACHE_FULLTEXT is
72    not set, bypass fulltext cache lookup for this rep and don't put the
73    reconstructed fulltext into cache.
74    Allocate *CONTENT_P in RESULT_POOL. */
75 svn_error_t *
76 svn_fs_x__get_contents(svn_stream_t **contents_p,
77                        svn_fs_t *fs,
78                        svn_fs_x__representation_t *rep,
79                        svn_boolean_t cache_fulltext,
80                        apr_pool_t *result_pool);
81
82 /* Determine on-disk and expanded sizes of the representation identified
83  * by ENTRY in FS and return the result in PACKED_LEN and EXPANDED_LEN,
84  * respectively.  FILE must point to the start of the representation and
85  * STREAM must be a stream defined on top of FILE.
86  * Use SCRATCH_POOL for temporary allocations.
87  */
88 svn_error_t *
89 svn_fs_x__get_representation_length(svn_filesize_t *packed_len,
90                                     svn_filesize_t *expanded_len,
91                                     svn_fs_t *fs,
92                                     svn_fs_x__revision_file_t *rev_file,
93                                     svn_fs_x__p2l_entry_t* entry,
94                                     apr_pool_t *scratch_pool);
95
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
99    had been called.
100    Use SCRATCH_POOL for temporary allocations.
101  */
102 svn_error_t *
103 svn_fs_x__try_process_file_contents(svn_boolean_t *success,
104                                     svn_fs_t *fs,
105                                     svn_fs_x__noderev_t *noderev,
106                                     svn_fs_process_contents_func_t processor,
107                                     void* baton,
108                                     apr_pool_t *scratch_pool);
109
110 /* Set *STREAM_P to a delta stream turning the contents of the file SOURCE
111    into the contents of the file TARGET, allocated in RESULT_POOL.
112    If SOURCE is NULL, an empty string will be used in its stead.
113    Use SCRATCH_POOL for temporary allocations.
114  */
115 svn_error_t *
116 svn_fs_x__get_file_delta_stream(svn_txdelta_stream_t **stream_p,
117                                 svn_fs_t *fs,
118                                 svn_fs_x__noderev_t *source,
119                                 svn_fs_x__noderev_t *target,
120                                 apr_pool_t *result_pool,
121                                 apr_pool_t *scratch_pool);
122
123 /* Set *ENTRIES to an apr_array_header_t of dirent structs that contain
124    the directory entries of node-revision NODEREV in filesystem FS.  The
125    returned table is allocated in RESULT_POOL and entries are sorted
126    lexicographically.  SCRATCH_POOL is used for temporary allocations. */
127 svn_error_t *
128 svn_fs_x__rep_contents_dir(apr_array_header_t **entries_p,
129                            svn_fs_t *fs,
130                            svn_fs_x__noderev_t *noderev,
131                            apr_pool_t *result_pool,
132                            apr_pool_t *scratch_pool);
133
134 /* Return the directory entry from ENTRIES that matches NAME.  If no such
135    entry exists, return NULL.  If HINT is not NULL, set *HINT to the array
136    index of the entry returned.  Successive calls in a linear scan scenario
137    will be faster called with the same HINT variable. */
138 svn_fs_x__dirent_t *
139 svn_fs_x__find_dir_entry(apr_array_header_t *entries,
140                          const char *name,
141                          int *hint);
142
143 /* Set *DIRENT to the entry identified by NAME in the directory given
144    by NODEREV in filesystem FS.  If no such entry exits, *DIRENT will
145    be NULL.  The value referenced by HINT can be used to speed up
146    consecutive calls when travering the directory in name order.
147    Any value is allowed, however APR_SIZE_MAX gives best performance
148    when there has been no previous lookup for the same directory.
149
150    The returned object is allocated in RESULT_POOL; SCRATCH_POOL
151    used for temporary allocations. */
152 svn_error_t *
153 svn_fs_x__rep_contents_dir_entry(svn_fs_x__dirent_t **dirent,
154                                  svn_fs_t *fs,
155                                  svn_fs_x__noderev_t *noderev,
156                                  const char *name,
157                                  apr_size_t *hint,
158                                  apr_pool_t *result_pool,
159                                  apr_pool_t *scratch_pool);
160
161 /* Set *PROPLIST to be an apr_hash_t containing the property list of
162    node-revision NODEREV as seen in filesystem FS.  Allocate the result
163    in RESULT_POOL and use SCRATCH_POOL for temporary allocations. */
164 svn_error_t *
165 svn_fs_x__get_proplist(apr_hash_t **proplist,
166                        svn_fs_t *fs,
167                        svn_fs_x__noderev_t *noderev,
168                        apr_pool_t *result_pool,
169                        apr_pool_t *scratch_pool);
170
171 /* Fetch the list of change in revision REV in FS and return it in *CHANGES.
172  * Allocate the result in POOL.
173  */
174 svn_error_t *
175 svn_fs_x__get_changes(apr_array_header_t **changes,
176                       svn_fs_t *fs,
177                       svn_revnum_t rev,
178                       apr_pool_t *pool);
179
180 #endif