// Validate the updates for <key>. Validation fails for a key we have written to if there is a
// write committed newer than our read version.
// Validate the updates for <key>. Validation fails for a key we have written to if there is a
// write committed newer than our read version.
for (; update != NULL; update = update->prev) {
uint64_t writer_version = update->version;
if (writer_version <= txn->rv)
for (; update != NULL; update = update->prev) {
uint64_t writer_version = update->version;
if (writer_version <= txn->rv)
txn_t *txn = (txn_t *)nbd_malloc(sizeof(txn_t));
memset(txn, 0, sizeof(txn_t));
txn->access = access;
txn_t *txn = (txn_t *)nbd_malloc(sizeof(txn_t));
memset(txn, 0, sizeof(txn_t));
txn->access = access;
if (isolation != TXN_READ_ONLY) {
txn->writes = nbd_malloc(sizeof(*txn->writes) * INITIAL_WRITES_SIZE);
txn->writes_size = INITIAL_WRITES_SIZE;
if (isolation != TXN_READ_ONLY) {
txn->writes = nbd_malloc(sizeof(*txn->writes) * INITIAL_WRITES_SIZE);
txn->writes_size = INITIAL_WRITES_SIZE;
// Iterate through update records associated with <key> to find the latest committed version.
// We can use the first matching version. Older updates always come later in the list.
// Iterate through update records associated with <key> to find the latest committed version.
// We can use the first matching version. Older updates always come later in the list.
for (; update != NULL; update = update->prev) {
uint64_t writer_version = update->version;
if (writer_version < txn->rv)
for (; update != NULL; update = update->prev) {
uint64_t writer_version = update->version;
if (writer_version < txn->rv)
-void tm_set (txn_t *txn, const char *key, uint32_t key_len, uint64_t value) {
+void tm_set (txn_t *txn, void *key, uint64_t value) {
- } while (map_cas(txn->map, key, key_len, update_prev, (uint64_t)update) != update_prev);
+ } while (map_cas(txn->map, key, update_prev, (uint64_t)update) != update_prev);
// add <key> to the write set for commit-time validation
if (txn->writes_count == txn->writes_size) {
// add <key> to the write set for commit-time validation
if (txn->writes_count == txn->writes_size) {