source: valtobtest/subversion-1.6.2/subversion/libsvn_fs_base/fs.h @ 3

Last change on this file since 3 was 3, checked in by valtob, 15 years ago

subversion source 1.6.2 as test

File size: 9.4 KB
Line 
1/* fs.h : interface to Subversion filesystem, private to libsvn_fs
2 *
3 * ====================================================================
4 * Copyright (c) 2000-2009 CollabNet.  All rights reserved.
5 *
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.
11 *
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 * ====================================================================
16 */
17
18#ifndef SVN_LIBSVN_FS_BASE_H
19#define SVN_LIBSVN_FS_BASE_H
20
21#define SVN_WANT_BDB
22#include "svn_private_config.h"
23
24#include <apr_pools.h>
25#include <apr_hash.h>
26#include "svn_fs.h"
27
28#include "bdb/env.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif /* __cplusplus */
33
34
35/*** Filesystem schema versions ***/
36
37/* The format number of this filesystem.  This is independent of the
38   repository format number, and independent of any other FS back
39   ends.  See the SVN_FS_BASE__MIN_*_FORMAT defines to get a sense of
40   what changes and features were added in which versions of this
41   back-end's format.  */
42#define SVN_FS_BASE__FORMAT_NUMBER                4
43
44/* Minimum format number that supports representation sharing.  This
45   also brings in the support for storing SHA1 checksums.   */
46#define SVN_FS_BASE__MIN_REP_SHARING_FORMAT       4
47
48/* Minimum format number that supports the 'miscellaneous' table */
49#define SVN_FS_BASE__MIN_MISCELLANY_FORMAT        4
50
51/* Minimum format number that supports forward deltas */
52#define SVN_FS_BASE__MIN_FORWARD_DELTAS_FORMAT    4
53
54/* Minimum format number that supports node-origins tracking */
55#define SVN_FS_BASE__MIN_NODE_ORIGINS_FORMAT      3
56
57/* Minimum format number that supports mergeinfo */
58#define SVN_FS_BASE__MIN_MERGEINFO_FORMAT         3
59
60/* Minimum format number that supports svndiff version 1.  */
61#define SVN_FS_BASE__MIN_SVNDIFF1_FORMAT          2
62
63/* Return SVN_ERR_UNSUPPORTED_FEATURE if the version of filesystem FS does
64   not indicate support for FEATURE (which REQUIRES a newer version). */
65svn_error_t *
66svn_fs_base__test_required_feature_format(svn_fs_t *fs,
67                                          const char *feature,
68                                          int requires);
69
70
71
72/*** Miscellany keys. ***/
73
74/* Revision at which the repo started using forward deltas. */
75#define SVN_FS_BASE__MISC_FORWARD_DELTA_UPGRADE  "forward-delta-rev"
76
77/* Next filesystem-global unique identifier value (base36). */
78#define SVN_FS_BASE__MISC_NEXT_FSGUID            "next-fsguid"
79
80
81
82/*** The filesystem structure.  ***/
83
84typedef struct
85{
86  /* A Berkeley DB environment for all the filesystem's databases.
87     This establishes the scope of the filesystem's transactions.  */
88  bdb_env_baton_t *bdb;
89
90  /* The filesystem's various tables.  See `structure' for details.  */
91  DB *changes;
92  DB *copies;
93  DB *nodes;
94  DB *representations;
95  DB *revisions;
96  DB *strings;
97  DB *transactions;
98  DB *uuids;
99  DB *locks;
100  DB *lock_tokens;
101  DB *node_origins;
102  DB *miscellaneous;
103  DB *checksum_reps;
104
105  /* A boolean for tracking when we have a live Berkeley DB
106     transaction trail alive. */
107  svn_boolean_t in_txn_trail;
108
109  /* The filesystem UUID (or NULL if not-yet-known; see svn_fs_get_uuid). */
110  const char *uuid;
111
112  /* The format number of this FS. */
113  int format;
114
115} base_fs_data_t;
116
117
118/*** Filesystem Revision ***/
119typedef struct
120{
121  /* id of the transaction that was committed to create this
122     revision. */
123  const char *txn_id;
124
125} revision_t;
126
127
128/*** Transaction Kind ***/
129typedef enum
130{
131  transaction_kind_normal = 1,  /* normal, uncommitted */
132  transaction_kind_committed,   /* committed */
133  transaction_kind_dead         /* uncommitted and dead */
134
135} transaction_kind_t;
136
137
138/*** Filesystem Transaction ***/
139typedef struct
140{
141  /* kind of transaction. */
142  transaction_kind_t kind;
143
144  /* revision which this transaction was committed to create, or an
145     invalid revision number if this transaction was never committed. */
146  svn_revnum_t revision;
147
148  /* property list (const char * name, svn_string_t * value).
149     may be NULL if there are no properties.  */
150  apr_hash_t *proplist;
151
152  /* node revision id of the root node.  */
153  const svn_fs_id_t *root_id;
154
155  /* node revision id of the node which is the root of the revision
156     upon which this txn is base.  (unfinished only) */
157  const svn_fs_id_t *base_id;
158
159  /* copies list (const char * copy_ids), or NULL if there have been
160     no copies in this transaction.  */
161  apr_array_header_t *copies;
162
163} transaction_t;
164
165
166/*** Node-Revision ***/
167typedef struct
168{
169  /* node kind */
170  svn_node_kind_t kind;
171
172  /* predecessor node revision id, or NULL if there is no predecessor
173     for this node revision */
174  const svn_fs_id_t *predecessor_id;
175
176  /* number of predecessors this node revision has (recursively), or
177     -1 if not known (for backward compatibility). */
178  int predecessor_count;
179
180  /* representation key for this node's properties.  may be NULL if
181     there are no properties.  */
182  const char *prop_key;
183
184  /* representation key for this node's text data (files) or entries
185     list (dirs).  may be NULL if there are no contents.  */
186  const char *data_key;
187
188  /* data representation instance identifier.  Sounds fancy, but is
189     really just a way to distinguish between "I use the same rep key
190     as another node because we share ancestry and haven't had our
191     text touched at all" and "I use the same rep key as another node
192     only because one or both of us decided to pick up a shared
193     representation after-the-fact."  May be NULL (if this node
194     revision isn't using a shared rep, or isn't the original
195     "assignee" of a shared rep). */
196  const char *data_key_uniquifier;
197
198  /* representation key for this node's text-data-in-progess (files
199     only).  NULL if no edits are currently in-progress.  This field
200     is always NULL for kinds other than "file".  */
201  const char *edit_key;
202
203  /* path at which this node first came into existence.  */
204  const char *created_path;
205
206  /* does this node revision have the mergeinfo tracking property set
207     on it?  (only valid for FS schema 3 and newer) */
208  svn_boolean_t has_mergeinfo;
209
210  /* number of children of this node which have the mergeinfo tracking
211     property set  (0 for files; valid only for FS schema 3 and newer). */
212  apr_int64_t mergeinfo_count;
213
214} node_revision_t;
215
216
217/*** Representation Kind ***/
218typedef enum
219{
220  rep_kind_fulltext = 1, /* fulltext */
221  rep_kind_delta         /* delta */
222
223} rep_kind_t;
224
225
226/*** "Delta" Offset/Window Chunk ***/
227typedef struct
228{
229  /* diff format version number ### at this point, "svndiff" is the
230     only format used. */
231  apr_byte_t version;
232
233  /* starting offset of the data represented by this chunk */
234  svn_filesize_t offset;
235
236  /* string-key to which this representation points. */
237  const char *string_key;
238
239  /* size of the fulltext data represented by this delta window. */
240  apr_size_t size;
241
242  /* representation-key to use when needed source data for
243     undeltification. */
244  const char *rep_key;
245
246  /* apr_off_t rep_offset;  ### not implemented */
247
248} rep_delta_chunk_t;
249
250
251/*** Representation ***/
252typedef struct
253{
254  /* representation kind */
255  rep_kind_t kind;
256
257  /* transaction ID under which representation was created (used as a
258     mutability flag when compared with a current editing
259     transaction). */
260  const char *txn_id;
261
262  /* Checksums for the contents produced by this representation.
263     These checksum is for the contents the rep shows to consumers,
264     regardless of how the rep stores the data under the hood.  It is
265     independent of the storage (fulltext, delta, whatever).
266
267     If this is NULL, then for compatibility behave as though
268     this checksum matches the expected checksum. */
269  svn_checksum_t *md5_checksum;
270  svn_checksum_t *sha1_checksum;
271
272  /* kind-specific stuff */
273  union
274  {
275    /* fulltext stuff */
276    struct
277    {
278      /* string-key which holds the fulltext data */
279      const char *string_key;
280
281    } fulltext;
282
283    /* delta stuff */
284    struct
285    {
286      /* an array of rep_delta_chunk_t * chunks of delta
287         information */
288      apr_array_header_t *chunks;
289
290    } delta;
291  } contents;
292} representation_t;
293
294
295/*** Copy Kind ***/
296typedef enum
297{
298  copy_kind_real = 1, /* real copy */
299  copy_kind_soft      /* soft copy */
300
301} copy_kind_t;
302
303
304/*** Copy ***/
305typedef struct
306{
307  /* What kind of copy occurred. */
308  copy_kind_t kind;
309
310  /* Path of copy source. */
311  const char *src_path;
312
313  /* Transaction id of copy source. */
314  const char *src_txn_id;
315
316  /* Node-revision of copy destination. */
317  const svn_fs_id_t *dst_noderev_id;
318
319} copy_t;
320
321
322/*** Change ***/
323typedef struct
324{
325  /* Path of the change. */
326  const char *path;
327
328  /* Node revision ID of the change. */
329  const svn_fs_id_t *noderev_id;
330
331  /* The kind of change. */
332  svn_fs_path_change_kind_t kind;
333
334  /* Text or property mods? */
335  svn_boolean_t text_mod;
336  svn_boolean_t prop_mod;
337
338} change_t;
339
340
341/*** Lock node ***/
342typedef struct
343{
344  /* entries list, maps (const char *) name --> (const char *) lock-node-id */
345  apr_hash_t *entries;
346
347  /* optional lock-token, might be NULL. */
348  const char *lock_token;
349
350} lock_node_t;
351
352
353
354#ifdef __cplusplus
355}
356#endif /* __cplusplus */
357
358#endif /* SVN_LIBSVN_FS_BASE_H */
Note: See TracBrowser for help on using the repository browser.