@@ -0,0 +1,1905 @@
+# from slave1 import Slave1%0A# from slave2 import Slave2%0A%0Aimport rocksdb%0Aimport encodings%0A%0A%0A%0A# class Replica:%0A%0A#     def __init__(self):%0A#         print(%22Decorator%22)%0A%0A#     def decorator(self, rep):%0A#         def wrapper():%0A%0A#             key, value = rep()%0A%0A#             #if((slave1.Slave1.get(key))!=value):%0A#             slave1.Slave1.put(self, key, value)%0A#             #if(slave2.Slave2.get(key)!=value):%0A#             slave1.Slave1.put(self, key, value)%0A%0A#             print(%22Something is happening after some_function() is called.%22)%0A%0A#         return wrapper%0A%0A# class Replica:%0A# def my_decorator(argument):%0Adef put_decorator(function):%0A    def wrapper(*args, **kwargs):%0A%0A        key = (args%5B0%5D)%0A        value = (args%5B1%5D)%0A%0A        print(%22Put data in Slave1 DB%22)%0A        slave1_db = rocksdb.DB(%22slave_1.db%22, rocksdb.Options(create_if_missing=True))%0A        slave1_db.put(key.encode(), value.encode())%0A%0A        print(%22Put data in Slave2 DB%22)%0A        slave2_db = rocksdb.DB(%22slave_2.db%22, rocksdb.Options(create_if_missing=True))%0A        slave2_db.put(key.encode(), value.encode())%0A%0A        # slv1 = Slave1()%0A        # slv2 = Slave2()%0A%0A%0A        # if((slv1.get(key))!=value):%0A        # slv1.put(key, value)%0A        # if(slv2.get(key)!=value):%0A        # slv2.put(key, value)%0A%0A        %0A        # slv1.put(args%5B0%5D, args%5B1%5D)%0A%0A        return function(*args, **kwargs)%0A    return wrapper%0A%0Adef get_decorator(function):%0A    def wrapper(*args, **kwargs):%0A%0A        key = (args%5B0%5D)%0A%0A        slave1_db = rocksdb.DB(%22slave_1.db%22, rocksdb.Options(create_if_missing=True))%0A        print(%22Value of %22 + args%5B0%5D + %22 in Slave1 DB is %22 + (slave1_db.get(key.encode())).decode())%0A        slave2_db = rocksdb.DB(%22slave_2.db%22, rocksdb.Options(create_if_missing=True))%0A        print(%22Value of %22 + args%5B0%5D + %22 in Slave1 DB is %22 + (slave2_db.get(key.encode())).decode())%0A        return function(*args, **kwargs)%0A%0A    return wrapper

Add File with decorator functions