| 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 "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 |
extern uint64_t generation; |
| 31 |
|
| 32 |
int do_transaction_start(const void *ctx, struct connection *conn, |
| 33 |
struct buffered_data *node); |
| 34 |
int do_transaction_end(const void *ctx, struct connection *conn, |
| 35 |
struct buffered_data *in); |
| 36 |
|
| 37 |
struct transaction *transaction_lookup(struct connection *conn, uint32_t id); |
| 38 |
|
| 39 |
/* Set flag for created node. */ |
| 40 |
void ta_node_created(struct transaction *trans); |
| 41 |
|
| 42 |
/* This node was accessed. */ |
| 43 |
int __must_check access_node(struct connection *conn, struct node *node, |
| 44 |
enum node_access_type type, const char **db_name); |
| 45 |
|
| 46 |
/* Queue watches for a modified node. */ |
| 47 |
void queue_watches(struct connection *conn, const char *name, bool watch_exact); |
| 48 |
|
| 49 |
/* Prepend the transaction to name if appropriate. */ |
| 50 |
const char *transaction_prepend(struct connection *conn, const char *name); |
| 51 |
|
| 52 |
/* Mark the transaction as failed. This will prevent it to be committed. */ |
| 53 |
void fail_transaction(struct transaction *trans); |
| 54 |
|
| 55 |
/* Get the list head of the changed domains. */ |
| 56 |
struct list_head *transaction_get_changed_domains(struct transaction *trans); |
| 57 |
|
| 58 |
void conn_delete_all_transactions(struct connection *conn); |
| 59 |
int check_transactions(struct hashtable *hash); |
| 60 |
|
| 61 |
#endif /* _XENSTORED_TRANSACTION_H */ |