1 /* id.h : interface to node ID functions, private to libsvn_fs_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_FS_ID_H
24 #define SVN_LIBSVN_FS_FS_ID_H
27 #include "private/svn_fs_fs_private.h"
31 #endif /* __cplusplus */
34 /*** Operations on ID parts. ***/
36 /* Return TRUE, if both elements of the PART is 0, i.e. this is the default
37 * value if e.g. no copies were made of this node. */
38 svn_boolean_t svn_fs_fs__id_part_is_root(const svn_fs_fs__id_part_t *part);
40 /* Return TRUE, if all element values of *LHS and *RHS match. */
41 svn_boolean_t svn_fs_fs__id_part_eq(const svn_fs_fs__id_part_t *lhs,
42 const svn_fs_fs__id_part_t *rhs);
44 /* Return TRUE, if TXN_ID is used, i.e. doesn't contain just the defaults. */
45 svn_boolean_t svn_fs_fs__id_txn_used(const svn_fs_fs__id_part_t *txn_id);
47 /* Reset TXN_ID to the defaults. */
48 void svn_fs_fs__id_txn_reset(svn_fs_fs__id_part_t *txn_id);
50 /* Parse the transaction id in DATA and store the result in *TXN_ID */
51 svn_error_t *svn_fs_fs__id_txn_parse(svn_fs_fs__id_part_t *txn_id,
54 /* Convert the transaction id in *TXN_ID into a textual representation
55 * allocated in POOL. */
56 const char *svn_fs_fs__id_txn_unparse(const svn_fs_fs__id_part_t *txn_id,
60 /*** ID accessor functions. ***/
62 /* Get the "node id" portion of ID. */
63 const svn_fs_fs__id_part_t *svn_fs_fs__id_node_id(const svn_fs_id_t *id);
65 /* Get the "copy id" portion of ID. */
66 const svn_fs_fs__id_part_t *svn_fs_fs__id_copy_id(const svn_fs_id_t *id);
68 /* Get the "txn id" portion of ID, or NULL if it is a permanent ID. */
69 const svn_fs_fs__id_part_t *svn_fs_fs__id_txn_id(const svn_fs_id_t *id);
71 /* Get the "rev,item" portion of ID. */
72 const svn_fs_fs__id_part_t *svn_fs_fs__id_rev_item(const svn_fs_id_t *id);
74 /* Get the "rev" portion of ID, or SVN_INVALID_REVNUM if it is a
76 svn_revnum_t svn_fs_fs__id_rev(const svn_fs_id_t *id);
78 /* Access the "item" portion of the ID, or 0 if it is a transaction
80 apr_uint64_t svn_fs_fs__id_item(const svn_fs_id_t *id);
82 /* Return TRUE, if this is a transaction ID. */
83 svn_boolean_t svn_fs_fs__id_is_txn(const svn_fs_id_t *id);
85 /* Convert ID into string form, allocated in POOL. */
86 svn_string_t *svn_fs_fs__id_unparse(const svn_fs_id_t *id,
89 /* Return true if A and B are equal. */
90 svn_boolean_t svn_fs_fs__id_eq(const svn_fs_id_t *a,
91 const svn_fs_id_t *b);
93 /* Return true if A and B are related. */
94 svn_boolean_t svn_fs_fs__id_check_related(const svn_fs_id_t *a,
95 const svn_fs_id_t *b);
97 /* Return the noderev relationship between A and B. */
98 svn_fs_node_relation_t svn_fs_fs__id_compare(const svn_fs_id_t *a,
99 const svn_fs_id_t *b);
101 /* Return 0 if A and B are equal, 1 if A is "greater than" B, -1 otherwise. */
102 int svn_fs_fs__id_part_compare(const svn_fs_fs__id_part_t *a,
103 const svn_fs_fs__id_part_t *b);
105 /* Create the txn root ID for transaction TXN_ID. Allocate it in POOL. */
106 svn_fs_id_t *svn_fs_fs__id_txn_create_root(const svn_fs_fs__id_part_t *txn_id,
109 /* Create the root ID for REVISION (logical addressing node only).
110 Allocate it in POOL. */
111 svn_fs_id_t *svn_fs_fs__id_create_root(const svn_revnum_t revision,
114 /* Create an ID within a transaction based on NODE_ID, COPY_ID, and
115 TXN_ID, allocated in POOL. */
116 svn_fs_id_t *svn_fs_fs__id_txn_create(const svn_fs_fs__id_part_t *node_id,
117 const svn_fs_fs__id_part_t *copy_id,
118 const svn_fs_fs__id_part_t *txn_id,
121 /* Create a permanent ID based on NODE_ID, COPY_ID and REV_ITEM,
122 allocated in POOL. */
123 svn_fs_id_t *svn_fs_fs__id_rev_create(const svn_fs_fs__id_part_t *node_id,
124 const svn_fs_fs__id_part_t *copy_id,
125 const svn_fs_fs__id_part_t *rev_item,
128 /* Return a copy of ID, allocated from POOL. */
129 svn_fs_id_t *svn_fs_fs__id_copy(const svn_fs_id_t *id,
132 /* Return an ID in *ID_P resulting from parsing the string DATA, or an error
133 if DATA is an invalid ID string. *DATA will be modified / invalidated by
136 svn_fs_fs__id_parse(const svn_fs_id_t **id_p,
141 /* (de-)serialization support*/
143 struct svn_temp_serializer__context_t;
146 * Serialize an @a id within the serialization @a context.
149 svn_fs_fs__id_serialize(struct svn_temp_serializer__context_t *context,
150 const svn_fs_id_t * const *id);
153 * Deserialize an @a id within the @a buffer.
156 svn_fs_fs__id_deserialize(void *buffer,
161 #endif /* __cplusplus */
163 #endif /* SVN_LIBSVN_FS_FS_ID_H */