X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=include%2Ftxn.h;h=51db400e80b520567c1c1f8fb5db07cb2f67a2f1;hp=c23c59b8548085e8f09aa4b07d1bd428896be634;hb=fa60fb1fb78136edc9e5863c0b86222f572963ef;hpb=df360b20f11476e53534a53c9ce11493d7c7a764 diff --git a/include/txn.h b/include/txn.h index c23c59b..51db400 100644 --- a/include/txn.h +++ b/include/txn.h @@ -4,12 +4,20 @@ */ #ifndef TXN_H #define TXN_H + #include "map.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; +typedef enum { TXN_READ_WRITE, TXN_READ_ONLY, TXN_BLIND_WRITE } txn_access_e; +typedef enum { TXN_REPEATABLE_READ, TXN_READ_COMMITTED, TXN_DIRTY_READ } txn_isolation_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, map_t *map); +txn_t * txn_begin (txn_access_e access, txn_isolation_e isolation, map_type_t map_type); +void txn_abort (txn_t *txn); +txn_state_e txn_commit (txn_t *txn); + +uint64_t tm_get (txn_t *txn, const char *key, uint32_t key_len); +void tm_set (txn_t *txn, const char *key, uint32_t key_len, uint64_t value); + #endif//TXN_H