]> pd.if.org Git - nbds/blob - include/txn.h
51db400e80b520567c1c1f8fb5db07cb2f67a2f1
[nbds] / include / txn.h
1 /* 
2  * Written by Josh Dybnis and released to the public domain, as explained at
3  * http://creativecommons.org/licenses/publicdomain
4  */
5 #ifndef TXN_H
6 #define TXN_H
7
8 #include "map.h"
9
10 typedef enum { TXN_READ_WRITE, TXN_READ_ONLY, TXN_BLIND_WRITE          } txn_access_e;
11 typedef enum { TXN_REPEATABLE_READ, TXN_READ_COMMITTED, TXN_DIRTY_READ } txn_isolation_e;
12 typedef enum { TXN_RUNNING, TXN_VALIDATING, TXN_VALIDATED, TXN_ABORTED } txn_state_e;
13
14 typedef struct txn txn_t;
15
16 txn_t *     txn_begin  (txn_access_e access, txn_isolation_e isolation, map_type_t map_type);
17 void        txn_abort  (txn_t *txn);
18 txn_state_e txn_commit (txn_t *txn);
19
20 uint64_t tm_get (txn_t *txn, const char *key, uint32_t key_len);
21 void     tm_set (txn_t *txn, const char *key, uint32_t key_len, uint64_t value);
22
23 #endif//TXN_H