1 /* id.h : interface to FSX-internal ID functions
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_X_ID_H
24 #define SVN_LIBSVN_FS_X_ID_H
30 #endif /* __cplusplus */
32 /* Unique identifier for a transaction within the given repository. */
33 typedef apr_int64_t svn_fs_x__txn_id_t;
35 /* svn_fs_x__txn_id_t value for everything that is not a transaction. */
36 #define SVN_FS_X__INVALID_TXN_ID ((svn_fs_x__txn_id_t)(-1))
38 /* Change set is the umbrella term for transaction and revision in FSX.
39 * Revision numbers (>=0) map 1:1 onto change sets while txns are mapped
40 * onto the negatve value range. */
41 typedef apr_int64_t svn_fs_x__change_set_t;
43 /* Invalid / unused change set number. */
44 #define SVN_FS_X__INVALID_CHANGE_SET ((svn_fs_x__change_set_t)(-1))
46 /* Return TRUE iff the CHANGE_SET refers to a revision
47 (will return FALSE for SVN_INVALID_REVNUM). */
49 svn_fs_x__is_revision(svn_fs_x__change_set_t change_set);
51 /* Return TRUE iff the CHANGE_SET refers to a transaction
52 (will return FALSE for SVN_FS_X__INVALID_TXN_ID). */
54 svn_fs_x__is_txn(svn_fs_x__change_set_t change_set);
56 /* Return the revision number that corresponds to CHANGE_SET.
57 Will SVN_INVALID_REVNUM for transactions. */
59 svn_fs_x__get_revnum(svn_fs_x__change_set_t change_set);
61 /* Return the transaction ID that corresponds to CHANGE_SET.
62 Will SVN_FS_X__INVALID_TXN_ID for revisions. */
64 svn_fs_x__get_txn_id(svn_fs_x__change_set_t change_set);
66 /* Convert REVNUM into a change set number */
67 svn_fs_x__change_set_t
68 svn_fs_x__change_set_by_rev(svn_revnum_t revnum);
70 /* Convert TXN_ID into a change set number */
71 svn_fs_x__change_set_t
72 svn_fs_x__change_set_by_txn(svn_fs_x__txn_id_t txn_id);
74 /* An ID in FSX consists of a creation CHANGE_SET number and some changeset-
75 * local counter value (NUMBER).
77 typedef struct svn_fs_x__id_t
79 svn_fs_x__change_set_t change_set;
85 /*** Operations on ID parts. ***/
87 /* Return TRUE, if both elements of the PART is 0, i.e. this is the default
88 * value if e.g. no copies were made of this node. */
90 svn_fs_x__id_is_root(const svn_fs_x__id_t *part);
92 /* Return TRUE, if all element values of *LHS and *RHS match. */
94 svn_fs_x__id_eq(const svn_fs_x__id_t *lhs,
95 const svn_fs_x__id_t *rhs);
97 /* Parse the NUL-terminated ID part at DATA and write the result into *PART.
100 svn_fs_x__id_parse(svn_fs_x__id_t *part,
103 /* Convert ID into string form, allocated in RESULT_POOL. */
105 svn_fs_x__id_unparse(const svn_fs_x__id_t*id,
106 apr_pool_t *result_pool);
108 /* Set *PART to "unused". */
110 svn_fs_x__id_reset(svn_fs_x__id_t *part);
112 /* Return TRUE if *PART is belongs to either a revision or transaction. */
114 svn_fs_x__id_used(const svn_fs_x__id_t *part);
116 /* Return 0 if A and B are equal, 1 if A is "greater than" B, -1 otherwise. */
118 svn_fs_x__id_compare(const svn_fs_x__id_t *a,
119 const svn_fs_x__id_t *b);
121 /* Set *NODEREV_ID to the root node ID of transaction TXN_ID. */
123 svn_fs_x__init_txn_root(svn_fs_x__id_t *noderev_id,
124 svn_fs_x__txn_id_t txn_id);
126 /* Set *NODEREV_ID to the root node ID of revision REV. */
128 svn_fs_x__init_rev_root(svn_fs_x__id_t *noderev_id,
133 #endif /* __cplusplus */
135 #endif /* SVN_LIBSVN_FS_X_ID_H */