Slot *lastSlotAttemptedToSend;
bool lastIsNewKey;
int lastNewSize;
- Hashtable<Transaction *, Vector<int32_t> *> lastTransactionPartsSent;
+ Hashtable<Transaction *, Vector<int32_t> *> *lastTransactionPartsSent;
Vector<Entry *> *lastPendingSendArbitrationEntriesToDelete;
NewKey *lastNewKey;
Vector<Transaction *> *pendingTransactionQueue;
Vector<ArbitrationRound *> *pendingSendArbitrationRounds;
Vector<Entry *> *pendingSendArbitrationEntriesToDelete;
- Hashtable<Transaction *, Vector<int32_t *> *> *transactionPartsSent;
+ Hashtable<Transaction *, Vector<int32_t> *> *transactionPartsSent;
Hashtable<int64_t, TransactionStatus *> *outstandingTransactionStatus;
Hashtable<int64_t, Abort *> *liveAbortsGeneratedByLocal;
Hashset<Pair<int64_t, int64_t> *> *offlineTransactionsCommittedAndAtServer;
/**
* Returns false if a resize was needed
*/
- ThreeTuple<bool, int32_t *, bool> *fillSlot(Slot *slot, bool resize, NewKey *newKeyEntry);
- void doRejectedMessages(Slot s);
+ ThreeTuple<bool, int32_t, bool> *fillSlot(Slot *slot, bool resize, NewKey *newKeyEntry);
+ void doRejectedMessages(Slot *s);
- ThreeTuple<bool, bool, int64_t> doMandatoryResuce(Slot slot, bool resize);
+ ThreeTuple<bool, bool, int64_t> doMandatoryResuce(Slot *slot, bool resize);
- void doOptionalRescue(Slot s, bool seenliveslot, int64_t seqn, bool resize);
+ void doOptionalRescue(Slot *s, bool seenliveslot, int64_t seqn, bool resize);
/**
* Checks for malicious activity and updates the local copy of the block chain.
*/
- void validateAndUpdate(Array<Slot> *newSlots, bool acceptUpdatesToLocal);
+ void validateAndUpdate(Array<Slot*> *newSlots, bool acceptUpdatesToLocal);
void updateLiveStateFromServer();
void arbitrateFromServer();
- Pair<bool, bool> arbitrateOnLocalTransaction(Transaction transaction);
+ Pair<bool, bool> arbitrateOnLocalTransaction(Transaction * transaction);
/**
* Compacts the arbitration data my merging commits and aggregating aborts so that a single large push of commits can be done instead of many small updates
/**
* Process this slot, entry by entry. Also update the latest message sent by slot
*/
- void processSlot(SlotIndexer indexer, Slot slot, bool acceptUpdatesToLocal, Hashset<int64_t> machineSet);
+ void processSlot(SlotIndexer *indexer, Slot *slot, bool acceptUpdatesToLocal, Hashset<int64_t> *machineSet);
/**
* Update the last message that was sent for a machine Id
*/
- void processEntry(LastMessage entry, Hashset<int64_t> machineSet);
+ void processEntry(LastMessage *entry, Hashset<int64_t> *machineSet);
/**
* Add the new key to the arbitrators table and update the set of live new keys (in case of a rescued new key message)
*/
- void processEntry(NewKey entry);
+ void processEntry(NewKey * entry);
/**
* Process new table status entries and set dead the old ones as new ones come in.
* keeps track of the largest and smallest table status seen in this current round
* of updating the local copy of the block chain
*/
- void processEntry(TableStatus entry, int64_t seq);
+ void processEntry(TableStatus *entry, int64_t seq);
/**
* Check old messages to see if there is a block chain violation. Also
*/
- void processEntry(RejectedMessage entry, SlotIndexer indexer);
+ void processEntry(RejectedMessage *entry, SlotIndexer *indexer);
/**
* Check if this abort is live, if not then save it so we can kill it later.
* update the last transaction number that was arbitrated on.
*/
- void processEntry(Abort entry);
+ void processEntry(Abort *entry);
/**
* Set dead the transaction part if that transaction is dead and keep track of all new parts
*/
- void processEntry(TransactionPart entry);
+ void processEntry(TransactionPart *entry);
/**
* Process new commit entries and save them for future use. Delete duplicates
*/
- void processEntry(CommitPart entry);
+ void processEntry(CommitPart *entry);
/**
* Update the last message seen table. Update and set dead the appropriate RejectedMessages as clients see them.
* Check that the last message seen is correct and that there is no mismatch of our own last message or that
* other clients have not had a rollback on the last message.
*/
- void updateLastMessage(int64_t machineId, int64_t seqNum, Liveness liveness, bool acceptUpdatesToLocal, Hashset<int64_t> machineSet);
+ void updateLastMessage(int64_t machineId, int64_t seqNum, Liveness *liveness, bool acceptUpdatesToLocal, Hashset<int64_t> *machineSet);
/**
* Add a rejected message entry to the watch set to keep track of which clients have seen that
* rejected message entry and which have not.
*/
- void addWatchVector(int64_t machineId, RejectedMessage entry);
+ void addWatchVector(int64_t machineId, RejectedMessage * entry);
/**
* Check if the HMAC chain is not violated
*/
- void checkHMACChain(SlotIndexer indexer, Array<Slot> *newSlots);
+ void checkHMACChain(SlotIndexer * indexer, Array<Slot*> *newSlots);
public:
Table(IoTString *baseurl, IoTString *password, int64_t _localMachineId, int listeningPort);
- Table(CloudComm _cloud, int64_t _localMachineId);
+ Table(CloudComm *_cloud, int64_t _localMachineId);
/**
* Initialize the table by inserting a table status as the first entry into the table status
/**
* Rebuild the table from scratch by pulling the latest block chain from the server.
*/
+ bool update();
void rebuild();
void addLocalCommunication(int64_t arbitrator, IoTString *hostName, int portNumber);
- uint64_t getArbitrator(IoTString *key);
+ int64_t getArbitrator(IoTString *key);
void close();
IoTString *getCommitted(IoTString *key);
IoTString *getSpeculative(IoTString *key);
IoTString *getCommittedAtomic(IoTString *key);
bool createNewKey(IoTString *keyName, int64_t machineId);
+ void startTransaction();
+ void addKV(IoTString *key, IoTString *value);
TransactionStatus *commitTransaction();
/**