public boolean canWrite(TransactionOperation op) { TimeStamp TS = op.transactionTimeStamp; if (TS.compareTo(RTM) == TimeStamp.BEFORE || TS.compareTo(WTM) == TimeStamp.BEFORE) { return false; } else { WTM = TS; return true; } }
/** * Note that you should call read() pretty soon after this, else you could end up with a READ when * you shouldn't be able to. */ public boolean canRead(TransactionOperation op) { TimeStamp TS = op.transactionTimeStamp; if (TS.compareTo(WTM) == TimeStamp.BEFORE) { return false; } else { setMaxRTM(TS); return true; } }
/** Set RTM to be max (RTM, TS). */ public void setMaxRTM(TimeStamp TS) { if (RTM == null) { RTM = TS; } else if (TS.compareTo(RTM) == TimeStamp.AFTER) { RTM = TS; } }