1 /*
2     Transaction code for Xen Store Daemon.
3     Copyright (C) 2005 Rusty Russell IBM Corporation
4 
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program; If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef _XENSTORED_TRANSACTION_H
19 #define _XENSTORED_TRANSACTION_H
20 #include "xenstored_core.h"
21 
22 enum node_access_type {
23     NODE_ACCESS_READ,
24     NODE_ACCESS_WRITE,
25     NODE_ACCESS_DELETE
26 };
27 
28 struct transaction;
29 
30 int do_transaction_start(struct connection *conn, struct buffered_data *node);
31 int do_transaction_end(struct connection *conn, struct buffered_data *in);
32 
33 struct transaction *transaction_lookup(struct connection *conn, uint32_t id);
34 
35 /* inc/dec entry number local to trans while changing a node */
36 void transaction_entry_inc(struct transaction *trans, unsigned int domid);
37 void transaction_entry_dec(struct transaction *trans, unsigned int domid);
38 
39 /* This node was accessed. */
40 int access_node(struct connection *conn, struct node *node,
41                 enum node_access_type type, TDB_DATA *key);
42 
43 /* Prepend the transaction to name if appropriate. */
44 int transaction_prepend(struct connection *conn, const char *name,
45                         TDB_DATA *key);
46 
47 void conn_delete_all_transactions(struct connection *conn);
48 int check_transactions(struct hashtable *hash);
49 
50 #endif /* _XENSTORED_TRANSACTION_H */
51