]> git.ozlabs.org Git - ccan/blob - ccan/tdb2/test/tdb1-external-agent.h
ttxml: removed cruft from tests
[ccan] / ccan / tdb2 / test / tdb1-external-agent.h
1 #ifndef TDB_TEST_EXTERNAL_AGENT_H
2 #define TDB_TEST_EXTERNAL_AGENT_H
3
4 /* For locking tests, we need a different process to try things at
5  * various times. */
6 enum operation {
7         OPEN,
8         TRANSACTION_START,
9         FETCH,
10         STORE,
11         TRANSACTION_COMMIT,
12         CHECK,
13         NEEDS_RECOVERY,
14         CLOSE,
15 };
16
17 /* Do this before doing any tdb stuff.  Return handle, or -1. */
18 struct agent *prepare_external_agent1(void);
19
20 enum agent_return {
21         SUCCESS,
22         WOULD_HAVE_BLOCKED,
23         AGENT_DIED,
24         FAILED, /* For fetch, or NEEDS_RECOVERY */
25         OTHER_FAILURE,
26 };
27
28 /* Ask the external agent to try to do an operation.
29  * name == tdb name for OPEN/OPEN_WITH_CLEAR_IF_FIRST,
30  * record name for FETCH/STORE (store stores name as data too)
31  */
32 enum agent_return external_agent_operation1(struct agent *handle,
33                                            enum operation op,
34                                            const char *name);
35
36 /* Mapping enum -> string. */
37 const char *agent_return_name1(enum agent_return ret);
38 const char *operation_name1(enum operation op);
39
40 #endif /* TDB_TEST_EXTERNAL_AGENT_H */