]> pd.if.org Git - nbds/blob - include/txn.h
pad struct to improve hazard performance, fix off-by-one error
[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_RUNNING, TXN_VALIDATING, TXN_VALIDATED, TXN_ABORTED } txn_state_e;
11
12 typedef struct txn txn_t;
13
14 void txn_init (void);
15
16 txn_t *     txn_begin  (map_t *map);
17 void        txn_abort  (txn_t *txn);
18 txn_state_e txn_commit (txn_t *txn);
19
20 map_val_t   txn_map_get (txn_t *txn, map_key_t key);
21 void        txn_map_set (txn_t *txn, map_key_t key, map_val_t value);
22
23 #endif//TXN_H