Range Locking

map: operator --> key --> value

 

If I want to add key AS value  IN record, I should be blocked if:

  • There is a an EQ lock for key as value
  • There is a NEQ lock for key as anything other than value
  • There is a GT lock for key as anything less than value
  • There is a GTE lock for key as anything less than or equal to value
  • There is a LT lock for key as anything greater than value
  • There is a LTE lock for key as anything greater than value
  • There is a BW lock for key as anything greater than or equal to value or less than or equal to value
  • There is a REGEX lock for a key as anything that matches value
  • There is a NREGEX lock for key as anything that does not match value

Before I add data, I must register my key and value with a RangeLocker for every operation type

 

 

RangeLock

writeLock(key, value) --> this is called from write methods and adds value to key for every operator

  • if there currently exists value to key then wait until its gone

 

readLock(key, value, operator) --> this is called from find method and adds value to key for operator

  • if there currently exists key to value in operator then its okay to proceed since this is a read lock

 

readUnlock(key, value) 

unlock(key, value, operator)

 

After write and find method