val* transaction_get(transaction* t, key* k) { val* v; flat_key_val* kv; // If read set is empty, mark current ST if ((t->st == -1) && (hashtable_count(t->rs) == 0)) t->st = cproxy_current_st(); // Lookup write set kv = hashtable_search(t->ws, k); if (kv != NULL) { v = val_new(&kv->data[kv->ksize], kv->vsize); // if (v->size > 0) add_to_set(t->rs, k, v); return v; } // Lookup read set kv = hashtable_search(t->rs, k); if (kv != NULL) { v = val_new(&kv->data[kv->ksize], kv->vsize); return v; } // Lookup storage if ((v = sm_get(k, t->st)) != NULL) { add_to_set(t->rs, k, v); return v; } // Issue a remote get and return NULL remote_get(k, t->st, remote_get_cb, t); return NULL; }
static int ini_handler(__UNUSED__ void* userData, const char* section, const char* name, const char* value) { if (0 == strcmp(section, "ignore_classes")) { sm_put(gdata->ignore_classes, name, (void*)1); } else if (0 == strcmp(section, "ignore_referenced_by")) { char* endptr, *classname; IgnoreField* old = NULL; int v = strtol(value, &endptr, 10); int idx, nameLen; IgnoreField* newElement; if (*endptr != '\0') { alert("Error: Bad value for [%s] %s which is (%s)\n", section, name, value); return 0; } nameLen = strlen(name); for (idx = nameLen; idx >= 0 && name[idx] != '.'; idx--); if (idx < 0) { alert("Error: Cannot find class name for %s\n", name); return 0; } if (nameLen-idx == 1) { alert("Error: Cannot find field name for %s\n", name); return 0; } newElement = (IgnoreField*)myAlloc(sizeof(IgnoreField)); memset(newElement, 0, sizeof(*newElement)); newElement->fieldName = (char*)myAlloc(nameLen-idx); strcpy(newElement->fieldName, name+idx+1); classname = (char*)myAlloc(idx + 1); strncpy(classname, name, idx); classname[idx] = 0; newElement->threshold = v; debug("Parsing class name [%s], field [%s], limit %d\n", classname, newElement->fieldName, v); sm_get(gdata->ignore_referenced_by, classname, (void**)&old); newElement->next = old; sm_put(gdata->ignore_referenced_by, classname, newElement); myFree(classname); } return 1; }