]> git.ozlabs.org Git - ccan/blob - ccan/tdb/test/external-transaction.h
tdb: new test for dying during a transaction.
[ccan] / ccan / tdb / test / external-transaction.h
1 #ifndef TDB_TEST_EXTERNAL_TRANSACTION_H
2 #define TDB_TEST_EXTERNAL_TRANSACTION_H
3 #include <stdbool.h>
4
5 enum operation {
6         OPEN,
7         OPEN_WITH_CLEAR_IF_FIRST,
8         TRANSACTION,
9         KEEP_OPENED,
10         TRANSACTION_KEEP_OPENED,
11         FETCH_KEEP_OPENED,
12         STORE_KEEP_OPENED,
13         CHECK_KEEP_OPENED,
14         NEEDS_RECOVERY_KEEP_OPENED,
15         CLOSE,
16 };
17
18 /* Do this before doing any tdb stuff.  Return handle, or -1. */
19 struct agent *prepare_external_agent(void);
20
21 /* Ask the external agent to try to do an operation. */
22 int external_agent_operation(struct agent *handle,
23                              enum operation op,
24                              const char *tdbname);
25
26 /* Ask... */
27 void external_agent_operation_start(struct agent *agent,
28                                     enum operation op, const char *tdbname);
29
30 /* See if they've done it. */
31 bool external_agent_operation_check(struct agent *agent, bool block, int *res);
32 #endif /* TDB_TEST_EXTERNAL_TRANSACTION_H */