X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=include%2Ftxn.h;h=635a3692d20fdb8c58bffbcf9715c27918167f7a;hp=9b80e17f5e1105c63894c448287c7d25a4ca9294;hb=d26bac75802a324ed98c8d3d88cfb9eb87b3b35a;hpb=95cfcadf0f8f69f4237cde9a61ea6c64b40f8043 diff --git a/include/txn.h b/include/txn.h index 9b80e17..635a369 100644 --- a/include/txn.h +++ b/include/txn.h @@ -4,12 +4,19 @@ */ #ifndef TXN_H #define TXN_H -#include "ht.h" -typedef enum { TXN_READ_WRITE, TXN_READ_ONLY, TXN_BLIND_WRITE } txn_access_t; -typedef enum { TXN_DIRTY_READ, TXN_READ_COMMITTED, TXN_REPEATABLE_READ } txn_isolation_t; +#include "map.h" + +typedef enum { TXN_REPEATABLE_READ, TXN_READ_COMMITTED, TXN_READ_ONLY } txn_type_e; +typedef enum { TXN_RUNNING, TXN_VALIDATING, TXN_VALIDATED, TXN_ABORTED } txn_state_e; typedef struct txn txn_t; -txn_t *txn_begin (txn_access_t access, txn_isolation_t isolation, hash_table_t *ht); +txn_t * txn_begin (txn_type_e type, map_t *map); +void txn_abort (txn_t *txn); +txn_state_e txn_commit (txn_t *txn); + +uint64_t tm_get (txn_t *txn, void *key); +void tm_set (txn_t *txn, void *key, uint64_t value); + #endif//TXN_H