]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/libsvn_fs_fs/id.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / libsvn_fs_fs / id.h
1 /* id.h : interface to node ID functions, private to libsvn_fs_fs
2  *
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
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
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
19  *    under the License.
20  * ====================================================================
21  */
22
23 #ifndef SVN_LIBSVN_FS_FS_ID_H
24 #define SVN_LIBSVN_FS_FS_ID_H
25
26 #include "svn_fs.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 \f
33 /*** ID accessor functions. ***/
34
35 /* Get the "node id" portion of ID. */
36 const char *svn_fs_fs__id_node_id(const svn_fs_id_t *id);
37
38 /* Get the "copy id" portion of ID. */
39 const char *svn_fs_fs__id_copy_id(const svn_fs_id_t *id);
40
41 /* Get the "txn id" portion of ID, or NULL if it is a permanent ID. */
42 const char *svn_fs_fs__id_txn_id(const svn_fs_id_t *id);
43
44 /* Get the "rev" portion of ID, or SVN_INVALID_REVNUM if it is a
45    transaction ID. */
46 svn_revnum_t svn_fs_fs__id_rev(const svn_fs_id_t *id);
47
48 /* Access the "offset" portion of the ID, or -1 if it is a transaction
49    ID. */
50 apr_off_t svn_fs_fs__id_offset(const svn_fs_id_t *id);
51
52 /* Convert ID into string form, allocated in POOL. */
53 svn_string_t *svn_fs_fs__id_unparse(const svn_fs_id_t *id,
54                                     apr_pool_t *pool);
55
56 /* Return true if A and B are equal. */
57 svn_boolean_t svn_fs_fs__id_eq(const svn_fs_id_t *a,
58                                const svn_fs_id_t *b);
59
60 /* Return true if A and B are related. */
61 svn_boolean_t svn_fs_fs__id_check_related(const svn_fs_id_t *a,
62                                           const svn_fs_id_t *b);
63
64 /* Return 0 if A and B are equal, 1 if they are related, -1 otherwise. */
65 int svn_fs_fs__id_compare(const svn_fs_id_t *a,
66                           const svn_fs_id_t *b);
67
68 /* Create an ID within a transaction based on NODE_ID, COPY_ID, and
69    TXN_ID, allocated in POOL. */
70 svn_fs_id_t *svn_fs_fs__id_txn_create(const char *node_id,
71                                       const char *copy_id,
72                                       const char *txn_id,
73                                       apr_pool_t *pool);
74
75 /* Create a permanent ID based on NODE_ID, COPY_ID, REV, and OFFSET,
76    allocated in POOL. */
77 svn_fs_id_t *svn_fs_fs__id_rev_create(const char *node_id,
78                                       const char *copy_id,
79                                       svn_revnum_t rev,
80                                       apr_off_t offset,
81                                       apr_pool_t *pool);
82
83 /* Return a copy of ID, allocated from POOL. */
84 svn_fs_id_t *svn_fs_fs__id_copy(const svn_fs_id_t *id,
85                                 apr_pool_t *pool);
86
87 /* Return an ID resulting from parsing the string DATA (with length
88    LEN), or NULL if DATA is an invalid ID string. */
89 svn_fs_id_t *svn_fs_fs__id_parse(const char *data,
90                                  apr_size_t len,
91                                  apr_pool_t *pool);
92
93
94 /* (de-)serialization support*/
95
96 struct svn_temp_serializer__context_t;
97
98 /**
99  * Serialize an @a id within the serialization @a context.
100  */
101 void
102 svn_fs_fs__id_serialize(struct svn_temp_serializer__context_t *context,
103                         const svn_fs_id_t * const *id);
104
105 /**
106  * Deserialize an @a id within the @a buffer.
107  */
108 void
109 svn_fs_fs__id_deserialize(void *buffer,
110                           svn_fs_id_t **id);
111
112 #ifdef __cplusplus
113 }
114 #endif /* __cplusplus */
115
116 #endif /* SVN_LIBSVN_FS_FS_ID_H */