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
47 #define SVN_FS_BASE__FORMAT_NUMBER 4
49 /* Minimum format number that supports representation sharing. This
50 also brings in the support for storing SHA1 checksums. */
51 #define SVN_FS_BASE__MIN_REP_SHARING_FORMAT 4
53 /* Minimum format number that supports the 'miscellaneous' table */
54 #define SVN_FS_BASE__MIN_MISCELLANY_FORMAT 4
56 /* Minimum format number that supports forward deltas */
57 #define SVN_FS_BASE__MIN_FORWARD_DELTAS_FORMAT 4
59 /* Minimum format number that supports node-origins tracking */
60 #define SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT 3
62 /* Minimum format number that supports mergeinfo */
63 #define SVN_FS_BASE__MIN_MERGEINFO_FORMAT 3
65 /* Minimum format number that supports svndiff version 1. */
66 #define SVN_FS_BASE__MIN_SVNDIFF1_FORMAT 2
68 /* Return SVN_ERR_UNSUPPORTED_FEATURE if the version of filesystem FS does
69 not indicate support for FEATURE (which REQUIRES a newer version). */
71 svn_fs_base__test_required_feature_format(svn_fs_t *fs,
77 /*** Miscellany keys. ***/
79 /* Revision at which the repo started using forward deltas. */
80 #define SVN_FS_BASE__MISC_FORWARD_DELTA_UPGRADE "forward-delta-rev"
84 /*** The filesystem structure. ***/
86 typedef struct base_fs_data_t
88 /* A Berkeley DB environment for all the filesystem's databases.
89 This establishes the scope of the filesystem's transactions. */
92 /* The filesystem's various tables. See `structure' for details. */
107 /* A boolean for tracking when we have a live Berkeley DB
108 transaction trail alive. */
109 svn_boolean_t in_txn_trail;
111 /* The format number of this FS. */
117 /*** Filesystem Revision ***/
118 typedef struct revision_t
120 /* id of the transaction that was committed to create this
127 /*** Transaction Kind ***/
128 typedef enum transaction_kind_t
130 transaction_kind_normal = 1, /* normal, uncommitted */
131 transaction_kind_committed, /* committed */
132 transaction_kind_dead /* uncommitted and dead */
134 } transaction_kind_t;
137 /*** Filesystem Transaction ***/
138 typedef struct transaction_t
140 /* kind of transaction. */
141 transaction_kind_t kind;
143 /* revision which this transaction was committed to create, or an
144 invalid revision number if this transaction was never committed. */
145 svn_revnum_t revision;
147 /* property list (const char * name, svn_string_t * value).
148 may be NULL if there are no properties. */
149 apr_hash_t *proplist;
151 /* node revision id of the root node. */
152 const svn_fs_id_t *root_id;
154 /* node revision id of the node which is the root of the revision
155 upon which this txn is base. (unfinished only) */
156 const svn_fs_id_t *base_id;
158 /* copies list (const char * copy_ids), or NULL if there have been
159 no copies in this transaction. */
160 apr_array_header_t *copies;
165 /*** Node-Revision ***/
166 typedef struct node_revision_t
169 svn_node_kind_t kind;
171 /* predecessor node revision id, or NULL if there is no predecessor
172 for this node revision */
173 const svn_fs_id_t *predecessor_id;
175 /* number of predecessors this node revision has (recursively), or
176 -1 if not known (for backward compatibility). */
177 int predecessor_count;
179 /* representation key for this node's properties. may be NULL if
180 there are no properties. */
181 const char *prop_key;
183 /* representation key for this node's text data (files) or entries
184 list (dirs). may be NULL if there are no contents. */
185 const char *data_key;
187 /* data representation instance identifier. Sounds fancy, but is
188 really just a way to distinguish between "I use the same rep key
189 as another node because we share ancestry and haven't had our
190 text touched at all" and "I use the same rep key as another node
191 only because one or both of us decided to pick up a shared
192 representation after-the-fact." May be NULL (if this node
193 revision isn't using a shared rep, or isn't the original
194 "assignee" of a shared rep). */
195 const char *data_key_uniquifier;
197 /* representation key for this node's text-data-in-progess (files
198 only). NULL if no edits are currently in-progress. This field
199 is always NULL for kinds other than "file". */
200 const char *edit_key;
202 /* path at which this node first came into existence. */
203 const char *created_path;
205 /* does this node revision have the mergeinfo tracking property set
206 on it? (only valid for FS schema 3 and newer) */
207 svn_boolean_t has_mergeinfo;
209 /* number of children of this node which have the mergeinfo tracking
210 property set (0 for files; valid only for FS schema 3 and newer). */
211 apr_int64_t mergeinfo_count;
216 /*** Representation Kind ***/
217 typedef enum rep_kind_t
219 rep_kind_fulltext = 1, /* fulltext */
220 rep_kind_delta /* delta */
225 /*** "Delta" Offset/Window Chunk ***/
226 typedef struct rep_delta_chunk_t
228 /* diff format version number ### at this point, "svndiff" is the
232 /* starting offset of the data represented by this chunk */
233 svn_filesize_t offset;
235 /* string-key to which this representation points. */
236 const char *string_key;
238 /* size of the fulltext data represented by this delta window. */
241 /* representation-key to use when needed source data for
245 /* apr_off_t rep_offset; ### not implemented */
250 /*** Representation ***/
251 typedef struct representation_t
253 /* representation kind */
256 /* transaction ID under which representation was created (used as a
257 mutability flag when compared with a current editing
261 /* Checksums for the contents produced by this representation.
262 These checksum is for the contents the rep shows to consumers,
263 regardless of how the rep stores the data under the hood. It is
264 independent of the storage (fulltext, delta, whatever).
266 If this is NULL, then for compatibility behave as though
267 this checksum matches the expected checksum. */
268 svn_checksum_t *md5_checksum;
269 svn_checksum_t *sha1_checksum;
271 /* kind-specific stuff */
277 /* string-key which holds the fulltext data */
278 const char *string_key;
285 /* an array of rep_delta_chunk_t * chunks of delta
287 apr_array_header_t *chunks;
295 typedef enum copy_kind_t
297 copy_kind_real = 1, /* real copy */
298 copy_kind_soft /* soft copy */
304 typedef struct copy_t
306 /* What kind of copy occurred. */
309 /* Path of copy source. */
310 const char *src_path;
312 /* Transaction id of copy source. */
313 const char *src_txn_id;
315 /* Node-revision of copy destination. */
316 const svn_fs_id_t *dst_noderev_id;
322 typedef struct change_t
324 /* Path of the change. */
327 /* Node revision ID of the change. */
328 const svn_fs_id_t *noderev_id;
330 /* The kind of change. */
331 svn_fs_path_change_kind_t kind;
333 /* Text or property mods? */
334 svn_boolean_t text_mod;
335 svn_boolean_t prop_mod;
341 typedef struct lock_node_t
343 /* entries list, maps (const char *) name --> (const char *) lock-node-id */
346 /* optional lock-token, might be NULL. */
347 const char *lock_token;
355 #endif /* __cplusplus */
357 #endif /* SVN_LIBSVN_FS_BASE_H */