def server_df4(send_q, recv_q, server_ready, client_ready): df = Dataframe("SERVER_TEST4", [Car, Counter], resolver={Counter: counter_merge_func}) send_q.put(df.details) client_name = recv_q.get() # The server goes first. #print ("Server at start:", df.versioned_heap.version_graph.nodes.keys()) df.checkout() #Add Counter to server c1 = Counter(0) car1 = Car(0) df.add_many(Counter, [c1]) df.add_many(Car, [car1]) assert (c1.count == 0) # Modify the counter value. c1.count += 1 assert (c1.count == 1) # Push record into server. df.commit() #print ("Server after adding 2 cars:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C1 #print ("Setting C1") server_ready.set() # Waiting at point S1 #print ("Waiting for S1") client_ready.wait() client_ready.clear() #print ("Server after waiting for client first time:", df.versioned_heap.version_graph.nodes.keys()) #print (df.versioned_heap.state_to_app) df.checkout() assert (c1.count == 1) c1.count += 1 assert (c1.count == 2) df.commit() #print (df.versioned_heap.state_to_app) #print ("Server after modifying once:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C2 #print ("Setting C2") server_ready.set() # Waiting at point S2 #print ("Waiting for S2") client_ready.wait() client_ready.clear() #print ("Server after waiting for client second time.:", df.versioned_heap.version_graph.nodes.keys()) # Check how the merge worked out. df.checkout() assert (c1.count == 3) # Setting point C3 #print ("Setting C3") server_ready.set() # Waiting at point S3 #print ("Waiting for S3") client_ready.wait() client_ready.clear()
def server_df4(send_q, recv_q, server_ready, client_ready): df = Dataframe("SERVER_TEST4", [Car, Counter]) send_q.put(df.details) client_name = recv_q.get() # The server goes first. #print ("Server at start:", df.versioned_heap.version_graph.nodes.keys()) df.checkout() #Add Counter to server c1 = Counter(0) car1 = Car(0) df.add_many(Counter, [c1]) df.add_many(Car, [car1]) assert (c1.count == 0) # Modify the counter value. c1.count += 1 assert (c1.count == 1) # Push record into server. df.commit() #print ("Server after adding 2 cars:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C1 #print ("Setting C1") server_ready.set() # Waiting at point S1 #print ("Waiting for S1") client_ready.wait() client_ready.clear() #print ("Server after waiting for client first time:", df.versioned_heap.version_graph.nodes.keys()) #print (df.versioned_heap.state_to_app) df.checkout() assert (c1.count == 1) c1.count += 1 assert (c1.count == 2) df.commit() #print (df.versioned_heap.state_to_app) #print ("Server after modifying once:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C2 #print ("Setting C2") server_ready.set() # Waiting at point S2 #print ("Waiting for S2") client_ready.wait() client_ready.clear() #print ("Server after waiting for client second time.:", df.versioned_heap.version_graph.nodes.keys()) # Check how the merge worked out. df.checkout() assert (c1.count == 3) # Setting point C3 #print ("Setting C3") server_ready.set() # Waiting at point S3 #print ("Waiting for S3") client_ready.wait() client_ready.clear()
def server_df2(send_q, recv_q, server_ready, client_ready): df = Dataframe("SERVER_TEST2", [Car]) send_q.put(df.details) client_name = recv_q.get() # The server goes first. #print ("Server at start:", df.versioned_heap.version_graph.nodes.keys()) df.checkout() #Add car to server c1 = Car(0) c2 = Car(1) df.add_many(Car, [c1, c2]) # Modify the car value. c1.xvel = 1 # Push record into server. df.commit() #print ("Server after adding 2 cars:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C1 #print ("Setting C1") server_ready.set() # Waiting at point S1 #print ("Waiting for S1") client_ready.wait() client_ready.clear() #print ("Server after waiting for client first time:", df.versioned_heap.version_graph.nodes.keys()) #print (df.versioned_heap.state_to_app) df.checkout() c1.yvel = 1 df.commit() #print (df.versioned_heap.state_to_app) #print ("Server after modifying once:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C2 #print ("Setting C2") server_ready.set() # Waiting at point S2 #print ("Waiting for S2") client_ready.wait() client_ready.clear() #print ("Server after waiting for client second time.:", df.versioned_heap.version_graph.nodes.keys()) # Check how the merge worked out. df.checkout() c1 = df.read_one(Car, 0) c2 = df.read_one(Car, 1) assert ("xvel" not in c1.__dict__) assert ("yvel" not in c1.__dict__) assert ("xpos" not in c1.__dict__) assert ("ypos" not in c1.__dict__) assert ("oid" not in c1.__dict__) assert (c1.xvel is 1) assert (c1.yvel is 1) assert (c1.xpos is 0) assert (c1.ypos is 0) assert (c1.oid is 0) assert ("xvel" not in c2.__dict__) assert ("yvel" not in c2.__dict__) assert ("xpos" not in c2.__dict__) assert ("ypos" not in c2.__dict__) assert ("oid" not in c2.__dict__) assert (c2.xvel is 0) assert (c2.yvel is 1), c2.yvel assert (c2.xpos is 0) assert (c2.ypos is 0) assert (c2.oid is 1) # Setting point C3 #print ("Setting C3") server_ready.set() # Waiting at point S3 #print ("Waiting for S3") client_ready.wait() client_ready.clear()
def server_df7(send_q, recv_q, server_ready, client_ready): df = Dataframe("SERVER_TEST7", [Blocker], resolver={Blocker: blocker_merge_func}) send_q.put(df.details) client_name = recv_q.get() # The server goes first. #print ("Server at start:", df.versioned_heap.version_graph.nodes.keys()) df.checkout() #Add Counter to server b1 = Blocker(0) df.add_many(Blocker, [b1]) assert (b1.prop == 0) b1.prop += 1 assert (b1.prop == 1) # Push record into server. df.commit() #print ("Server after adding 2 cars:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C1 #print ("Setting C1") server_ready.set() # Waiting at point S1 #print ("Waiting for S1") client_ready.wait() client_ready.clear() #print ("Server after waiting for client first time:", df.versioned_heap.version_graph.nodes.keys()) #print (df.versioned_heap.state_to_app) df.checkout() assert (b1.prop == 1) b1.prop += 1 assert (b1.prop == 2) df.commit() #print (df.versioned_heap.state_to_app) #print ("Server after modifying once:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C2 #print ("Setting C2") server_ready.set() # Waiting at point S2 #print ("Waiting for S2") client_ready.wait() client_ready.clear() #print ("Server after waiting for client second time.:", df.versioned_heap.version_graph.nodes.keys()) # Check how the merge worked out. df.checkout() assert (b1.prop == 10), b1.prop # Setting point C3 #print ("Setting C3") server_ready.set() # Waiting at point S3 #print ("Waiting for S3") client_ready.wait() client_ready.clear() assert (b1.prop == 10) b1.prop = 20 assert (b1.prop == 20) df.commit() df.checkout() assert (b1.prop == 5) # Setting point C4 #print ("Setting C4") server_ready.set()
def server_df2(send_q, recv_q, server_ready, client_ready): df = Dataframe("SERVER_TEST2", [Car]) send_q.put(df.details) client_name = recv_q.get() # The server goes first. #print ("Server at start:", df.versioned_heap.version_graph.nodes.keys()) df.checkout() #Add car to server c1 = Car(0) c2 = Car(1) df.add_many(Car, [c1, c2]) # Modify the car value. c1.xvel = 1 # Push record into server. df.commit() #print ("Server after adding 2 cars:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C1 #print ("Setting C1") server_ready.set() # Waiting at point S1 #print ("Waiting for S1") client_ready.wait() client_ready.clear() #print ("Server after waiting for client first time:", df.versioned_heap.version_graph.nodes.keys()) #print (df.versioned_heap.state_to_app) df.checkout() c1.yvel = 1 df.commit() #print (df.versioned_heap.state_to_app) #print ("Server after modifying once:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C2 #print ("Setting C2") server_ready.set() # Waiting at point S2 #print ("Waiting for S2") client_ready.wait() client_ready.clear() #print ("Server after waiting for client second time.:", df.versioned_heap.version_graph.nodes.keys()) # Check how the merge worked out. df.checkout() c1 = df.read_one(Car, 0) c2 = df.read_one(Car, 1) assert ("xvel" not in c1.__dict__) assert ("yvel" not in c1.__dict__) assert ("xpos" not in c1.__dict__) assert ("ypos" not in c1.__dict__) assert ("oid" not in c1.__dict__) assert (c1.xvel is 1) assert (c1.yvel is 1) assert (c1.xpos is 0) assert (c1.ypos is 0) assert (c1.oid is 0) assert ("xvel" not in c2.__dict__) assert ("yvel" not in c2.__dict__) assert ("xpos" not in c2.__dict__) assert ("ypos" not in c2.__dict__) assert ("oid" not in c2.__dict__) assert (c2.xvel is 0) assert (c2.yvel is 1), c2.yvel assert (c2.xpos is 0) assert (c2.ypos is 0) assert (c2.oid is 1) # Setting point C3 #print ("Setting C3") server_ready.set() # Waiting at point S3 #print ("Waiting for S3") client_ready.wait() client_ready.clear()
def server_df7(send_q, recv_q, server_ready, client_ready): df = Dataframe("SERVER_TEST7", [Blocker]) send_q.put(df.details) client_name = recv_q.get() # The server goes first. #print ("Server at start:", df.versioned_heap.version_graph.nodes.keys()) df.checkout() #Add Counter to server b1 = Blocker(0) df.add_many(Blocker, [b1]) assert (b1.prop == 0) b1.prop += 1 assert (b1.prop == 1) # Push record into server. df.commit() #print ("Server after adding 2 cars:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C1 #print ("Setting C1") server_ready.set() # Waiting at point S1 #print ("Waiting for S1") client_ready.wait() client_ready.clear() #print ("Server after waiting for client first time:", df.versioned_heap.version_graph.nodes.keys()) #print (df.versioned_heap.state_to_app) df.checkout() assert (b1.prop == 1) b1.prop += 1 assert (b1.prop == 2) df.commit() #print (df.versioned_heap.state_to_app) #print ("Server after modifying once:", df.versioned_heap.version_graph.nodes.keys()) # Setting point C2 #print ("Setting C2") server_ready.set() # Waiting at point S2 #print ("Waiting for S2") client_ready.wait() client_ready.clear() #print ("Server after waiting for client second time.:", df.versioned_heap.version_graph.nodes.keys()) # Check how the merge worked out. df.checkout() assert (b1.prop == 10), b1.prop # Setting point C3 #print ("Setting C3") server_ready.set() # Waiting at point S3 #print ("Waiting for S3") client_ready.wait() client_ready.clear() assert (b1.prop == 10) b1.prop = 20 assert (b1.prop == 20) df.commit() df.checkout() assert (b1.prop == 5) # Setting point C4 #print ("Setting C4") server_ready.set()