Question: Write a function, named validate _ locking _ schedule that takes a list of Actions ( see below ) as its only parameter. This function

Write a function, named validate_locking_schedule that takes a list of Actions (see below) as its only parameter. This function doesnt return anything, but instead raises exceptions if the schedule is invalid (according to legality of schedules, two-phased locking, and consistency of transactions). Be sure to validate the actions in that order. The exception classes are already defined for you in your starter solution.
The Action class is a simple class with attributes denoting the id of the database object (region), the id of the transaction the action takes place in, and the type of action (if the action was a read, write, lock, or unlock).
You can assume the action classs object_ and transaction attributes are strings or integers (types which support equality) and the type is an UPPERCASE string.
class Action:
"""
This is the Action class. It is already in the test cases, so please don't
put it in your solution.
"""
def __init__(self, object_, transaction, type_):
self.object_= object_
self.transaction = transaction
assert type_ in ("READ", "WRITE", "LOCK", "UNLOCK")
self.type_= type_
def __str__(self):
return f"Action({self.object_},{self.transaction},{self.type_})"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!