Skip to main content
Sign in
Snippets Groups Projects
Commit 2843af89 authored by Ahmad Naufal Hakim's avatar Ahmad Naufal Hakim
Browse files

Edit mvcc read function

parent 760a7550
No related branches found
No related tags found
No related merge requests found
......@@ -9,11 +9,18 @@ class MVCC :
return time.time()
def setTimestampNow(self, key, timestamp, storage : strg) :
tempTimestamp = timestamp
storage.setdata[key]["timestamp"] = tempTimestamp
storage.setdata[key]["timestamp"] = timestamp
def read(self, key, storage : strg) :
return storage.setdata[key]["value"]
tempTimestamp = self.getTimestampNow()
if (storage.setdata[key]["timestamp"] > tempTimestamp) :
# rollback transaction
# reject operation
return False
else :
self.setTimestampNow(key, tempTimestamp, storage)
return True, storage.setdata[key]["value"]
def write(self, key, value, storage : strg) :
tempTimestamp = self.getTimestampNow()
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment