1 #ifndef PENDINGTRANSACTION_H
2 #define PENDINGTRANSACTION_H
6 class PendingTransaction {
8 Hashset<KeyValue *> *keyValueUpdateSet;
9 Hashset<KeyValue *> *keyValueGuardSet;
11 int64_t clientLocalSequenceNumber;
13 int32_t currentDataSize;
16 PendingTransaction(int64_t _machineId);
17 ~PendingTransaction();
19 * Add a new key value to the updates
22 void addKV(KeyValue *newKV);
24 * Add a new key value to the guard set
27 void addKVGuard(KeyValue *newKV);
29 * Checks if the arbitrator is the same
31 bool checkArbitrator(int64_t arb);
33 * Get the transaction arbitrator
35 int64_t getArbitrator() {return arbitrator;}
37 * Get the key value update set
39 Hashset<KeyValue *> *getKVUpdates() { return keyValueUpdateSet; }
42 * Get the key value update set
44 Hashset<KeyValue *> *getKVGuard() { return keyValueGuardSet; }
46 void setClientLocalSequenceNumber(int64_t _clientLocalSequenceNumber) { clientLocalSequenceNumber = _clientLocalSequenceNumber; }
48 int64_t getClientLocalSequenceNumber() { return clientLocalSequenceNumber; }
50 int64_t getMachineId() { return machineId; }
52 bool evaluateGuard(Hashtable<IoTString *, KeyValue *> *keyValTableCommitted, Hashtable<IoTString *, KeyValue *> *keyValTableSpeculative, Hashtable<IoTString *, KeyValue *> *keyValTablePendingTransSpeculative);
54 Transaction *createTransaction();
56 Array<char> *convertDataToBytes();