diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:24:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:24:13 +0930 |
commit | 9660546a18cc9af508e6e594349d869bdcefafb2 (patch) | |
tree | d4730be4e2663201ed8f6c6820180e930bb40d89 /lib/tdb2/test/tdb1-external-agent.h | |
parent | bfcd0ebd980eb5ebc56e6b57fd158c2fad89fc78 (diff) | |
download | samba-9660546a18cc9af508e6e594349d869bdcefafb2.tar.gz samba-9660546a18cc9af508e6e594349d869bdcefafb2.tar.bz2 samba-9660546a18cc9af508e6e594349d869bdcefafb2.zip |
tdb2: test: import tdb1's tests.
The main change is to s/tdb/tdb1_/ everywhere.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit fab544c24c1ad6523f95893abcaec4e6cce6c2b4)
Diffstat (limited to 'lib/tdb2/test/tdb1-external-agent.h')
-rw-r--r-- | lib/tdb2/test/tdb1-external-agent.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/tdb2/test/tdb1-external-agent.h b/lib/tdb2/test/tdb1-external-agent.h new file mode 100644 index 0000000000..8b0c1548a7 --- /dev/null +++ b/lib/tdb2/test/tdb1-external-agent.h @@ -0,0 +1,41 @@ +#ifndef TDB_TEST_EXTERNAL_AGENT_H +#define TDB_TEST_EXTERNAL_AGENT_H + +/* For locking tests, we need a different process to try things at + * various times. */ +enum operation { + OPEN, + OPEN_WITH_CLEAR_IF_FIRST, + TRANSACTION_START, + FETCH, + STORE, + TRANSACTION_COMMIT, + CHECK, + NEEDS_RECOVERY, + CLOSE, +}; + +/* Do this before doing any tdb stuff. Return handle, or -1. */ +struct agent *prepare_external_agent1(void); + +enum agent_return { + SUCCESS, + WOULD_HAVE_BLOCKED, + AGENT_DIED, + FAILED, /* For fetch, or NEEDS_RECOVERY */ + OTHER_FAILURE, +}; + +/* Ask the external agent to try to do an operation. + * name == tdb name for OPEN/OPEN_WITH_CLEAR_IF_FIRST, + * record name for FETCH/STORE (store stores name as data too) + */ +enum agent_return external_agent_operation1(struct agent *handle, + enum operation op, + const char *name); + +/* Mapping enum -> string. */ +const char *agent_return_name1(enum agent_return ret); +const char *operation_name1(enum operation op); + +#endif /* TDB_TEST_EXTERNAL_AGENT_H */ |