1
/* transaction.h --- transaction-related functions of FSFS
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__TRANSACTION_H
24
#define SVN_LIBSVN_FS__TRANSACTION_H
28
/* Return the transaction ID of TXN.
30
const svn_fs_fs__id_part_t *
31
svn_fs_fs__txn_get_id(svn_fs_txn_t *txn);
33
/* Store NODEREV as the node-revision for the node whose id is ID in
34
FS, after setting its is_fresh_txn_root to FRESH_TXN_ROOT. Do any
35
necessary temporary allocation in POOL. */
37
svn_fs_fs__put_node_revision(svn_fs_t *fs,
38
const svn_fs_id_t *id,
39
node_revision_t *noderev,
40
svn_boolean_t fresh_txn_root,
43
/* Find the paths which were changed in transaction TXN_ID of
44
filesystem FS and store them in *CHANGED_PATHS_P.
45
Get any temporary allocations from POOL. */
47
svn_fs_fs__txn_changes_fetch(apr_hash_t **changed_paths_p,
49
const svn_fs_fs__id_part_t *txn_id,
52
/* Find the paths which were changed in revision REV of filesystem FS
53
and store them in *CHANGED_PATHS_P. Get any temporary allocations
56
svn_fs_fs__paths_changed(apr_hash_t **changed_paths_p,
61
/* Create a new transaction in filesystem FS, based on revision REV,
62
and store it in *TXN_P. Allocate all necessary variables from
65
svn_fs_fs__create_txn(svn_fs_txn_t **txn_p,
70
/* Set the transaction property NAME to the value VALUE in transaction
71
TXN. Perform temporary allocations from POOL. */
73
svn_fs_fs__change_txn_prop(svn_fs_txn_t *txn,
75
const svn_string_t *value,
78
/* Change transaction properties in transaction TXN based on PROPS.
79
Perform temporary allocations from POOL. */
81
svn_fs_fs__change_txn_props(svn_fs_txn_t *txn,
82
const apr_array_header_t *props,
85
/* Store a transaction record in *TXN_P for the transaction identified
86
by TXN_ID in filesystem FS. Allocate everything from POOL. */
88
svn_fs_fs__get_txn(transaction_t **txn_p,
90
const svn_fs_fs__id_part_t *txn_id,
93
/* Return the next available copy_id in *COPY_ID for the transaction
94
TXN_ID in filesystem FS. Allocate space in POOL. */
96
svn_fs_fs__reserve_copy_id(svn_fs_fs__id_part_t *copy_id_p,
98
const svn_fs_fs__id_part_t *txn_id,
101
/* Create an entirely new mutable node in the filesystem FS, whose
102
node-revision is NODEREV. Set *ID_P to the new node revision's ID.
103
Use POOL for any temporary allocation. COPY_ID is the copy_id to
104
use in the node revision ID. TXN_ID is the Subversion transaction
105
under which this occurs. */
107
svn_fs_fs__create_node(const svn_fs_id_t **id_p,
109
node_revision_t *noderev,
110
const svn_fs_fs__id_part_t *copy_id,
111
const svn_fs_fs__id_part_t *txn_id,
114
/* Remove all references to the transaction TXN_ID from filesystem FS.
115
Temporary allocations are from POOL. */
117
svn_fs_fs__purge_txn(svn_fs_t *fs,
121
/* Abort the existing transaction TXN, performing any temporary
122
allocations in POOL. */
124
svn_fs_fs__abort_txn(svn_fs_txn_t *txn,
127
/* Add or set in filesystem FS, transaction TXN_ID, in directory
128
PARENT_NODEREV a directory entry for NAME pointing to ID of type
129
KIND. Allocations are done in POOL. */
131
svn_fs_fs__set_entry(svn_fs_t *fs,
132
const svn_fs_fs__id_part_t *txn_id,
133
node_revision_t *parent_noderev,
135
const svn_fs_id_t *id,
136
svn_node_kind_t kind,
139
/* Add a change to the changes record for filesystem FS in transaction
140
TXN_ID. Mark path PATH, having node-id ID, as changed according to
141
the type in CHANGE_KIND. If the text representation was changed set
142
TEXT_MOD to TRUE, and likewise for PROP_MOD as well as MERGEINFO_MOD.
143
If this change was the result of a copy, set COPYFROM_REV and
144
COPYFROM_PATH to the revision and path of the copy source, otherwise
145
they should be set to SVN_INVALID_REVNUM and NULL. Perform any
146
temporary allocations from POOL. */
148
svn_fs_fs__add_change(svn_fs_t *fs,
149
const svn_fs_fs__id_part_t *txn_id,
151
const svn_fs_id_t *id,
152
svn_fs_path_change_kind_t change_kind,
153
svn_boolean_t text_mod,
154
svn_boolean_t prop_mod,
155
svn_boolean_t mergeinfo_mod,
156
svn_node_kind_t node_kind,
157
svn_revnum_t copyfrom_rev,
158
const char *copyfrom_path,
161
/* Return a writable stream in *STREAM that allows storing the text
162
representation of node-revision NODEREV in filesystem FS.
163
Allocations are from POOL. */
165
svn_fs_fs__set_contents(svn_stream_t **stream,
167
node_revision_t *noderev,
170
/* Create a node revision in FS which is an immediate successor of
171
OLD_ID, whose contents are NEW_NR. Set *NEW_ID_P to the new node
172
revision's ID. Use POOL for any temporary allocation.
174
COPY_ID, if non-NULL, is a key into the `copies' table, and
175
indicates that this new node is being created as the result of a
176
copy operation, and specifically which operation that was. If
177
COPY_ID is NULL, then re-use the copy ID from the predecessor node.
179
TXN_ID is the Subversion transaction under which this occurs.
181
After this call, the deltification code assumes that the new node's
182
contents will change frequently, and will avoid representing other
183
nodes as deltas against this node's contents. */
185
svn_fs_fs__create_successor(const svn_fs_id_t **new_id_p,
187
const svn_fs_id_t *old_idp,
188
node_revision_t *new_noderev,
189
const svn_fs_fs__id_part_t *copy_id,
190
const svn_fs_fs__id_part_t *txn_id,
193
/* Write a new property list PROPLIST for node-revision NODEREV in
194
filesystem FS. Perform any temporary allocations in POOL. */
196
svn_fs_fs__set_proplist(svn_fs_t *fs,
197
node_revision_t *noderev,
198
apr_hash_t *proplist,
201
/* Append the L2P and P2L indexes given by their proto index file names
202
* L2P_PROTO_INDEX and P2L_PROTO_INDEX to the revision / pack FILE.
203
* The latter contains revision(s) starting at REVISION in FS.
204
* Use POOL for temporary allocations. */
206
svn_fs_fs__add_index_data(svn_fs_t *fs,
208
const char *l2p_proto_index,
209
const char *p2l_proto_index,
210
svn_revnum_t revision,
213
/* Commit the transaction TXN in filesystem FS and return its new
214
revision number in *REV. If the transaction is out of date, return
215
the error SVN_ERR_FS_TXN_OUT_OF_DATE. Use POOL for temporary
218
svn_fs_fs__commit(svn_revnum_t *new_rev_p,
223
/* Set *NAMES_P to an array of names which are all the active
224
transactions in filesystem FS. Allocate the array from POOL. */
226
svn_fs_fs__list_transactions(apr_array_header_t **names_p,
230
/* Open the transaction named NAME in filesystem FS. Set *TXN_P to
231
* the transaction. If there is no such transaction, return
232
` * SVN_ERR_FS_NO_SUCH_TRANSACTION. Allocate the new transaction in
235
svn_fs_fs__open_txn(svn_fs_txn_t **txn_p,
240
/* Return the property list from transaction TXN and store it in
241
*PROPLIST. Allocate the property list from POOL. */
243
svn_fs_fs__txn_proplist(apr_hash_t **table_p,
247
/* Delete the mutable node-revision referenced by ID, along with any
248
mutable props or directory contents associated with it. Perform
249
temporary allocations in POOL. */
251
svn_fs_fs__delete_node_revision(svn_fs_t *fs,
252
const svn_fs_id_t *id,
255
/* Retrieve information about the Subversion transaction SVN_TXN from
256
the `transactions' table of FS, allocating from POOL. Set
257
*ROOT_ID_P to the ID of the transaction's root directory. Set
258
*BASE_ROOT_ID_P to the ID of the root directory of the
259
transaction's base revision.
261
If there is no such transaction, SVN_ERR_FS_NO_SUCH_TRANSACTION is
264
Returns SVN_ERR_FS_TRANSACTION_NOT_MUTABLE if TXN_NAME refers to a
265
transaction that has already been committed.
267
Allocate *ROOT_ID_P and *BASE_ROOT_ID_P in POOL. */
269
svn_fs_fs__get_txn_ids(const svn_fs_id_t **root_id_p,
270
const svn_fs_id_t **base_root_id_p,
272
const svn_fs_fs__id_part_t *txn_name,
275
/* Find the value of the property named PROPNAME in transaction TXN.
276
Return the contents in *VALUE_P. The contents will be allocated
279
svn_fs_fs__txn_prop(svn_string_t **value_p,
281
const char *propname,
284
/* Begin a new transaction in filesystem FS, based on existing
285
revision REV. The new transaction is returned in *TXN_P. Allocate
286
the new transaction structure from POOL. */
288
svn_fs_fs__begin_txn(svn_fs_txn_t **txn_p,