Mark many merge tests as skip-against-old-server.
[svn.git] / subversion / libsvn_fs_base / fs.h
blobf0cfe66f1c385f007c2cdbd738c67c7fc440cfa4
1 /* fs.h : interface to Subversion filesystem, private to libsvn_fs
3 * ====================================================================
4 * Copyright (c) 2000-2007 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
18 #ifndef SVN_LIBSVN_FS_BASE_H
19 #define SVN_LIBSVN_FS_BASE_H
21 #define APU_WANT_DB
22 #include <apu_want.h>
24 #include <apr_pools.h>
25 #include <apr_hash.h>
26 #include <apr_md5.h>
27 #include "svn_fs.h"
29 #include "bdb/env.h"
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
36 /*** Filesystem schema versions ***/
38 /* The format number of this filesystem. This is independent of the
39 repository format number, and independent of any other FS back
40 ends. See the SVN_FS_BASE__MIN_*_FORMAT defines to get a sense of
41 what changes and features were added in which versions of this
42 back-end's format. */
43 #define SVN_FS_BASE__FORMAT_NUMBER 3
45 /* Minimum format number that supports node-origins tracking */
46 #define SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT 3
48 /* Minimum format number that supports mergeinfo */
49 #define SVN_FS_BASE__MIN_MERGEINFO_FORMAT 3
51 /* Minimum format number that supports svndiff version 1. */
52 #define SVN_FS_BASE__MIN_SVNDIFF1_FORMAT 2
54 /* Return SVN_ERR_UNSUPPORTED_FEATURE if the version of filesystem FS does
55 not indicate support for FEATURE (which REQUIRES a newer version). */
56 svn_error_t *
57 svn_fs_base__test_required_feature_format(svn_fs_t *fs,
58 const char *feature,
59 int requires);
63 /*** The filesystem structure. ***/
65 typedef struct
67 /* A Berkeley DB environment for all the filesystem's databases.
68 This establishes the scope of the filesystem's transactions. */
69 bdb_env_baton_t *bdb;
71 /* The filesystem's various tables. See `structure' for details. */
72 DB *changes;
73 DB *copies;
74 DB *nodes;
75 DB *representations;
76 DB *revisions;
77 DB *strings;
78 DB *transactions;
79 DB *uuids;
80 DB *locks;
81 DB *lock_tokens;
82 DB *node_origins;
84 /* A boolean for tracking when we have a live Berkeley DB
85 transaction trail alive. */
86 svn_boolean_t in_txn_trail;
88 /* The filesystem UUID (or NULL if not-yet-known; see svn_fs_get_uuid). */
89 const char *uuid;
91 /* The format number of this FS. */
92 int format;
94 } base_fs_data_t;
97 /*** Filesystem Revision ***/
98 typedef struct
100 /* id of the transaction that was committed to create this
101 revision. */
102 const char *txn_id;
104 } revision_t;
107 /*** Transaction Kind ***/
108 typedef enum
110 transaction_kind_normal = 1, /* normal, uncommitted */
111 transaction_kind_committed, /* committed */
112 transaction_kind_dead /* uncommitted and dead */
114 } transaction_kind_t;
117 /*** Filesystem Transaction ***/
118 typedef struct
120 /* kind of transaction. */
121 transaction_kind_t kind;
123 /* revision which this transaction was committed to create, or an
124 invalid revision number if this transaction was never committed. */
125 svn_revnum_t revision;
127 /* property list (const char * name, svn_string_t * value).
128 may be NULL if there are no properties. */
129 apr_hash_t *proplist;
131 /* node revision id of the root node. */
132 const svn_fs_id_t *root_id;
134 /* node revision id of the node which is the root of the revision
135 upon which this txn is base. (unfinished only) */
136 const svn_fs_id_t *base_id;
138 /* copies list (const char * copy_ids), or NULL if there have been
139 no copies in this transaction. */
140 apr_array_header_t *copies;
142 } transaction_t;
145 /*** Node-Revision ***/
146 typedef struct
148 /* node kind */
149 svn_node_kind_t kind;
151 /* predecessor node revision id, or NULL if there is no predecessor
152 for this node revision */
153 const svn_fs_id_t *predecessor_id;
155 /* number of predecessors this node revision has (recursively), or
156 -1 if not known (for backward compatibility). */
157 int predecessor_count;
159 /* representation key for this node's properties. may be NULL if
160 there are no properties. */
161 const char *prop_key;
163 /* representation key for this node's text data (files) or entries
164 list (dirs). may be NULL if there are no contents. */
165 const char *data_key;
167 /* representation key for this node's text-data-in-progess (files
168 only). NULL if no edits are currently in-progress. This field
169 is always NULL for kinds other than "file". */
170 const char *edit_key;
172 /* path at which this node first came into existence. */
173 const char *created_path;
175 /* does this node revision have the mergeinfo tracking property set
176 on it? (only valid for FS schema 3 and newer) */
177 svn_boolean_t has_mergeinfo;
179 /* number of children of this node which have the mergeinfo tracking
180 property set (0 for files; valid only for FS schema 3 and newer). */
181 apr_int64_t mergeinfo_count;
183 } node_revision_t;
186 /*** Representation Kind ***/
187 typedef enum
189 rep_kind_fulltext = 1, /* fulltext */
190 rep_kind_delta /* delta */
192 } rep_kind_t;
195 /*** "Delta" Offset/Window Chunk ***/
196 typedef struct
198 /* diff format version number ### at this point, "svndiff" is the
199 only format used. */
200 apr_byte_t version;
202 /* starting offset of the data represented by this chunk */
203 svn_filesize_t offset;
205 /* string-key to which this representation points. */
206 const char *string_key;
208 /* size of the fulltext data represented by this delta window. */
209 apr_size_t size;
211 /* representation-key to use when needed source data for
212 undeltification. */
213 const char *rep_key;
215 /* apr_off_t rep_offset; ### not implemented */
217 } rep_delta_chunk_t;
220 /*** Representation ***/
221 typedef struct
223 /* representation kind */
224 rep_kind_t kind;
226 /* transaction ID under which representation was created (used as a
227 mutability flag when compared with a current editing
228 transaction). */
229 const char *txn_id;
231 /* MD5 checksum for the contents produced by this representation.
232 This checksum is for the contents the rep shows to consumers,
233 regardless of how the rep stores the data under the hood. It is
234 independent of the storage (fulltext, delta, whatever).
236 If all the bytes are 0, then for compatibility behave as though
237 this checksum matches the expected checksum. */
238 unsigned char checksum[APR_MD5_DIGESTSIZE];
240 /* kind-specific stuff */
241 union
243 /* fulltext stuff */
244 struct
246 /* string-key which holds the fulltext data */
247 const char *string_key;
249 } fulltext;
251 /* delta stuff */
252 struct
254 /* an array of rep_delta_chunk_t * chunks of delta
255 information */
256 apr_array_header_t *chunks;
258 } delta;
259 } contents;
260 } representation_t;
263 /*** Copy Kind ***/
264 typedef enum
266 copy_kind_real = 1, /* real copy */
267 copy_kind_soft /* soft copy */
269 } copy_kind_t;
272 /*** Copy ***/
273 typedef struct
275 /* What kind of copy occurred. */
276 copy_kind_t kind;
278 /* Path of copy source. */
279 const char *src_path;
281 /* Transaction id of copy source. */
282 const char *src_txn_id;
284 /* Node-revision of copy destination. */
285 const svn_fs_id_t *dst_noderev_id;
287 } copy_t;
290 /*** Change ***/
291 typedef struct
293 /* Path of the change. */
294 const char *path;
296 /* Node revision ID of the change. */
297 const svn_fs_id_t *noderev_id;
299 /* The kind of change. */
300 svn_fs_path_change_kind_t kind;
302 /* Text or property mods? */
303 svn_boolean_t text_mod;
304 svn_boolean_t prop_mod;
306 } change_t;
309 /*** Lock node ***/
310 typedef struct
312 /* entries list, maps (const char *) name --> (const char *) lock-node-id */
313 apr_hash_t *entries;
315 /* optional lock-token, might be NULL. */
316 const char *lock_token;
318 } lock_node_t;
322 #ifdef __cplusplus
324 #endif /* __cplusplus */
326 #endif /* SVN_LIBSVN_FS_BASE_H */