1 /* fs.h : interface to Subversion filesystem, private to libsvn_fs
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_BASE_H
24 #define SVN_LIBSVN_FS_BASE_H
27 #include "svn_private_config.h"
29 #include <apr_pools.h>
37 #endif /* __cplusplus */
40 /*** Filesystem schema versions ***/
42 /* The format number of this filesystem. This is independent of the
43 repository format number, and independent of any other FS back
44 ends. See the SVN_FS_BASE__MIN_*_FORMAT defines to get a sense of
45 what changes and features were added in which versions of this
48 Note: If you bump this, please update the switch statement in
49 base_create() as well.
51 #define SVN_FS_BASE__FORMAT_NUMBER 4
53 /* Minimum format number that supports representation sharing. This
54 also brings in the support for storing SHA1 checksums. */
55 #define SVN_FS_BASE__MIN_REP_SHARING_FORMAT 4
57 /* Minimum format number that supports the 'miscellaneous' table */
58 #define SVN_FS_BASE__MIN_MISCELLANY_FORMAT 4
60 /* Minimum format number that supports forward deltas */
61 #define SVN_FS_BASE__MIN_FORWARD_DELTAS_FORMAT 4
63 /* Minimum format number that supports node-origins tracking */
64 #define SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT 3
66 /* Minimum format number that supports mergeinfo */
67 #define SVN_FS_BASE__MIN_MERGEINFO_FORMAT 3
69 /* Minimum format number that supports svndiff version 1. */
70 #define SVN_FS_BASE__MIN_SVNDIFF1_FORMAT 2
72 /* Return SVN_ERR_UNSUPPORTED_FEATURE if the version of filesystem FS does
73 not indicate support for FEATURE (which REQUIRES a newer version). */
75 svn_fs_base__test_required_feature_format(svn_fs_t *fs,
81 /*** Miscellany keys. ***/
83 /* Revision at which the repo started using forward deltas. */
84 #define SVN_FS_BASE__MISC_FORWARD_DELTA_UPGRADE "forward-delta-rev"
88 /*** The filesystem structure. ***/
90 typedef struct base_fs_data_t
92 /* A Berkeley DB environment for all the filesystem's databases.
93 This establishes the scope of the filesystem's transactions. */
96 /* The filesystem's various tables. See `structure' for details. */
111 /* A boolean for tracking when we have a live Berkeley DB
112 transaction trail alive. */
113 svn_boolean_t in_txn_trail;
115 /* The format number of this FS. */
121 /*** Filesystem Revision ***/
122 typedef struct revision_t
124 /* id of the transaction that was committed to create this
131 /*** Transaction Kind ***/
132 typedef enum transaction_kind_t
134 transaction_kind_normal = 1, /* normal, uncommitted */
135 transaction_kind_committed, /* committed */
136 transaction_kind_dead /* uncommitted and dead */
138 } transaction_kind_t;
141 /*** Filesystem Transaction ***/
142 typedef struct transaction_t
144 /* kind of transaction. */
145 transaction_kind_t kind;
147 /* revision which this transaction was committed to create, or an
148 invalid revision number if this transaction was never committed. */
149 svn_revnum_t revision;
151 /* property list (const char * name, svn_string_t * value).
152 may be NULL if there are no properties. */
153 apr_hash_t *proplist;
155 /* node revision id of the root node. */
156 const svn_fs_id_t *root_id;
158 /* node revision id of the node which is the root of the revision
159 upon which this txn is base. (unfinished only) */
160 const svn_fs_id_t *base_id;
162 /* copies list (const char * copy_ids), or NULL if there have been
163 no copies in this transaction. */
164 apr_array_header_t *copies;
169 /*** Node-Revision ***/
170 typedef struct node_revision_t
173 svn_node_kind_t kind;
175 /* predecessor node revision id, or NULL if there is no predecessor
176 for this node revision */
177 const svn_fs_id_t *predecessor_id;
179 /* number of predecessors this node revision has (recursively), or
180 -1 if not known (for backward compatibility). */
181 int predecessor_count;
183 /* representation key for this node's properties. may be NULL if
184 there are no properties. */
185 const char *prop_key;
187 /* representation key for this node's text data (files) or entries
188 list (dirs). may be NULL if there are no contents. */
189 const char *data_key;
191 /* data representation instance identifier. Sounds fancy, but is
192 really just a way to distinguish between "I use the same rep key
193 as another node because we share ancestry and haven't had our
194 text touched at all" and "I use the same rep key as another node
195 only because one or both of us decided to pick up a shared
196 representation after-the-fact." May be NULL (if this node
197 revision isn't using a shared rep, or isn't the original
198 "assignee" of a shared rep). */
199 const char *data_key_uniquifier;
201 /* representation key for this node's text-data-in-progess (files
202 only). NULL if no edits are currently in-progress. This field
203 is always NULL for kinds other than "file". */
204 const char *edit_key;
206 /* path at which this node first came into existence. */
207 const char *created_path;
209 /* does this node revision have the mergeinfo tracking property set
210 on it? (only valid for FS schema 3 and newer) */
211 svn_boolean_t has_mergeinfo;
213 /* number of children of this node which have the mergeinfo tracking
214 property set (0 for files; valid only for FS schema 3 and newer). */
215 apr_int64_t mergeinfo_count;
220 /*** Representation Kind ***/
221 typedef enum rep_kind_t
223 rep_kind_fulltext = 1, /* fulltext */
224 rep_kind_delta /* delta */
229 /*** "Delta" Offset/Window Chunk ***/
230 typedef struct rep_delta_chunk_t
232 /* diff format version number ### at this point, "svndiff" is the
236 /* starting offset of the data represented by this chunk */
237 svn_filesize_t offset;
239 /* string-key to which this representation points. */
240 const char *string_key;
242 /* size of the fulltext data represented by this delta window. */
245 /* representation-key to use when needed source data for
249 /* apr_off_t rep_offset; ### not implemented */
254 /*** Representation ***/
255 typedef struct representation_t
257 /* representation kind */
260 /* transaction ID under which representation was created (used as a
261 mutability flag when compared with a current editing
265 /* Checksums for the contents produced by this representation.
266 These checksum is for the contents the rep shows to consumers,
267 regardless of how the rep stores the data under the hood. It is
268 independent of the storage (fulltext, delta, whatever).
270 If this is NULL, then for compatibility behave as though
271 this checksum matches the expected checksum. */
272 svn_checksum_t *md5_checksum;
273 svn_checksum_t *sha1_checksum;
275 /* kind-specific stuff */
281 /* string-key which holds the fulltext data */
282 const char *string_key;
289 /* an array of rep_delta_chunk_t * chunks of delta
291 apr_array_header_t *chunks;
299 typedef enum copy_kind_t
301 copy_kind_real = 1, /* real copy */
302 copy_kind_soft /* soft copy */
308 typedef struct copy_t
310 /* What kind of copy occurred. */
313 /* Path of copy source. */
314 const char *src_path;
316 /* Transaction id of copy source. */
317 const char *src_txn_id;
319 /* Node-revision of copy destination. */
320 const svn_fs_id_t *dst_noderev_id;
326 typedef struct change_t
328 /* Path of the change. */
331 /* Node revision ID of the change. */
332 const svn_fs_id_t *noderev_id;
334 /* The kind of change. */
335 svn_fs_path_change_kind_t kind;
337 /* Text or property mods? */
338 svn_boolean_t text_mod;
339 svn_boolean_t prop_mod;
345 typedef struct lock_node_t
347 /* entries list, maps (const char *) name --> (const char *) lock-node-id */
350 /* optional lock-token, might be NULL. */
351 const char *lock_token;
359 #endif /* __cplusplus */
361 #endif /* SVN_LIBSVN_FS_BASE_H */